< prev index next >

tests/system/src/test/java/test/robot/com/sun/glass/ui/monocle/CreateDeviceTest.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 javafx.geometry.Rectangle2D; import javafx.stage.Screen; import org.junit.After; import org.junit.Assert; --- 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 javafx.geometry.Rectangle2D; import javafx.stage.Screen; import org.junit.After; import org.junit.Assert;
*** 37,47 **** public class CreateDeviceTest { private UInput ui; @Before public void initDevice() { ! TestLog.reset(); ui = new UInput(); } @After public void destroyDevice() throws InterruptedException { ui.waitForQuiet(); --- 37,47 ---- public class CreateDeviceTest { private UInput ui; @Before public void initDevice() { ! TestLogShim.reset(); ui = new UInput(); } @After public void destroyDevice() throws InterruptedException { ui.waitForQuiet();
*** 65,94 **** ui.processLine("CREATE"); ui.processLine("EV_KEY KEY_LEFTSHIFT 1"); ui.processLine("EV_SYN"); ui.processLine("EV_KEY KEY_LEFTSHIFT 0"); ui.processLine("EV_SYN"); ! TestLog.waitForLog("Key pressed: SHIFT", 3000); ! TestLog.clear(); ui.processLine("EV_KEY KEY_A 1"); ui.processLine("EV_SYN"); ui.processLine("EV_KEY KEY_A 0"); ui.processLine("EV_SYN"); ! TestLog.waitForLog("Key typed: a", 3000); ui.processLine("EV_KEY KEY_LEFTSHIFT 1"); ui.processLine("EV_SYN"); ui.processLine("EV_KEY KEY_A 1"); ui.processLine("EV_SYN"); ui.processLine("EV_KEY KEY_A 0"); ui.processLine("EV_SYN"); ui.processLine("EV_KEY KEY_LEFTSHIFT 0"); ui.processLine("EV_SYN"); ! TestLog.waitForLog("Key typed: A", 3000); // make sure only two key typed events were received Assert.assertEquals("Expected two typed events", 2, ! TestLog.getLog().stream().filter(s -> s.startsWith("Key typed")).count()); } @Test public void testCreateMouseDevice() throws Exception { TestApplication.showFullScreenScene(); --- 65,94 ---- ui.processLine("CREATE"); ui.processLine("EV_KEY KEY_LEFTSHIFT 1"); ui.processLine("EV_SYN"); ui.processLine("EV_KEY KEY_LEFTSHIFT 0"); ui.processLine("EV_SYN"); ! TestLogShim.waitForLog("Key pressed: SHIFT", 3000); ! TestLogShim.clear(); ui.processLine("EV_KEY KEY_A 1"); ui.processLine("EV_SYN"); ui.processLine("EV_KEY KEY_A 0"); ui.processLine("EV_SYN"); ! TestLogShim.waitForLog("Key typed: a", 3000); ui.processLine("EV_KEY KEY_LEFTSHIFT 1"); ui.processLine("EV_SYN"); ui.processLine("EV_KEY KEY_A 1"); ui.processLine("EV_SYN"); ui.processLine("EV_KEY KEY_A 0"); ui.processLine("EV_SYN"); ui.processLine("EV_KEY KEY_LEFTSHIFT 0"); ui.processLine("EV_SYN"); ! TestLogShim.waitForLog("Key typed: A", 3000); // make sure only two key typed events were received Assert.assertEquals("Expected two typed events", 2, ! TestLogShim.getLog().stream().filter(s -> s.startsWith("Key typed")).count()); } @Test public void testCreateMouseDevice() throws Exception { TestApplication.showFullScreenScene();
*** 101,120 **** ui.processLine("EVBIT EV_REL"); ui.processLine("RELBIT REL_X"); ui.processLine("RELBIT REL_Y"); ui.processLine("PROPERTY ID_INPUT_MOUSE 1"); ui.processLine("CREATE"); ! TestLog.clear(); ui.processLine("EV_KEY BTN_LEFT 1"); ui.processLine("EV_SYN"); ui.processLine("EV_KEY BTN_LEFT 0"); ui.processLine("EV_SYN"); ! TestLog.waitForLog("Mouse pressed: 300, 300", 3000); ui.processLine("EV_REL REL_X -10"); ui.processLine("EV_REL REL_Y -5"); ui.processLine("EV_SYN"); ! TestLog.waitForLog("Mouse moved: 290, 295", 3000); } @Test public void testCreateTouchDevice() throws Exception { TestApplication.showFullScreenScene(); --- 101,120 ---- ui.processLine("EVBIT EV_REL"); ui.processLine("RELBIT REL_X"); ui.processLine("RELBIT REL_Y"); ui.processLine("PROPERTY ID_INPUT_MOUSE 1"); ui.processLine("CREATE"); ! TestLogShim.clear(); ui.processLine("EV_KEY BTN_LEFT 1"); ui.processLine("EV_SYN"); ui.processLine("EV_KEY BTN_LEFT 0"); ui.processLine("EV_SYN"); ! TestLogShim.waitForLog("Mouse pressed: 300, 300", 3000); ui.processLine("EV_REL REL_X -10"); ui.processLine("EV_REL REL_Y -5"); ui.processLine("EV_SYN"); ! TestLogShim.waitForLog("Mouse moved: 290, 295", 3000); } @Test public void testCreateTouchDevice() throws Exception { TestApplication.showFullScreenScene();
*** 141,150 **** ui.processLine("EV_KEY BTN_TOUCH 0"); ui.processLine("EV_ABS ABS_X 2048"); ui.processLine("EV_ABS ABS_Y 2048"); ui.processLine("EV_SYN"); Rectangle2D r = Screen.getPrimary().getBounds(); ! TestLog.waitForLog("Mouse pressed: " + (int) r.getWidth() / 2 + ", " + (int) r.getHeight() / 2 , 3000); } } --- 141,150 ---- ui.processLine("EV_KEY BTN_TOUCH 0"); ui.processLine("EV_ABS ABS_X 2048"); ui.processLine("EV_ABS ABS_Y 2048"); ui.processLine("EV_SYN"); Rectangle2D r = Screen.getPrimary().getBounds(); ! TestLogShim.waitForLog("Mouse pressed: " + (int) r.getWidth() / 2 + ", " + (int) r.getHeight() / 2 , 3000); } }
< prev index next >