aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-01-23 14:05:03 +0100
committerSven Gothel <[email protected]>2023-01-23 14:05:03 +0100
commit8e1233037e130629b2406ba01852ca17310753a2 (patch)
tree93ceb65f72630a9d8e5173bbc0f4ea1ce5748d27 /src/test/com/jogamp/opengl
parentdf73148ad769d65d2d4633c3f80deeccac90ad39 (diff)
TestDisplayLifecycle01NEWT: Invisible window might have been moved away (Windows 10)
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/NewtTestUtil.java23
2 files changed, 21 insertions, 5 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java
index a7a822647..8cd38d4fc 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java
@@ -140,7 +140,8 @@ public class TestDisplayLifecycle01NEWT extends UITestCase {
window.setVisible(false);
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
- Assert.assertTrue(NewtTestUtil.hasPositionMax2xInsetsOr64Pix(window, xy_pos, xy_pos));
+ // Invisible window might have been moved away (Windows 10), informal only:
+ NewtTestUtil.hasPositionMax2xInsetsOr64Pix(window, xy_pos, xy_pos);
// just make the Window visible again
window.resetFPSCounter();
diff --git a/src/test/com/jogamp/opengl/test/junit/util/NewtTestUtil.java b/src/test/com/jogamp/opengl/test/junit/util/NewtTestUtil.java
index 9ee63dcf8..1c50b7c15 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/NewtTestUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/NewtTestUtil.java
@@ -45,30 +45,38 @@ public class NewtTestUtil extends TestUtil {
AtomicInteger closing = new AtomicInteger(0);
AtomicInteger closed = new AtomicInteger(0);
+ @Override
public void reset() {
closing.set(0);
closed.set(0);
}
+ @Override
public int getWindowClosingCount() {
return closing.get();
}
+ @Override
public int getWindowClosedCount() {
return closed.get();
}
+ @Override
public boolean isWindowClosing() {
return 0 < closing.get();
}
+ @Override
public boolean isWindowClosed() {
return 0 < closed.get();
}
+ @Override
public void windowDestroyNotify(final WindowEvent e) {
closing.incrementAndGet();
System.err.println("NEWTWindowClosingAdapter.windowDestroyNotify: "+this);
}
+ @Override
public void windowDestroyed(final WindowEvent e) {
closed.incrementAndGet();
System.err.println("NEWTWindowClosingAdapter.windowDestroyed: "+this);
}
+ @Override
public String toString() {
return "NEWTWindowClosingAdapter[closing "+closing+", closed "+closed+"]";
}
@@ -217,12 +225,19 @@ public class NewtTestUtil extends TestUtil {
}
return hasPosition(win, shouldX, shouldY, maxDX, maxDY);
}
+
/**
- * Validates whether the window position is on the given position within the given tolerances.
+ * Validates whether the window position is within the expected position including given tolerance.
*/
- public static boolean hasPosition(final Window win, final int shouldX, final int shouldY, final int maxDX, final int maxDY) {
- final boolean ok = Math.abs(shouldX - win.getX()) <= maxDX &&
- Math.abs(shouldY - win.getY()) <= maxDY ;
+ public static boolean hasPosition(final Window win, final int expX, final int expY, final int maxDX, final int maxDY) {
+ final int dx = Math.abs(expX - win.getX());
+ final int dy = Math.abs(expY - win.getY());
+ final boolean ok = dx <= maxDX && dy <= maxDY ;
+ if( !ok ) {
+ System.err.println("Position OFF: abs( exp "+expX+"/"+expY+" - has "+win.getX()+"/"+win.getY()+" ) = "+dx+"/"+dy+" > "+maxDX+"/"+maxDY);
+ } else {
+ System.err.println("Position OK : abs( exp "+expX+"/"+expY+" - has "+win.getX()+"/"+win.getY()+" ) = "+dx+"/"+dy+" <= "+maxDX+"/"+maxDY);
+ }
return ok;
}
}