< prev index next >

tests/system/src/test/java/test/robot/com/sun/glass/ui/monocle/SingleTouchTest.java

Print this page
rev 9504 : need to fix test log and others

@@ -23,11 +23,11 @@
  * questions.
  */
 
 package test.robot.com.sun.glass.ui.monocle;
 
-import com.sun.glass.ui.monocle.TestLog;
+import com.sun.glass.ui.monocle.TestLogShim;
 import test.robot.com.sun.glass.ui.monocle.TestApplication;
 import test.robot.com.sun.glass.ui.monocle.input.devices.TestTouchDevice;
 import test.robot.com.sun.glass.ui.monocle.input.devices.TestTouchDevices;
 import javafx.scene.Group;
 import javafx.scene.Scene;

@@ -63,19 +63,19 @@
         int p = device.addPoint(x, y);
         device.sync();
         // release
         device.removePoint(p);
         device.sync();
-        TestLog.waitForLog("Mouse pressed: %d, %d", x, y);
-        TestLog.waitForLog("Mouse released: %d, %d", x, y);
-        TestLog.waitForLog("Mouse clicked: %d, %d", x, y);
-        TestLog.waitForLog("Touch pressed: %d, %d", x, y);
-        TestLog.waitForLog("Touch released: %d, %d", x, y);
+        TestLogShim.waitForLog("Mouse pressed: %d, %d", x, y);
+        TestLogShim.waitForLog("Mouse released: %d, %d", x, y);
+        TestLogShim.waitForLog("Mouse clicked: %d, %d", x, y);
+        TestLogShim.waitForLog("Touch pressed: %d, %d", x, y);
+        TestLogShim.waitForLog("Touch released: %d, %d", x, y);
 
         // Check that the touch event has one touch point.
         Assert.assertEquals("Expected only one touch point", 0,
-                            TestLog.getLog().stream()
+                            TestLogShim.getLog().stream()
                             .filter(s -> s.startsWith("Touch points count"))
                             .filter(s -> !s.startsWith("Touch points count: [1]")).count());
     }
 
     /**

@@ -86,29 +86,29 @@
         final int x = (int) Math.round(width * 0.5);
         final int y = (int) Math.round(height * 0.5);
         // tap
         int p = device.addPoint(x, y);
         device.sync();
-        TestLog.waitForLog("Mouse pressed: %d, %d", x, y);
-        TestLog.waitForLog("Touch pressed: %d, %d", x, y);
-        TestLog.reset();
+        TestLogShim.waitForLog("Mouse pressed: %d, %d", x, y);
+        TestLogShim.waitForLog("Touch pressed: %d, %d", x, y);
+        TestLogShim.reset();
         // hold
         device.resendStateAndSync();
         device.sync();
         // release
         device.removePoint(p);
         device.sync();
-        TestLog.waitForLog("Mouse released: %d, %d", x, y);
-        TestLog.waitForLog("Mouse clicked: %d, %d", x, y);
-        TestLog.waitForLog("Touch released: %d, %d", x, y);
+        TestLogShim.waitForLog("Mouse released: %d, %d", x, y);
+        TestLogShim.waitForLog("Mouse clicked: %d, %d", x, y);
+        TestLogShim.waitForLog("Touch released: %d, %d", x, y);
         // We don't have anything sensible to do with repeat events in the
         // same location, so make sure they are filtered out.
-        Assert.assertEquals(0, TestLog.countLogContaining("Mouse pressed:"));
-        Assert.assertEquals(0, TestLog.countLogContaining("Touch pressed:"));
+        Assert.assertEquals(0, TestLogShim.countLogContaining("Mouse pressed:"));
+        Assert.assertEquals(0, TestLogShim.countLogContaining("Touch pressed:"));
         // Check that the touch event has one touch point.
         Assert.assertEquals("Expected only one touch point", 0,
-                            TestLog.getLog().stream()
+                            TestLogShim.getLog().stream()
                             .filter(s -> s.startsWith("Touch points count"))
                             .filter(s -> !s.startsWith("Touch points count: [1]")).count());
     }
 
     /**

@@ -127,20 +127,20 @@
         device.setPoint(p, x2, y2);
         device.sync();
         // release
         device.removePoint(p);
         device.sync();
-        TestLog.waitForLog("Mouse pressed: %d, %d", x1, y1);
-        TestLog.waitForLog("Mouse dragged: %d, %d", x2, y2);
-        TestLog.waitForLog("Mouse released: %d, %d", x2, y2);
-        TestLog.waitForLog("Mouse clicked: %d, %d", x2, y2);
-        TestLog.waitForLog("Touch pressed: %d, %d", x1, y1);
-        TestLog.waitForLog("Touch moved: %d, %d", x2, y2);
-        TestLog.waitForLog("Touch released: %d, %d", x2, y2);
+        TestLogShim.waitForLog("Mouse pressed: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Mouse dragged: %d, %d", x2, y2);
+        TestLogShim.waitForLog("Mouse released: %d, %d", x2, y2);
+        TestLogShim.waitForLog("Mouse clicked: %d, %d", x2, y2);
+        TestLogShim.waitForLog("Touch pressed: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Touch moved: %d, %d", x2, y2);
+        TestLogShim.waitForLog("Touch released: %d, %d", x2, y2);
         // Check that the touch event has one touch point.
         Assert.assertEquals("Expected only one touch point", 0,
-                            TestLog.getLog().stream()
+                            TestLogShim.getLog().stream()
                             .filter(s -> s.startsWith("Touch points count"))
                             .filter(s -> !s.startsWith("Touch points count: [1]")).count());
     }
 
     /**

@@ -158,20 +158,20 @@
         device.setPoint(p, x2, y1);
         device.sync();
         // release
         device.removePoint(p);
         device.sync();
-        TestLog.waitForLog("Mouse pressed: %d, %d", x1, y1);
-        TestLog.waitForLog("Mouse dragged: %d, %d", x2, y1);
-        TestLog.waitForLog("Mouse released: %d, %d", x2, y1);
-        TestLog.waitForLog("Mouse clicked: %d, %d", x2, y1);
-        TestLog.waitForLog("Touch pressed: %d, %d", x1, y1);
-        TestLog.waitForLog("Touch moved: %d, %d", x2, y1);
-        TestLog.waitForLog("Touch released: %d, %d", x2, y1);
+        TestLogShim.waitForLog("Mouse pressed: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Mouse dragged: %d, %d", x2, y1);
+        TestLogShim.waitForLog("Mouse released: %d, %d", x2, y1);
+        TestLogShim.waitForLog("Mouse clicked: %d, %d", x2, y1);
+        TestLogShim.waitForLog("Touch pressed: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Touch moved: %d, %d", x2, y1);
+        TestLogShim.waitForLog("Touch released: %d, %d", x2, y1);
         // Check that the touch event has one touch point.
         Assert.assertEquals("Expected only one touch point", 0,
-                            TestLog.getLog().stream()
+                            TestLogShim.getLog().stream()
                             .filter(s -> s.startsWith("Touch points count"))
                             .filter(s -> !s.startsWith("Touch points count: [1]")).count());
     }
 
     /**

@@ -189,20 +189,20 @@
         device.setPoint(p, x1, y2);
         device.sync();
         // release
         device.removePoint(p);
         device.sync();
-        TestLog.waitForLog("Mouse pressed: %d, %d", x1, y1);
-        TestLog.waitForLog("Mouse dragged: %d, %d", x1, y2);
-        TestLog.waitForLog("Mouse released: %d, %d", x1, y2);
-        TestLog.waitForLog("Mouse clicked: %d, %d", x1, y2);
-        TestLog.waitForLog("Touch pressed: %d, %d", x1, y1);
-        TestLog.waitForLog("Touch moved: %d, %d", x1, y2);
-        TestLog.waitForLog("Touch released: %d, %d", x1, y2);
+        TestLogShim.waitForLog("Mouse pressed: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Mouse dragged: %d, %d", x1, y2);
+        TestLogShim.waitForLog("Mouse released: %d, %d", x1, y2);
+        TestLogShim.waitForLog("Mouse clicked: %d, %d", x1, y2);
+        TestLogShim.waitForLog("Touch pressed: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Touch moved: %d, %d", x1, y2);
+        TestLogShim.waitForLog("Touch released: %d, %d", x1, y2);
         // Check that the touch event has one touch point.
         Assert.assertEquals("Expected only one touch point", 0,
-                            TestLog.getLog().stream()
+                            TestLogShim.getLog().stream()
                             .filter(s -> s.startsWith("Touch points count"))
                             .filter(s -> !s.startsWith("Touch points count: [1]")).count());
     }
 
     /**

@@ -222,20 +222,20 @@
         device.setPoint(p, x2, y2);
         device.sync();
         // release
         device.removePoint(p);
         device.sync();
-        TestLog.waitForLog("Mouse pressed: %d, %d", x1, y1);
-        TestLog.waitForLog("Mouse released: %d, %d", x1, y1);
-        TestLog.waitForLog("Mouse clicked: %d, %d", x1, y1);
-        TestLog.waitForLog("Touch pressed: %d, %d", x1, y1);
-        TestLog.waitForLog("Touch released: %d, %d", x1, y1);
-        Assert.assertEquals(0l, TestLog.countLogContaining("Mouse dragged"));
-        Assert.assertEquals(0l, TestLog.countLogContaining("Touch moved"));
+        TestLogShim.waitForLog("Mouse pressed: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Mouse released: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Mouse clicked: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Touch pressed: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Touch released: %d, %d", x1, y1);
+        Assert.assertEquals(0l, TestLogShim.countLogContaining("Mouse dragged"));
+        Assert.assertEquals(0l, TestLogShim.countLogContaining("Touch moved"));
         // Check that the touch event has one touch point.
         Assert.assertEquals("Expected only one touch point", 0,
-                            TestLog.getLog().stream()
+                            TestLogShim.getLog().stream()
                             .filter(s -> s.startsWith("Touch points count"))
                             .filter(s -> !s.startsWith("Touch points count: [1]")).count());
     }
 
     /**

@@ -255,27 +255,27 @@
         device.setPoint(p, x2, y2);
         device.sync();
         // release
         device.removePoint(p);
         device.sync();
-        TestLog.waitForLog("Mouse pressed: %d, %d", x1, y1);
-        TestLog.waitForLog("Mouse released: %d, %d", x2, y2);
-        TestLog.waitForLog("Mouse clicked: %d, %d", x2, y2);
-        TestLog.waitForLog("Touch pressed: %d, %d", x1, y1);
-        TestLog.waitForLog("Touch released: %d, %d", x2, y2);
-        TestLog.clear();
+        TestLogShim.waitForLog("Mouse pressed: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Mouse released: %d, %d", x2, y2);
+        TestLogShim.waitForLog("Mouse clicked: %d, %d", x2, y2);
+        TestLogShim.waitForLog("Touch pressed: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Touch released: %d, %d", x2, y2);
+        TestLogShim.clear();
         // tap again and release
         p = device.addPoint(x1, y1);
         device.sync();
-        TestLog.waitForLog("Mouse pressed: %d, %d", x1, y1);
-        TestLog.waitForLog("Touch pressed: %d, %d", x1, y1);
-        TestLog.clear();
+        TestLogShim.waitForLog("Mouse pressed: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Touch pressed: %d, %d", x1, y1);
+        TestLogShim.clear();
         device.removePoint(p);
         device.sync();
-        TestLog.waitForLog("Mouse released: %d, %d", x1, y1);
-        TestLog.waitForLog("Mouse clicked: %d, %d", x1, y1);
-        TestLog.waitForLog("Touch released: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Mouse released: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Mouse clicked: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Touch released: %d, %d", x1, y1);
     }
         
     /**
      * Touch down, change scene, release finger.
      */

@@ -284,19 +284,19 @@
     public void testChangeSceneDuringTap() throws Exception {
         final int x1 = (int) Math.round(width * 0.3);
         final int y1 = (int) Math.round(height * 0.3);
         int p1 = device.addPoint(x1, y1);
         device.sync();
-        TestLog.waitForLog("Touch pressed: %d, %d", x1, y1);
+        TestLogShim.waitForLog("Touch pressed: %d, %d", x1, y1);
         TestRunnable.invokeAndWait(() ->
         {
             Rectangle r = new Rectangle(0, 0, width, height);
             Group g = new Group();
             g.getChildren().add(r);
             Scene scene = new Scene(g);
             TestApplication.getStage().setScene(scene);
         });
         device.removePoint(p1);
         device.sync();
-        Assert.assertEquals(1, TestLog.countLogContaining("Mouse clicked: " + x1 +", " + y1));
+        Assert.assertEquals(1, TestLogShim.countLogContaining("Mouse clicked: " + x1 +", " + y1));
     }
 }
< prev index next >