Search in sources :

Example 16 with BoundingBox

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));
}
Also used : Bounds(javafx.geometry.Bounds) BoundingBox(javafx.geometry.BoundingBox) Test(org.junit.Test)

Example 17 with BoundingBox

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)));
}
Also used : Point2D(javafx.geometry.Point2D) BoundingBox(javafx.geometry.BoundingBox) Test(org.junit.Test)

Example 18 with BoundingBox

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);
}
Also used : BoundingBox(javafx.geometry.BoundingBox) Before(org.junit.Before)

Example 19 with BoundingBox

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)));
}
Also used : Point2D(javafx.geometry.Point2D) BoundingBox(javafx.geometry.BoundingBox) PointQuery(org.testfx.service.query.PointQuery) Test(org.junit.Test)

Example 20 with BoundingBox

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);
}
Also used : Bounds(javafx.geometry.Bounds) BoundingBox(javafx.geometry.BoundingBox) Polyline(javafx.scene.shape.Polyline)

Aggregations

BoundingBox (javafx.geometry.BoundingBox)23 Bounds (javafx.geometry.Bounds)11 Test (org.junit.Test)7 Point2D (javafx.geometry.Point2D)6 Node (javafx.scene.Node)4 ArrayList (java.util.ArrayList)3 List (java.util.List)2 DoubleProperty (javafx.beans.property.DoubleProperty)2 ObjectProperty (javafx.beans.property.ObjectProperty)2 SimpleDoubleProperty (javafx.beans.property.SimpleDoubleProperty)2 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)2 Rectangle2D (javafx.geometry.Rectangle2D)2 Paint (javafx.scene.paint.Paint)2 Rectangle (javafx.scene.shape.Rectangle)2 JavaFXLibraryNonFatalException (javafxlibrary.exceptions.JavaFXLibraryNonFatalException)2 RobotKeyword (org.robotframework.javalib.annotation.RobotKeyword)2 BSBObject (blue.orchestra.blueSynthBuilder.BSBObject)1 ShapeType (com.almasb.fxgl.physics.box2d.collision.shapes.ShapeType)1 CachedTransition (com.jfoenix.transitions.CachedTransition)1 RectBounds (com.sun.javafx.geom.RectBounds)1