< prev index next >

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

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

*** 23,33 **** * questions. */ package test.robot.com.sun.glass.ui.monocle; ! import com.sun.glass.ui.monocle.TestLog; 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.input.GestureEvent; import org.junit.*; --- 23,33 ---- * questions. */ package test.robot.com.sun.glass.ui.monocle; ! 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.input.GestureEvent; import org.junit.*;
*** 66,76 **** @Before public void addListener() throws Exception { TestApplication.getStage().getScene().addEventHandler( GestureEvent.ANY, ! e -> TestLog.format("%s at %.0f, %.0f", e.getEventType(), e.getScreenX(), e.getScreenY())); startPointX = (int) Math.round(width * 0.5); startPointY = (int) Math.round(height * 0.5); --- 66,76 ---- @Before public void addListener() throws Exception { TestApplication.getStage().getScene().addEventHandler( GestureEvent.ANY, ! e -> TestLogShim.format("%s at %.0f, %.0f", e.getEventType(), e.getScreenX(), e.getScreenY())); startPointX = (int) Math.round(width * 0.5); startPointY = (int) Math.round(height * 0.5);
*** 78,105 **** private void swipe(Point[] points, String expectedSwipe) throws Exception { Assert.assertTrue(points.length > 1); int x = points[0].getX(); int y = points[0].getY(); ! TestLog.reset(); int p1 = device.addPoint(x, y); device.sync(); for (int i = 1; i < points.length; i++) { device.setPoint(p1, points[i].getX(), points[i].getY()); device.sync(); } device.removePoint(p1); device.sync(); int finalX = points[points.length - 1].getX(); int finalY = points[points.length - 1].getY(); ! TestLog.waitForLogContaining("Touch released: %d, %d", finalX, finalY); ! TestLog.waitForLogContaining("Mouse released: %d, %d", finalX, finalY); ! TestLog.waitForLogContaining("Mouse clicked: %d, %d", finalX, finalY); if (expectedSwipe != null) { ! TestLog.waitForLogContaining(expectedSwipe); } else { ! Assert.assertEquals(0, TestLog.countLogContaining("SWIPE")); } } @Test public void testSwipeRight1() throws Exception { --- 78,105 ---- private void swipe(Point[] points, String expectedSwipe) throws Exception { Assert.assertTrue(points.length > 1); int x = points[0].getX(); int y = points[0].getY(); ! TestLogShim.reset(); int p1 = device.addPoint(x, y); device.sync(); for (int i = 1; i < points.length; i++) { device.setPoint(p1, points[i].getX(), points[i].getY()); device.sync(); } device.removePoint(p1); device.sync(); int finalX = points[points.length - 1].getX(); int finalY = points[points.length - 1].getY(); ! TestLogShim.waitForLogContaining("Touch released: %d, %d", finalX, finalY); ! TestLogShim.waitForLogContaining("Mouse released: %d, %d", finalX, finalY); ! TestLogShim.waitForLogContaining("Mouse clicked: %d, %d", finalX, finalY); if (expectedSwipe != null) { ! TestLogShim.waitForLogContaining(expectedSwipe); } else { ! Assert.assertEquals(0, TestLogShim.countLogContaining("SWIPE")); } } @Test public void testSwipeRight1() throws Exception {
< prev index next >