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.TestApplication;
30 import com.sun.glass.ui.monocle.TouchFilterShim.FlushingFilter;
31 import com.sun.glass.ui.monocle.TouchFilterShim.LoggingFilter;
32 import com.sun.glass.ui.monocle.TouchFilterShim.NoMultiplesOfTenOnXFilter;
33 import com.sun.glass.ui.monocle.TouchFilterShim.OverrideIDFilter;
34 import com.sun.glass.ui.monocle.TouchFilterShim.TranslateFilter;
35 import javafx.geometry.Rectangle2D;
36 import javafx.stage.Screen;
37 import org.junit.Assert;
38 import org.junit.Assume;
39 import org.junit.Before;
40 import org.junit.Test;
41
42 /**
43 * Test installation of custom touch filters
44 */
45 public class TouchPipelineTest extends TouchTestBase {
46
47 @Before
48 public void createDevice() throws Exception {
49 Assume.assumeTrue(TestApplication.isMonocle());
50 ui = new UInput();
51 TestApplication.showFullScreenScene();
52 TestApplication.addMouseListeners();
53 TestApplication.addTouchListeners();
54 TestLog.reset();
55 System.setProperty("monocle.input.ca/fe/ba/be.touchFilters",
56 TranslateFilter.class.getName() + ","
57 + OverrideIDFilter.class.getName() + ","
58 + FlushingFilter.class.getName() + ","
59 + LoggingFilter.class.getName() + ","
60 + NoMultiplesOfTenOnXFilter.class.getName());
61 Rectangle2D r = Screen.getPrimary().getBounds();
62 ui.processLine("OPEN");
63 ui.processLine("EVBIT EV_SYN");
64 ui.processLine("EVBIT EV_KEY");
65 ui.processLine("KEYBIT BTN_TOUCH");
66 ui.processLine("EVBIT EV_ABS");
67 ui.processLine("ABSBIT ABS_X");
68 ui.processLine("ABSBIT ABS_Y");
69 ui.processLine("ABSMIN ABS_X 0");
70 ui.processLine("ABSMAX ABS_X " + (int) (r.getWidth() - 1));
71 ui.processLine("ABSMIN ABS_Y 0");
72 ui.processLine("ABSMAX ABS_Y " + (int) (r.getHeight() - 1));
73 ui.processLine("PROPBIT INPUT_PROP_POINTER");
74 ui.processLine("PROPBIT INPUT_PROP_DIRECT");
75 ui.processLine("PROPERTY ID_INPUT_TOUCHSCREEN 1");
76 ui.processLine("BUS 0xCA");
77 ui.processLine("VENDOR 0xFE");
78 ui.processLine("PRODUCT 0xBA");
79 ui.processLine("VERSION 0xBE");
80 ui.processLine("CREATE");
81 }
82
83
84 @Test
85 public void testFilters() throws Exception {
86 ui.processLine("EV_KEY BTN_TOUCH 1");
87 ui.processLine("EV_ABS ABS_X 195");
88 ui.processLine("EV_ABS ABS_Y 200");
89 ui.processLine("EV_SYN");
90 ui.processLine("EV_ABS ABS_X 200");
91 ui.processLine("EV_ABS ABS_Y 200");
92 ui.processLine("EV_SYN");
93 TestLog.waitForLog("Touch pressed: 203, 195");
94 TestLog.waitForLog("Touch point id=5 at 203,195");
95 // Check for events send by the flushing filter
96 TestLog.waitForLog("Touch moved: 413, 95");
97 TestLog.waitForLog("Touch moved: 313, 95");
98 TestLog.waitForLog("Touch moved: 213, 95");
99 // This one should have been filtered out
100 Assert.assertEquals(0, TestLog.countLog("Touch Pressed: 208, 195"));
101 ui.processLine("EV_KEY BTN_TOUCH 0");
102 ui.processLine("EV_SYN");
103 TestLog.waitForLog("Touch released: 213, 95");
104 }
105
106 }
107
|
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.TestApplication;
30 import com.sun.glass.ui.monocle.TouchFilterShim.FlushingFilter;
31 import com.sun.glass.ui.monocle.TouchFilterShim.LoggingFilter;
32 import com.sun.glass.ui.monocle.TouchFilterShim.NoMultiplesOfTenOnXFilter;
33 import com.sun.glass.ui.monocle.TouchFilterShim.OverrideIDFilter;
34 import com.sun.glass.ui.monocle.TouchFilterShim.TranslateFilter;
35 import javafx.geometry.Rectangle2D;
36 import javafx.stage.Screen;
37 import org.junit.Assert;
38 import org.junit.Assume;
39 import org.junit.Before;
40 import org.junit.Test;
41
42 /**
43 * Test installation of custom touch filters
44 */
45 public class TouchPipelineTest extends TouchTestBase {
46
47 @Before
48 public void createDevice() throws Exception {
49 Assume.assumeTrue(TestApplication.isMonocle());
50 ui = new UInput();
51 TestApplication.showFullScreenScene();
52 TestApplication.addMouseListeners();
53 TestApplication.addTouchListeners();
54 TestLogShim.reset();
55 System.setProperty("monocle.input.ca/fe/ba/be.touchFilters",
56 TranslateFilter.class.getName() + ","
57 + OverrideIDFilter.class.getName() + ","
58 + FlushingFilter.class.getName() + ","
59 + LoggingFilter.class.getName() + ","
60 + NoMultiplesOfTenOnXFilter.class.getName());
61 Rectangle2D r = Screen.getPrimary().getBounds();
62 ui.processLine("OPEN");
63 ui.processLine("EVBIT EV_SYN");
64 ui.processLine("EVBIT EV_KEY");
65 ui.processLine("KEYBIT BTN_TOUCH");
66 ui.processLine("EVBIT EV_ABS");
67 ui.processLine("ABSBIT ABS_X");
68 ui.processLine("ABSBIT ABS_Y");
69 ui.processLine("ABSMIN ABS_X 0");
70 ui.processLine("ABSMAX ABS_X " + (int) (r.getWidth() - 1));
71 ui.processLine("ABSMIN ABS_Y 0");
72 ui.processLine("ABSMAX ABS_Y " + (int) (r.getHeight() - 1));
73 ui.processLine("PROPBIT INPUT_PROP_POINTER");
74 ui.processLine("PROPBIT INPUT_PROP_DIRECT");
75 ui.processLine("PROPERTY ID_INPUT_TOUCHSCREEN 1");
76 ui.processLine("BUS 0xCA");
77 ui.processLine("VENDOR 0xFE");
78 ui.processLine("PRODUCT 0xBA");
79 ui.processLine("VERSION 0xBE");
80 ui.processLine("CREATE");
81 }
82
83
84 @Test
85 public void testFilters() throws Exception {
86 ui.processLine("EV_KEY BTN_TOUCH 1");
87 ui.processLine("EV_ABS ABS_X 195");
88 ui.processLine("EV_ABS ABS_Y 200");
89 ui.processLine("EV_SYN");
90 ui.processLine("EV_ABS ABS_X 200");
91 ui.processLine("EV_ABS ABS_Y 200");
92 ui.processLine("EV_SYN");
93 TestLogShim.waitForLog("Touch pressed: 203, 195");
94 TestLogShim.waitForLog("Touch point id=5 at 203,195");
95 // Check for events send by the flushing filter
96 TestLogShim.waitForLog("Touch moved: 413, 95");
97 TestLogShim.waitForLog("Touch moved: 313, 95");
98 TestLogShim.waitForLog("Touch moved: 213, 95");
99 // This one should have been filtered out
100 Assert.assertEquals(0, TestLogShim.countLog("Touch Pressed: 208, 195"));
101 ui.processLine("EV_KEY BTN_TOUCH 0");
102 ui.processLine("EV_SYN");
103 TestLogShim.waitForLog("Touch released: 213, 95");
104 }
105
106 }
107
|