use of javafx.geometry.BoundingBox in project TestFX by TestFX.
the class BoundsQueryUtilsTest method boundsOnScreen_window.
@Test
public void boundsOnScreen_window() {
Bounds bounds = BoundsQueryUtils.boundsOnScreen(new BoundingBox(1, 2, 3, 4), stage);
verifyThat(bounds, hasBounds(stage.getX() + 1, stage.getY() + 2, 3, 4));
}
use of javafx.geometry.BoundingBox in project TestFX by TestFX.
the class PointQueryUtilsTest method atPosition_with_positions.
@Test
public void atPosition_with_positions() {
// given:
BoundingBox bounds = new BoundingBox(100, 1000, 200, 2000);
// then:
assertThat(atPosition(bounds, Pos.TOP_LEFT), is(new Point2D(100, 1000)));
assertThat(atPosition(bounds, Pos.TOP_CENTER), is(new Point2D(200, 1000)));
assertThat(atPosition(bounds, Pos.TOP_RIGHT), is(new Point2D(300, 1000)));
assertThat(atPosition(bounds, Pos.CENTER_LEFT), is(new Point2D(100, 2000)));
assertThat(atPosition(bounds, Pos.CENTER), is(new Point2D(200, 2000)));
assertThat(atPosition(bounds, Pos.CENTER_RIGHT), is(new Point2D(300, 2000)));
assertThat(atPosition(bounds, Pos.BOTTOM_LEFT), is(new Point2D(100, 3000)));
assertThat(atPosition(bounds, Pos.BOTTOM_CENTER), is(new Point2D(200, 3000)));
assertThat(atPosition(bounds, Pos.BOTTOM_RIGHT), is(new Point2D(300, 3000)));
}
use of javafx.geometry.BoundingBox in project TestFX by TestFX.
the class PointLocatorImplTest method setup.
@Before
public void setup() {
boundsLocatorStub = new BoundsLocatorStub();
pointLocator = new PointLocatorImpl(boundsLocatorStub);
nodeBounds = new BoundingBox(100, 100, 50, 50);
nodeBoundsAfterChange = new BoundingBox(200, 200, 50, 50);
sceneBounds = new BoundingBox(100, 100, 600, 400);
sceneBoundsAfterChange = new BoundingBox(200, 200, 600, 400);
windowBounds = new BoundingBox(100, 100, 600, 400);
windowBoundsAfterChange = new BoundingBox(200, 200, 600, 400);
}
use of javafx.geometry.BoundingBox in project TestFX by TestFX.
the class PointLocatorImplTest method pointFor_Bounds_atOffset.
@Test
public void pointFor_Bounds_atOffset() {
// given:
PointQuery pointQuery = pointLocator.point(new BoundingBox(100, 100, 50, 50));
// when:
Point2D point = pointQuery.atOffset(0, 0).query();
// then:
assertThat(point, CoreMatchers.equalTo(new Point2D(100, 100)));
}
use of javafx.geometry.BoundingBox in project jphp by jphp-compiler.
the class TabOutlineMarker method updateBounds.
/**
* Update the tab outline
*
* @param containerBounds
* the bounds of the container
* @param referenceBounds
* the bounds of the reference tab
* @param before
* <code>true</code> to mark the insert point before reference
* bounds
*/
public void updateBounds(Bounds containerBounds, Bounds referenceBounds, boolean before) {
if (containerBounds.equals(this.containerBounds) && referenceBounds.equals(this.referenceBounds) && before == this.before) {
return;
}
this.containerBounds = containerBounds;
this.referenceBounds = referenceBounds;
this.before = before;
Polyline pl = new Polyline();
Bounds _referenceBounds = referenceBounds;
if (before) {
_referenceBounds = new BoundingBox(Math.max(0, _referenceBounds.getMinX() - _referenceBounds.getWidth() / 2), _referenceBounds.getMinY(), _referenceBounds.getWidth(), _referenceBounds.getHeight());
} else {
_referenceBounds = new BoundingBox(Math.max(0, _referenceBounds.getMaxX() - _referenceBounds.getWidth() / 2), _referenceBounds.getMinY(), _referenceBounds.getWidth(), _referenceBounds.getHeight());
}
pl.getPoints().addAll(// start
Double.valueOf(0.0), Double.valueOf(_referenceBounds.getMaxY()), // tab start
Double.valueOf(_referenceBounds.getMinX()), Double.valueOf(_referenceBounds.getMaxY()), // // tab start top
Double.valueOf(_referenceBounds.getMinX()), Double.valueOf(_referenceBounds.getMinY()), // tab end right
Double.valueOf(_referenceBounds.getMaxX()), Double.valueOf(_referenceBounds.getMinY()), // tab end bottom
Double.valueOf(_referenceBounds.getMaxX()), Double.valueOf(_referenceBounds.getMaxY()), // end
Double.valueOf(containerBounds.getMaxX()), Double.valueOf(_referenceBounds.getMaxY()), // -----------------
Double.valueOf(containerBounds.getMaxX()), Double.valueOf(containerBounds.getMaxY()), // -----------------
Double.valueOf(containerBounds.getMinX()), Double.valueOf(containerBounds.getMaxY()), // -----------------
Double.valueOf(containerBounds.getMinX()), Double.valueOf(_referenceBounds.getMaxY()));
pl.strokeProperty().bind(fillProperty());
pl.setStrokeWidth(3);
pl.setStrokeType(StrokeType.INSIDE);
getChildren().setAll(pl);
}
Aggregations