changeset 7300:498c76f90ebf

RT-37558, RT-37373, RT-37139, RT-37138 - Fixing and adding different unit tests for inertia feature
author Elina Kleyman <elina.kleyman@oracle.com>
date Tue, 17 Jun 2014 13:24:43 +0300
parents eb6beaecf92d
children 1f3e6553e00e
files tests/system/src/test/java/com/sun/glass/ui/monocle/input/RotateTest.java tests/system/src/test/java/com/sun/glass/ui/monocle/input/ScrollTest.java tests/system/src/test/java/com/sun/glass/ui/monocle/input/ScrollTestBase.java tests/system/src/test/java/com/sun/glass/ui/monocle/input/ZoomTest.java
diffstat 4 files changed, 60 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/tests/system/src/test/java/com/sun/glass/ui/monocle/input/RotateTest.java	Tue Jun 17 10:54:58 2014 +0300
+++ b/tests/system/src/test/java/com/sun/glass/ui/monocle/input/RotateTest.java	Tue Jun 17 13:24:43 2014 +0300
@@ -74,7 +74,6 @@
             device.removePoint(p2);
             device.sync();
         }
-        Thread.sleep(2000);
     }
 
     private void updateNewTouchPoint(int angle, int radius, int centerX, int centerY) {
@@ -199,6 +198,13 @@
         if (TestLog.countLogContaining("Rotation finished") > 0) {
             TestLog.waitForLogContaining("Rotation", "inertia value: true");
         }
+        TestLog.reset();
+        p2 = device.addPoint(x2, y2);
+        device.sync();
+        device.removePoint(p2);
+        device.sync();
+        Assert.assertEquals(0, TestLog.countLogContaining("inertia value: true"));
+        TestLog.waitForLogContaining("TouchPoint: RELEASED %d, %d", x2, y2);
     }
 
     private void Rotate(int radius, int x2, int y2, int angleStep,
--- a/tests/system/src/test/java/com/sun/glass/ui/monocle/input/ScrollTest.java	Tue Jun 17 10:54:58 2014 +0300
+++ b/tests/system/src/test/java/com/sun/glass/ui/monocle/input/ScrollTest.java	Tue Jun 17 13:24:43 2014 +0300
@@ -229,12 +229,15 @@
         TestLog.waitForLogContaining("Scroll started, DeltaX: " + 0
                 + ", DeltaY: " + 0
                 + ", totalDeltaX: " + 0
-                + ", totalDeltaY: " + 0);
+                + ", totalDeltaY: " + 0
+                + ", touch points: " + 2
+                + ", inertia value: false");
         TestLog.waitForLogContaining("Scroll, DeltaX: " + 0
                 + ", DeltaY: " + avgDelta
                 + ", totalDeltaX: " + 0
                 + ", totalDeltaY: " + totalDeltaY
-                + ", touch points: " + 2);
+                + ", touch points: " + 2
+                + ", inertia value: false");
         String expectedLog;
         for (int i = 2; i <= numOfIterations; i++) {
             point1Y += deltaY1;
@@ -248,7 +251,8 @@
             totalDeltaY = avgDelta * i;
             expectedLog = "Scroll, DeltaX: " + 0 + ", DeltaY: " + avgDelta
                     + ", totalDeltaX: " + 0
-                    + ", totalDeltaY: " + totalDeltaY;
+                    + ", totalDeltaY: " + totalDeltaY
+                    + ", touch points: " + 2 + ", inertia value: false";
             TestLog.waitForLogContaining(expectedLog);
         }
         releaseAllFingers();
--- a/tests/system/src/test/java/com/sun/glass/ui/monocle/input/ScrollTestBase.java	Tue Jun 17 10:54:58 2014 +0300
+++ b/tests/system/src/test/java/com/sun/glass/ui/monocle/input/ScrollTestBase.java	Tue Jun 17 13:24:43 2014 +0300
@@ -34,7 +34,7 @@
 /**
  * Base class, intended for extending and creation of different types of scroll tests
  *  */
-public class ScrollTestBase extends ParameterizedTestBase {
+public abstract class ScrollTestBase extends ParameterizedTestBase {
 
     protected int point1X;
     protected int point1Y;
@@ -336,6 +336,9 @@
         totalDeltaX = 0;
         totalDeltaY = 0;
         Assert.assertEquals(expectedValue, TestLog.countLogContaining(expectedLog));
+        if (TestLog.countLogContaining("Scroll finished") > 0) {
+            TestLog.waitForLogContaining("Scroll", "inertia value: true");
+        }
     }
 
     /**
@@ -366,6 +369,9 @@
         totalDeltaX = 0;
         totalDeltaY = 0;
         Assert.assertEquals(expectedValue, TestLog.countLogContaining(expectedLog));
+        if (TestLog.countLogContaining("Scroll finished") > 0 && device.getPressedPoints() == 0) {
+            TestLog.waitForLogContaining("Scroll", "inertia value: true");
+        }
     }
 
     /**
@@ -396,5 +402,8 @@
         totalDeltaX = 0;
         totalDeltaY = 0;
         Assert.assertEquals(expectedValue, TestLog.countLogContaining(expectedLog));
+        if (TestLog.countLogContaining("Scroll finished") > 0) {
+            TestLog.waitForLogContaining("Scroll", "inertia value: true");
+        }
     }
 }
--- a/tests/system/src/test/java/com/sun/glass/ui/monocle/input/ZoomTest.java	Tue Jun 17 10:54:58 2014 +0300
+++ b/tests/system/src/test/java/com/sun/glass/ui/monocle/input/ZoomTest.java	Tue Jun 17 13:24:43 2014 +0300
@@ -108,9 +108,9 @@
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, newy1);
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, newy2);
         TestLog.waitForLogContaining("Zoom started, factor: " + factor0
-                + ", total factor: " + factor0);
+                + ", total factor: " + factor0  + ", inertia value: false");
         TestLog.waitForLogContaining("Zoom, factor: " + factor1
-                + ", total factor: " + factor1);
+                + ", total factor: " + factor1 + ", inertia value: false");
 
         step = step * 2;
         newy1 = y1 - step;
@@ -124,28 +124,27 @@
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, newy1);
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, newy2);
         TestLog.waitForLogContaining("Zoom, factor: " + factor2
-                + ", total factor: " + (factor1 * factor2));
+                + ", total factor: " + (factor1 * factor2)
+                + ", inertia value: false");
 
         //release first finger
         TestLog.reset();
         device.removePoint(p1);
         device.sync();
-        TestLog.waitForLogContaining("TouchPoint: RELEASED %d, %d",
-                x1, newy1);
-        TestLog.waitForLogContaining("TouchPoint: STATIONARY %d, %d",
-                x2, newy2);
+        TestLog.waitForLogContaining("TouchPoint: RELEASED %d, %d", x1, newy1);
+        TestLog.waitForLogContaining("TouchPoint: STATIONARY %d, %d", x2, newy2);
         TestLog.waitForLogContaining("Zoom finished, factor: " + factor0
-                + ", total factor: " + (factor1 * factor2));
-
+                + ", total factor: " + (factor1 * factor2)
+                + ", inertia value: false");
         //release second finger
         TestLog.reset();
         device.removePoint(p2);
         device.sync();
         TestLog.waitForLogContaining("Touch released: %d, %d", x2, newy2);
-        TestLog.waitForLogContaining("TouchPoint: RELEASED %d, %d",
-                x2, newy2);
+        TestLog.waitForLogContaining("TouchPoint: RELEASED %d, %d", x2, newy2);
         TestLog.waitForLog("Mouse released: %d, %d", x2, newy2);
         TestLog.waitForLog("Mouse clicked: %d, %d", x2, newy2);
+        TestLog.waitForLogContaining("Zoom", "inertia value: true");
         Assert.assertEquals(1, TestLog.countLogContaining("Mouse clicked: "
                 + x2 +", " + newy2));
     }
@@ -184,9 +183,9 @@
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, newy1);
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, newy2);
         TestLog.waitForLogContaining("Zoom started, factor: " + factor0
-                + ", total factor: " + factor0);
+                + ", total factor: " + factor0 + ", inertia value: false");
         TestLog.waitForLogContaining("Zoom, factor: " + factor1
-                + ", total factor: " + factor1);
+                + ", total factor: " + factor1  + ", inertia value: false");
 
         step = step * 2;
         newy1 = y1 - step;
@@ -200,7 +199,8 @@
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, newy1);
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, newy2);
         TestLog.waitForLogContaining("Zoom, factor: " + factor2
-                + ", total factor: " + (factor1 * factor2));
+                + ", total factor: " + (factor1 * factor2)
+                + ", inertia value: false");
 
         //release first finger
         TestLog.reset();
@@ -211,7 +211,8 @@
         TestLog.waitForLogContaining("TouchPoint: STATIONARY %d, %d",
                 x2, newy2);
         TestLog.waitForLogContaining("Zoom finished, factor: " + factor0
-                + ", total factor: " + (factor1 * factor2));
+                + ", total factor: " + (factor1 * factor2)
+                + ", inertia value: false");
 
         //release second finger
         TestLog.reset();
@@ -222,6 +223,7 @@
                 x2, newy2);
         TestLog.waitForLog("Mouse released: %d, %d", x2, newy2);
         TestLog.waitForLog("Mouse clicked: %d, %d", x2, newy2);
+        TestLog.waitForLogContaining("Zoom", "inertia value: true");
         Assert.assertEquals(1, TestLog.countLogContaining("Mouse clicked: "
                 + x2 +", " + newy2));
     }
@@ -260,9 +262,9 @@
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, newy1);
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, newy2);
         TestLog.waitForLogContaining("Zoom started, factor: " + factor0
-                + ", total factor: " + factor0);
+                + ", total factor: " + factor0 + ", inertia value: false");
         TestLog.waitForLogContaining("Zoom, factor: " + factor1
-                + ", total factor: " + factor1);
+                + ", total factor: " + factor1 + ", inertia value: false");
 
         TestLog.reset();
         y1 = y1 + step;
@@ -278,7 +280,8 @@
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, newy1);
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, newy2);
         TestLog.waitForLogContaining("Zoom, factor: " + factor2
-                + ", total factor: " + (factor1 * factor2));
+                + ", total factor: " + (factor1 * factor2)
+                + ", inertia value: false");
 
         TestLog.reset();
         y1 = y1 + step;
@@ -294,7 +297,8 @@
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, newy1);
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, newy2);
         TestLog.waitForLogContaining("Zoom, factor: " + factor3
-                + ", total factor: " + (factor1 * factor2 * factor3));
+                + ", total factor: " + (factor1 * factor2 * factor3)
+                + ", inertia value: false");
 
         //release first finger
         TestLog.reset();
@@ -305,7 +309,8 @@
         TestLog.waitForLogContaining("TouchPoint: STATIONARY %d, %d",
                 x2, newy2);
         TestLog.waitForLogContaining("Zoom finished, factor: " + factor0
-                + ", total factor: " + (factor1 * factor2 * factor3));
+                + ", total factor: " + (factor1 * factor2 * factor3)
+                + ", inertia value: false");
 
         //release second finger
         TestLog.reset();
@@ -316,6 +321,7 @@
                 x2, newy2);
         TestLog.waitForLog("Mouse released: %d, %d", x2, newy2);
         TestLog.waitForLog("Mouse clicked: %d, %d", x2, newy2);
+        TestLog.waitForLogContaining("Zoom", "inertia value: true");
         Assert.assertEquals(1, TestLog.countLogContaining("Mouse clicked: "
                 + x2 +", " + newy2));
     }
@@ -377,10 +383,9 @@
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, newy1);
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, newy2);
         TestLog.waitForLogContaining("Zoom started, factor: " + factor0
-                + ", total factor: " + factor0);
+                + ", total factor: " + factor0 + ", inertia value: false");
         TestLog.waitForLogContaining("Zoom, factor: " + factor1
-                + ", total factor: " + factor1);
-
+                + ", total factor: " + factor1 + ", inertia value: false");
         TestLog.reset();
         y1 = y1 + step;
         y2 = y2 - step;
@@ -394,7 +399,8 @@
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, newy1);
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, newy2);
         TestLog.waitForLogContaining("Zoom, factor: " + factor2
-                + ", total factor: " + (factor1 * factor2));
+                + ", total factor: " + (factor1 * factor2)
+                + ", inertia value: false");
 
         TestLog.reset();
         y1 = y1 + step;
@@ -409,7 +415,8 @@
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, newy1);
         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, newy2);
         TestLog.waitForLogContaining("Zoom, factor: " + factor3
-                + ", total factor: " + (factor1 * factor2 * factor3));
+                + ", total factor: " + (factor1 * factor2 * factor3)
+                + ", inertia value: false");
 
         //release first finger
         TestLog.reset();
@@ -420,7 +427,8 @@
         TestLog.waitForLogContaining("TouchPoint: STATIONARY %d, %d",
                 x2, newy2);
         TestLog.waitForLogContaining("Zoom finished, factor: " + factor0
-                + ", total factor: " + (factor1 * factor2 * factor3));
+                + ", total factor: " + (factor1 * factor2 * factor3)
+                + ", inertia value: false");
 
         //release second finger
         TestLog.reset();
@@ -431,8 +439,8 @@
                 x2, newy2);
         TestLog.waitForLog("Mouse released: %d, %d", x2, newy2);
         TestLog.waitForLog("Mouse clicked: %d, %d", x2, newy2);
+        TestLog.waitForLogContaining("Zoom", "inertia value: true");
         Assert.assertEquals(1, TestLog.countLogContaining("Mouse clicked: "
                 + x2 +", " + newy2));
     }
-
-}
+}
\ No newline at end of file