aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/util/HighDpiAwareApplicationTest.java
blob: 2924b3faa752020d86a8b71cef5ebe62b1154525 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package at.ac.tuwien.sepm.assignment.groupphase.util;

import javafx.geometry.Bounds;
import javafx.scene.Node;
import org.testfx.api.FxRobotContext;
import org.testfx.framework.junit.ApplicationTest;
import org.testfx.service.locator.impl.BoundsLocatorImpl;
import org.testfx.service.locator.impl.PointLocatorImpl;

public abstract class HighDpiAwareApplicationTest extends ApplicationTest {

    public HighDpiAwareApplicationTest() {
        FxRobotContext context = robotContext();
        context.setBoundsLocator(
                new BoundsLocatorImpl() {
                    @Override
                    public Bounds boundsOnScreenFor(Node node) {
                        Bounds bounds = super.boundsOnScreenFor(node);
                        return ScaledBounds.wrap(bounds);
                    }
                });
        robotContext().setPointLocator(new PointLocatorImpl(context.getBoundsLocator()));
    }
}