forked from eclipse-gef/gef-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use PrecisionPoint instead of Point to handle deprecation warning
This commit partially reverts fd75841 and uses PrecisionPoints instead of Points in the FanRouter class, to store the bend point. Note that because the mid point is a plain point, the equality check is done using the integer coordinates. Resolves eclipse-gef#383
- Loading branch information
Showing
4 changed files
with
66 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
org.eclipse.draw2d.tests/src/org/eclipse/draw2d/test/FanRouterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/******************************************************************************* | ||
* Copyright (c) Patrick Ziegler and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Patrick Ziegler - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.draw2d.test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.eclipse.draw2d.Connection; | ||
import org.eclipse.draw2d.ConnectionAnchor; | ||
import org.eclipse.draw2d.FanRouter; | ||
import org.eclipse.draw2d.PolylineConnection; | ||
import org.eclipse.draw2d.XYAnchor; | ||
import org.eclipse.draw2d.geometry.Point; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class FanRouterTest { | ||
FanRouter router; | ||
Connection connection; | ||
ConnectionAnchor sourceAnchor; | ||
ConnectionAnchor targetAnchor; | ||
|
||
@Before | ||
public void setUp() { | ||
sourceAnchor = new XYAnchor(new Point(0, 0)); | ||
targetAnchor = new XYAnchor(new Point(0, 50)); | ||
|
||
connection = new PolylineConnection(); | ||
connection.setSourceAnchor(sourceAnchor); | ||
connection.setTargetAnchor(targetAnchor); | ||
|
||
router = new FanRouter(); | ||
} | ||
|
||
/** | ||
* When routing the "same" connection multiple times, no additional break point | ||
* needs to be created. | ||
*/ | ||
@Test | ||
public void testRouteSameConnection() { | ||
router.route(connection); | ||
assertEquals(connection.getPoints().size(), 2); | ||
|
||
router.route(connection); | ||
assertEquals(connection.getPoints().size(), 2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters