Skip to content

Commit

Permalink
[359] Add corresponding tests
Browse files Browse the repository at this point in the history
The test org.eclipse.sirius.tests.swtbot.SnapAllShapesTest.testMoveBorderNodeOnNodeInContainer()
has been updated. It used the same border nodes than
"testMoveBorderNodeOnBorderNode()". This case has been detected because
the new test class is inspired by this one.

Bug: #359
  • Loading branch information
lredor committed Apr 18, 2024
1 parent 8b7e36f commit d7c2414
Show file tree
Hide file tree
Showing 6 changed files with 368 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2021 THALES GLOBAL SERVICES and others.
* Copyright (c) 2011, 2024 THALES GLOBAL SERVICES and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -184,7 +184,7 @@ public static Point getScrollSize(GraphicalEditPart part) {
* an edit part on the view
* @return the scroll size
*/
protected static Point getContainerScrollSize(GraphicalEditPart part) {
protected static PrecisionPoint getContainerScrollSize(GraphicalEditPart part) {
Objects.requireNonNull(part);
Point result = new Point(0, 0);
Point diagramScrollSize = new Point(0, 0);
Expand All @@ -200,7 +200,7 @@ protected static Point getContainerScrollSize(GraphicalEditPart part) {
current = current.getParent();
}
result.translate(diagramScrollSize.negate());
return result;
return new PrecisionPoint(result);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package org.eclipse.sirius.tests.swtbot.support.api.condition;

import org.eclipse.draw2d.geometry.PrecisionRectangle;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.sirius.ext.gmf.runtime.editparts.GraphicalHelper;
Expand Down Expand Up @@ -81,10 +82,13 @@ public CheckBoundsCondition(IGraphicalEditPart editPartToWaitForSelection, Recta
public boolean test() throws Exception {
boolean result = false;
if (editPartToWaitFor != null) {
// Only compare "int" values and not precise values here
PrecisionRectangle preciseCurrentBounds = (PrecisionRectangle) getCurrentAbsoluteBounds();
Rectangle currentBounds = new Rectangle(Math.toIntExact(Math.round(preciseCurrentBounds.preciseX())), Math.toIntExact(Math.round(preciseCurrentBounds.preciseY())),
Math.toIntExact(Math.round(preciseCurrentBounds.preciseWidth())), Math.toIntExact(Math.round(preciseCurrentBounds.preciseHeight())));
if (checkHeight && checkWidth) {
result = getCurrentAbsoluteBounds().equals(expectedBounds);
result = currentBounds.equals(expectedBounds);
} else {
Rectangle currentBounds = getCurrentAbsoluteBounds();
if (checkWidth) {
result = currentBounds.width == expectedBounds.width;
} else if (checkHeight) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_OrqdYhaIEeWQ3O79R6E3Ug" x="-92" y="1" width="40" height="32"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_OrmL8RaIEeWQ3O79R6E3Ug" fontName="Ubuntu" fontHeight="8"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_OrmL8haIEeWQ3O79R6E3Ug" x="169" y="-55" width="168" height="69"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_OrmL8haIEeWQ3O79R6E3Ug" x="146" y="-55" width="168" height="69"/>
</children>
<children xmi:type="notation:Node" xmi:id="_OroBIBaIEeWQ3O79R6E3Ug" type="3007" element="_OqG-MBaIEeWQ3O79R6E3Ug">
<children xmi:type="notation:Node" xmi:id="_OrooMBaIEeWQ3O79R6E3Ug" type="5003">
Expand Down
Loading

0 comments on commit d7c2414

Please sign in to comment.