< prev index next >

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

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


   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package test.robot.com.sun.glass.ui.monocle;
  27 
  28 import com.sun.glass.ui.monocle.TestLog;
  29 import test.robot.com.sun.glass.ui.monocle.ParameterizedTestBase;
  30 import test.robot.com.sun.glass.ui.monocle.input.devices.TestTouchDevice;
  31 import test.robot.com.sun.glass.ui.monocle.input.devices.TestTouchDevices;
  32 import org.junit.Test;
  33 import org.junit.runners.Parameterized;
  34 
  35 import java.util.Collection;
  36 
  37 /** Multitouch tests with three points */
  38 public class MultiTouch3Test extends ParameterizedTestBase {
  39 
  40     public MultiTouch3Test(TestTouchDevice device) {
  41         super(device);
  42     }
  43 
  44     @Parameterized.Parameters
  45     public static Collection<Object[]> data() {
  46         return TestTouchDevices.getTouchDeviceParameters(3);
  47     }
  48 


  50 //    @Ignore("RT-35546")
  51     /** This test follows the sequence described in touch event documentation:
  52      * 1. Touch the screen with two fingers
  53      * 2. Move both fingers
  54      * 3. Touch the screen with a third finger
  55      * 4. Move all fingers
  56      * 5. Remove all fingers
  57      */
  58     public void touchSequence() throws Exception {
  59         final int x1 = (int) Math.round(width * 0.5f);
  60         final int y1 = (int) Math.round(height * 0.5f);
  61         final int x2 = (int) Math.round(width * 0.75f);
  62         final int y2 = (int) Math.round(height * 0.75f);
  63         final int x3 = (int) Math.round(width * 0.25f);
  64         final int y3 = (int) Math.round(height * 0.25f);
  65         final int dx = device.getTapRadius();
  66         final int dy = device.getTapRadius();
  67         // first finger
  68         int p1 = device.addPoint(x1, y1);
  69         device.sync();
  70         TestLog.waitForLogContaining("TouchPoint: PRESSED %d, %d", x1, y1);
  71         // add a second finger
  72         int p2 = device.addPoint(x2, y2);
  73         device.sync();
  74         TestLog.waitForLogContaining("TouchPoint: STATIONARY %d, %d", x1, y1);
  75         TestLog.waitForLogContaining("TouchPoint: PRESSED %d, %d", x2, y2);
  76         // drag both fingers
  77         for (int i = 1; i < 10; i++) {
  78             TestLog.reset();
  79             device.setPoint(p1, x1 + dx * i, y1 + dy * i);
  80             device.setPoint(p2, x2 + dx * i, y2 + dy * i);
  81             device.sync();
  82             TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d",
  83                                          x1 + dx * i, y1 + dy * i);
  84             TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d",
  85                                          x2 + dx * i, y2 + dy * i);
  86         }
  87         for (int i = 8; i >= 0; i--) {
  88             TestLog.reset();
  89             device.setPoint(p1, x1 + dx * i, y1 + dy * i);
  90             device.setPoint(p2, x2 + dx * i, y2 + dy * i);
  91             device.sync();
  92             TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d",
  93                                          x1 + dx * i, y1 + dy * i);
  94             TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d",
  95                                          x2 + dx * i, y2 + dy * i);
  96         }
  97         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, y1);
  98         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, y2);
  99         // add a third finger
 100         int p3 = device.addPoint(x3, y3);
 101         device.sync();
 102         TestLog.waitForLogContaining("TouchPoint: STATIONARY %d, %d", x1, y1);
 103         TestLog.waitForLogContaining("TouchPoint: STATIONARY %d, %d", x2, y2);
 104         TestLog.waitForLogContaining("TouchPoint: PRESSED %d, %d", x3, y3);
 105 
 106         // drag three fingers
 107         for (int i = 1; i < 10; i++) {
 108             TestLog.reset();
 109             device.setPoint(p1, x1 + dx * i, y1 + dy * i);
 110             device.setPoint(p2, x2 + dx * i, y2 + dy * i);
 111             device.setPoint(p3, x3 + dx * i, y3 + dy * i);
 112             device.sync();
 113             TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d",
 114                                          x1 + dx * i, y1 + dy * i);
 115             TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d",
 116                                          x2 + dx * i, y2 + dy * i);
 117             TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d",
 118                                          x3 + dx * i, y3 + dy * i);
 119         }
 120         for (int i = 8; i >= 0; i--) {
 121             TestLog.reset();
 122             device.setPoint(p1, x1 + dx * i, y1 + dy * i);
 123             device.setPoint(p2, x2 + dx * i, y2 + dy * i);
 124             device.setPoint(p3, x3 + dx * i, y3 + dy * i);
 125             device.sync();
 126             TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d",
 127                                          x1 + dx * i, y1 + dy * i);
 128             TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d",
 129                                          x2 + dx * i, y2 + dy * i);
 130             TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d",
 131                                          x3 + dx * i, y3 + dy * i);
 132         }
 133         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, y1);
 134         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, y2);
 135         TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", x3, y3);
 136 
 137         //release first finger
 138         TestLog.reset();
 139         device.removePoint(p1);
 140         device.sync();
 141         TestLog.waitForLogContaining("Touch released: %d, %d", x1, y1);
 142         TestLog.waitForLogContaining("TouchPoint: RELEASED %d, %d", x1, y1);
 143         TestLog.waitForLogContaining("TouchPoint: STATIONARY %d, %d", x2, y2);
 144         TestLog.waitForLogContaining("TouchPoint: STATIONARY %d, %d", x3, y3);
 145         //release second finger
 146         TestLog.reset();
 147         device.removePoint(p2);
 148         device.sync();
 149         TestLog.waitForLogContaining("Touch released: %d, %d", x2, y2);
 150         TestLog.waitForLogContaining("TouchPoint: RELEASED %d, %d", x2, y2);
 151         TestLog.waitForLogContaining("TouchPoint: STATIONARY %d, %d", x3, y3);
 152         //release third finger
 153         device.removePoint(p3);
 154         device.sync();
 155         TestLog.waitForLog("Touch released: %d, %d", x3, y3);
 156         TestLog.waitForLogContaining("TouchPoint: RELEASED %d, %d", x3, y3);
 157     }
 158 
 159 }


   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package test.robot.com.sun.glass.ui.monocle;
  27 
  28 import com.sun.glass.ui.monocle.TestLogShim;
  29 import test.robot.com.sun.glass.ui.monocle.ParameterizedTestBase;
  30 import test.robot.com.sun.glass.ui.monocle.input.devices.TestTouchDevice;
  31 import test.robot.com.sun.glass.ui.monocle.input.devices.TestTouchDevices;
  32 import org.junit.Test;
  33 import org.junit.runners.Parameterized;
  34 
  35 import java.util.Collection;
  36 
  37 /** Multitouch tests with three points */
  38 public class MultiTouch3Test extends ParameterizedTestBase {
  39 
  40     public MultiTouch3Test(TestTouchDevice device) {
  41         super(device);
  42     }
  43 
  44     @Parameterized.Parameters
  45     public static Collection<Object[]> data() {
  46         return TestTouchDevices.getTouchDeviceParameters(3);
  47     }
  48 


  50 //    @Ignore("RT-35546")
  51     /** This test follows the sequence described in touch event documentation:
  52      * 1. Touch the screen with two fingers
  53      * 2. Move both fingers
  54      * 3. Touch the screen with a third finger
  55      * 4. Move all fingers
  56      * 5. Remove all fingers
  57      */
  58     public void touchSequence() throws Exception {
  59         final int x1 = (int) Math.round(width * 0.5f);
  60         final int y1 = (int) Math.round(height * 0.5f);
  61         final int x2 = (int) Math.round(width * 0.75f);
  62         final int y2 = (int) Math.round(height * 0.75f);
  63         final int x3 = (int) Math.round(width * 0.25f);
  64         final int y3 = (int) Math.round(height * 0.25f);
  65         final int dx = device.getTapRadius();
  66         final int dy = device.getTapRadius();
  67         // first finger
  68         int p1 = device.addPoint(x1, y1);
  69         device.sync();
  70         TestLogShim.waitForLogContaining("TouchPoint: PRESSED %d, %d", x1, y1);
  71         // add a second finger
  72         int p2 = device.addPoint(x2, y2);
  73         device.sync();
  74         TestLogShim.waitForLogContaining("TouchPoint: STATIONARY %d, %d", x1, y1);
  75         TestLogShim.waitForLogContaining("TouchPoint: PRESSED %d, %d", x2, y2);
  76         // drag both fingers
  77         for (int i = 1; i < 10; i++) {
  78             TestLogShim.reset();
  79             device.setPoint(p1, x1 + dx * i, y1 + dy * i);
  80             device.setPoint(p2, x2 + dx * i, y2 + dy * i);
  81             device.sync();
  82             TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d",
  83                                          x1 + dx * i, y1 + dy * i);
  84             TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d",
  85                                          x2 + dx * i, y2 + dy * i);
  86         }
  87         for (int i = 8; i >= 0; i--) {
  88             TestLogShim.reset();
  89             device.setPoint(p1, x1 + dx * i, y1 + dy * i);
  90             device.setPoint(p2, x2 + dx * i, y2 + dy * i);
  91             device.sync();
  92             TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d",
  93                                          x1 + dx * i, y1 + dy * i);
  94             TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d",
  95                                          x2 + dx * i, y2 + dy * i);
  96         }
  97         TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, y1);
  98         TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, y2);
  99         // add a third finger
 100         int p3 = device.addPoint(x3, y3);
 101         device.sync();
 102         TestLogShim.waitForLogContaining("TouchPoint: STATIONARY %d, %d", x1, y1);
 103         TestLogShim.waitForLogContaining("TouchPoint: STATIONARY %d, %d", x2, y2);
 104         TestLogShim.waitForLogContaining("TouchPoint: PRESSED %d, %d", x3, y3);
 105 
 106         // drag three fingers
 107         for (int i = 1; i < 10; i++) {
 108             TestLogShim.reset();
 109             device.setPoint(p1, x1 + dx * i, y1 + dy * i);
 110             device.setPoint(p2, x2 + dx * i, y2 + dy * i);
 111             device.setPoint(p3, x3 + dx * i, y3 + dy * i);
 112             device.sync();
 113             TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d",
 114                                          x1 + dx * i, y1 + dy * i);
 115             TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d",
 116                                          x2 + dx * i, y2 + dy * i);
 117             TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d",
 118                                          x3 + dx * i, y3 + dy * i);
 119         }
 120         for (int i = 8; i >= 0; i--) {
 121             TestLogShim.reset();
 122             device.setPoint(p1, x1 + dx * i, y1 + dy * i);
 123             device.setPoint(p2, x2 + dx * i, y2 + dy * i);
 124             device.setPoint(p3, x3 + dx * i, y3 + dy * i);
 125             device.sync();
 126             TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d",
 127                                          x1 + dx * i, y1 + dy * i);
 128             TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d",
 129                                          x2 + dx * i, y2 + dy * i);
 130             TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d",
 131                                          x3 + dx * i, y3 + dy * i);
 132         }
 133         TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d", x1, y1);
 134         TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d", x2, y2);
 135         TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d", x3, y3);
 136 
 137         //release first finger
 138         TestLogShim.reset();
 139         device.removePoint(p1);
 140         device.sync();
 141         TestLogShim.waitForLogContaining("Touch released: %d, %d", x1, y1);
 142         TestLogShim.waitForLogContaining("TouchPoint: RELEASED %d, %d", x1, y1);
 143         TestLogShim.waitForLogContaining("TouchPoint: STATIONARY %d, %d", x2, y2);
 144         TestLogShim.waitForLogContaining("TouchPoint: STATIONARY %d, %d", x3, y3);
 145         //release second finger
 146         TestLogShim.reset();
 147         device.removePoint(p2);
 148         device.sync();
 149         TestLogShim.waitForLogContaining("Touch released: %d, %d", x2, y2);
 150         TestLogShim.waitForLogContaining("TouchPoint: RELEASED %d, %d", x2, y2);
 151         TestLogShim.waitForLogContaining("TouchPoint: STATIONARY %d, %d", x3, y3);
 152         //release third finger
 153         device.removePoint(p3);
 154         device.sync();
 155         TestLogShim.waitForLog("Touch released: %d, %d", x3, y3);
 156         TestLogShim.waitForLogContaining("TouchPoint: RELEASED %d, %d", x3, y3);
 157     }
 158 
 159 }
< prev index next >