1 /*
   2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   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 com.sun.glass.ui.monocle;
  27 
  28 import com.sun.glass.ui.monocle.input.devices.TestTouchDevice;
  29 import com.sun.glass.ui.monocle.input.devices.TestTouchDevices;
  30 import javafx.application.ConditionalFeature;
  31 import javafx.application.Platform;
  32 import junit.framework.Assert;
  33 import org.junit.Assume;
  34 import org.junit.Before;
  35 import org.junit.Test;
  36 import org.junit.runners.Parameterized;
  37 
  38 import java.util.Collection;
  39 
  40 public class InputDevicePropertyTest  extends ParameterizedTestBase {
  41 
  42     public InputDevicePropertyTest(TestTouchDevice device) {
  43         super(device);
  44     }
  45 
  46     @Parameterized.Parameters
  47     public static Collection<Object[]> data() {
  48         return TestTouchDevices.getTouchDeviceParameters(1);
  49     }
  50 
  51     @Before
  52     public void checkPlatform() throws Exception {
  53         Assume.assumeTrue(TestApplication.isMonocle() || TestApplication.isLens());
  54     }
  55 
  56     @Test
  57     public void testTouch() throws Exception {
  58         TestRunnable.invokeAndWait(() -> Assert.assertTrue(Platform.isSupported(ConditionalFeature.INPUT_TOUCH)));
  59     }
  60 
  61     @Test
  62     public void testMultiTouch() throws Exception {
  63         TestRunnable.invokeAndWait(() -> Assert.assertEquals(device.getPointCount() > 1,
  64                             Platform.isSupported(
  65                                     ConditionalFeature.INPUT_MULTITOUCH)));
  66     }
  67 
  68     @Test
  69     public void testPointer() throws Exception {
  70         TestRunnable.invokeAndWait(() -> Assert.assertFalse(
  71                 Platform.isSupported(ConditionalFeature.INPUT_POINTER)));
  72     }
  73 
  74 }