Home | History | Annotate | Download | only in cts
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package android.view.cts;
     18 
     19 import static android.view.cts.MotionEventUtils.withProperties;
     20 
     21 import android.support.test.filters.SmallTest;
     22 import android.support.test.runner.AndroidJUnit4;
     23 import android.view.MotionEvent;
     24 
     25 import org.junit.Before;
     26 import org.junit.Test;
     27 import org.junit.runner.RunWith;
     28 
     29 /**
     30  * Test {@link MotionEvent.PointerProperties}.
     31  */
     32 @SmallTest
     33 @RunWith(AndroidJUnit4.class)
     34 public class MotionEvent_PointerPropertiesTest {
     35     private MotionEventUtils.PointerPropertiesBuilder mBuilder;
     36     private MotionEvent.PointerProperties mPointerProperties;
     37 
     38     @Before
     39     public void setup() {
     40         mBuilder = withProperties(3, MotionEvent.TOOL_TYPE_MOUSE);
     41         mPointerProperties = mBuilder.build();
     42     }
     43 
     44     @Test
     45     public void testCreation() {
     46         mBuilder.verifyMatchesPointerProperties(mPointerProperties);
     47     }
     48 
     49     @Test
     50     public void testCopyFrom() {
     51         final MotionEvent.PointerProperties pointerProperties = new MotionEvent.PointerProperties();
     52         pointerProperties.copyFrom(mPointerProperties);
     53         mBuilder.verifyMatchesPointerProperties(pointerProperties);
     54     }
     55 
     56     @Test
     57     public void testClear() {
     58         mPointerProperties.clear();
     59         withProperties(MotionEvent.INVALID_POINTER_ID, MotionEvent.TOOL_TYPE_UNKNOWN).
     60                 verifyMatchesPointerProperties(mPointerProperties);
     61     }
     62 }
     63