< prev index next >

tests/system/src/test/java/test/robot/com/sun/glass/ui/monocle/TouchButtonTest.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.geometry.BoundingBox; import javafx.geometry.Bounds; --- 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.geometry.BoundingBox; import javafx.geometry.Bounds;
*** 65,79 **** button.setLayoutX(x); button.setLayoutY(y); button.setOnMousePressed((e) -> button.requestFocus()); if (setListeners) { button.addEventHandler(MouseEvent.ANY, e -> ! TestLog.log(e.getEventType().getName() +": " + (int) e.getScreenX() + ", " + (int) e.getScreenY())); button.focusedProperty().addListener((observable, oldValue, newValue) -> ! TestLog.log(button.getId() + " isFocused=" + newValue)); } return button; } --- 65,79 ---- button.setLayoutX(x); button.setLayoutY(y); button.setOnMousePressed((e) -> button.requestFocus()); if (setListeners) { button.addEventHandler(MouseEvent.ANY, e -> ! TestLogShim.log(e.getEventType().getName() +": " + (int) e.getScreenX() + ", " + (int) e.getScreenY())); button.focusedProperty().addListener((observable, oldValue, newValue) -> ! TestLogShim.log(button.getId() + " isFocused=" + newValue)); } return button; }
*** 123,142 **** } @Test public void tapOutAndInButton() throws Exception { tapOutSideButton(); ! TestLog.reset(); Point2D clickAt = tapInsideButton(button1); waitForMouseClickAt(clickAt); waitForFocusGainOn("button1"); } @Test public void tapOutInAndOutButton() throws Exception { tapOutSideButton(); ! TestLog.reset(); Point2D clickAt = tapInsideButton(button1); waitForMouseClickAt(clickAt); waitForFocusGainOn("button1"); tapOutSideButton(); --- 123,142 ---- } @Test public void tapOutAndInButton() throws Exception { tapOutSideButton(); ! TestLogShim.reset(); Point2D clickAt = tapInsideButton(button1); waitForMouseClickAt(clickAt); waitForFocusGainOn("button1"); } @Test public void tapOutInAndOutButton() throws Exception { tapOutSideButton(); ! TestLogShim.reset(); Point2D clickAt = tapInsideButton(button1); waitForMouseClickAt(clickAt); waitForFocusGainOn("button1"); tapOutSideButton();
*** 145,175 **** } @Test public void tapInAndOutLoop() throws Exception { tapOutSideButton(); ! TestLog.reset(); for (int i = 0 ; i < 2 ; i++) { tapOutSideButton(); tapInsideButton(button3); ! TestLog.reset(); Point2D clickAt = tapInsideButton(button1); waitForFocusGainOn("button1"); waitForMouseEnteredAt(clickAt); waitForMouseClickAt(clickAt); tapOutSideButton(); tapInsideButton(button3); waitForFocusLostOn("button1"); ! TestLog.reset(); clickAt = tapInsideButton(button2); waitForFocusGainOn("button2"); waitForMouseEnteredAt(clickAt); waitForMouseClickAt(clickAt); ! TestLog.reset(); tapOutSideButton(); tapInsideButton(button3); waitForFocusLostOn("button2"); } } --- 145,175 ---- } @Test public void tapInAndOutLoop() throws Exception { tapOutSideButton(); ! TestLogShim.reset(); for (int i = 0 ; i < 2 ; i++) { tapOutSideButton(); tapInsideButton(button3); ! TestLogShim.reset(); Point2D clickAt = tapInsideButton(button1); waitForFocusGainOn("button1"); waitForMouseEnteredAt(clickAt); waitForMouseClickAt(clickAt); tapOutSideButton(); tapInsideButton(button3); waitForFocusLostOn("button1"); ! TestLogShim.reset(); clickAt = tapInsideButton(button2); waitForFocusGainOn("button2"); waitForMouseEnteredAt(clickAt); waitForMouseClickAt(clickAt); ! TestLogShim.reset(); tapOutSideButton(); tapInsideButton(button3); waitForFocusLostOn("button2"); } }
*** 199,210 **** } //release inside the button device.removePoint(p); device.sync(); ! TestLog.waitForLogContaining("MOUSE_CLICKED:", 3000l); ! TestLog.waitForLogContaining("MOUSE_RELEASED:", 3000l); } /** * RT-34625 - Currently a control will not generate a click when tapping on * it, drag the finger outside the control and release the finger. --- 199,210 ---- } //release inside the button device.removePoint(p); device.sync(); ! TestLogShim.waitForLogContaining("MOUSE_CLICKED:", 3000l); ! TestLogShim.waitForLogContaining("MOUSE_RELEASED:", 3000l); } /** * RT-34625 - Currently a control will not generate a click when tapping on * it, drag the finger outside the control and release the finger.
*** 237,247 **** } //release outside the button device.removePoint(p); device.sync(); ! TestLog.waitForLogContaining("MOUSE_CLICKED:", 3000l); } @Test public void tapping_oneButtonOnScreen () throws Exception { AtomicReference<Node> buttonRef = new AtomicReference<>(); --- 237,247 ---- } //release outside the button device.removePoint(p); device.sync(); ! TestLogShim.waitForLogContaining("MOUSE_CLICKED:", 3000l); } @Test public void tapping_oneButtonOnScreen () throws Exception { AtomicReference<Node> buttonRef = new AtomicReference<>();
*** 254,264 **** TestApplication.waitForLayout(); for (int i = 0; i < 5; i++) { Point2D clickAt = tapInsideButton(buttonRef.get()); waitForMouseClickAt(clickAt); ! TestLog.reset(); } } /** utilities */ public Bounds getButtonBounds(Node button) throws Exception { --- 254,264 ---- TestApplication.waitForLayout(); for (int i = 0; i < 5; i++) { Point2D clickAt = tapInsideButton(buttonRef.get()); waitForMouseClickAt(clickAt); ! TestLogShim.reset(); } } /** utilities */ public Bounds getButtonBounds(Node button) throws Exception {
*** 266,276 **** TestRunnable.invokeAndWait(() -> { ref.set(button.localToScreen( new BoundingBox(0, 0, button.getBoundsInParent().getWidth(), button.getBoundsInParent().getHeight()))); ! TestLog.log("Bounds for " + button.getId() + " are " + ref.get()); }); return ref.get(); } public Point2D getCenterOfButton(Node button) throws Exception { --- 266,276 ---- TestRunnable.invokeAndWait(() -> { ref.set(button.localToScreen( new BoundingBox(0, 0, button.getBoundsInParent().getWidth(), button.getBoundsInParent().getHeight()))); ! TestLogShim.log("Bounds for " + button.getId() + " are " + ref.get()); }); return ref.get(); } public Point2D getCenterOfButton(Node button) throws Exception {
*** 287,297 **** int p = device.addPoint(clickAt.getX(), clickAt.getY()); device.sync(); //release device.removePoint(p); device.sync(); ! TestLog.waitForLog("Mouse clicked: %.0f, %.0f", clickAt.getX(), clickAt.getY()); return clickAt; } public void tapOutSideButton() throws Exception { Bounds buttonBounds = getButtonBounds(button3); --- 287,297 ---- int p = device.addPoint(clickAt.getX(), clickAt.getY()); device.sync(); //release device.removePoint(p); device.sync(); ! TestLogShim.waitForLog("Mouse clicked: %.0f, %.0f", clickAt.getX(), clickAt.getY()); return clickAt; } public void tapOutSideButton() throws Exception { Bounds buttonBounds = getButtonBounds(button3);
*** 301,327 **** int p = device.addPoint(x, y); device.sync(); //release device.removePoint(p); device.sync(); ! TestLog.waitForLog("Mouse clicked: %.0f, %.0f", x, y); } public void waitForMouseClickAt(Point2D clickAt) throws Exception{ ! TestLog.waitForLog("MOUSE_CLICKED: %d, %d", Math.round(clickAt.getX()), Math.round(clickAt.getY())); } public void waitForMouseEnteredAt(Point2D clickAt) throws Exception{ ! TestLog.waitForLog("MOUSE_ENTERED: %d, %d", Math.round(clickAt.getX()), Math.round(clickAt.getY())); } public void waitForFocus(String id, boolean focusState) throws Exception { ! TestLog.waitForLog("%s isFocused=%b", id, focusState); } public void waitForFocusGainOn(String id) throws Exception{ waitForFocus(id, true); } --- 301,327 ---- int p = device.addPoint(x, y); device.sync(); //release device.removePoint(p); device.sync(); ! TestLogShim.waitForLog("Mouse clicked: %.0f, %.0f", x, y); } public void waitForMouseClickAt(Point2D clickAt) throws Exception{ ! TestLogShim.waitForLog("MOUSE_CLICKED: %d, %d", Math.round(clickAt.getX()), Math.round(clickAt.getY())); } public void waitForMouseEnteredAt(Point2D clickAt) throws Exception{ ! TestLogShim.waitForLog("MOUSE_ENTERED: %d, %d", Math.round(clickAt.getX()), Math.round(clickAt.getY())); } public void waitForFocus(String id, boolean focusState) throws Exception { ! TestLogShim.waitForLog("%s isFocused=%b", id, focusState); } public void waitForFocusGainOn(String id) throws Exception{ waitForFocus(id, true); }
< prev index next >