< prev index next >
tests/system/src/test/java/test/robot/javafx/scene/layout/RegionUITestBase.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -27,13 +27,15 @@
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.stage.Stage;
+import javafx.stage.Window;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.Border;
import javafx.scene.layout.CornerRadii;
@@ -78,10 +80,25 @@
waitFirstFrame();
}
static final double TOLERANCE = 0.07;
+ protected boolean checkIntegralUIScale() {
+ AtomicBoolean integralUIScale = new AtomicBoolean(false);
+ runAndWait(() -> {
+ Window window = scene.getWindow();
+ double outScaleX = window.getOutputScaleX();
+ double outScaleY = window.getOutputScaleY();
+
+ if (outScaleX == Math.rint(outScaleX)
+ && outScaleY == Math.rint(outScaleY)) {
+ integralUIScale.set(true);
+ }
+ });
+ return integralUIScale.get();
+ }
+
protected void assertColorEquals(Color expected, int x, int y, double tolerance) {
Color actual = getColorThreadSafe(x, y);
try {
assertColorEquals(expected, actual, tolerance);
} catch (AssertionError error) {
< prev index next >