Home | History | Annotate | Download | only in cts
      1 /*
      2  * Copyright (C) 2008 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 org.junit.Assert.assertNotNull;
     20 
     21 import android.support.test.InstrumentationRegistry;
     22 import android.support.test.filters.SmallTest;
     23 import android.support.test.runner.AndroidJUnit4;
     24 import android.view.ViewConfiguration;
     25 
     26 import org.junit.Test;
     27 import org.junit.runner.RunWith;
     28 
     29 /**
     30  * Test {@link ViewConfiguration}.
     31  */
     32 @SmallTest
     33 @RunWith(AndroidJUnit4.class)
     34 public class ViewConfigurationTest {
     35     @Test
     36     public void testStaticValues() {
     37         ViewConfiguration.getScrollBarSize();
     38         ViewConfiguration.getFadingEdgeLength();
     39         ViewConfiguration.getPressedStateDuration();
     40         ViewConfiguration.getLongPressTimeout();
     41         ViewConfiguration.getTapTimeout();
     42         ViewConfiguration.getJumpTapTimeout();
     43         ViewConfiguration.getEdgeSlop();
     44         ViewConfiguration.getTouchSlop();
     45         ViewConfiguration.getWindowTouchSlop();
     46         ViewConfiguration.getMinimumFlingVelocity();
     47         ViewConfiguration.getMaximumFlingVelocity();
     48         ViewConfiguration.getMaximumDrawingCacheSize();
     49         ViewConfiguration.getZoomControlsTimeout();
     50         ViewConfiguration.getGlobalActionKeyTimeout();
     51         ViewConfiguration.getScrollFriction();
     52         ViewConfiguration.getScrollBarFadeDuration();
     53         ViewConfiguration.getScrollDefaultDelay();
     54         ViewConfiguration.getDoubleTapTimeout();
     55         ViewConfiguration.getKeyRepeatTimeout();
     56         ViewConfiguration.getKeyRepeatDelay();
     57         ViewConfiguration.getDefaultActionModeHideDuration();
     58     }
     59 
     60     @Test
     61     public void testConstructor() {
     62         new ViewConfiguration();
     63     }
     64 
     65     @Test
     66     public void testInstanceValues() {
     67         ViewConfiguration vc = ViewConfiguration.get(InstrumentationRegistry.getTargetContext());
     68         assertNotNull(vc);
     69 
     70         vc.getScaledDoubleTapSlop();
     71         vc.getScaledEdgeSlop();
     72         vc.getScaledFadingEdgeLength();
     73         vc.getScaledMaximumDrawingCacheSize();
     74         vc.getScaledMaximumFlingVelocity();
     75         vc.getScaledMinimumFlingVelocity();
     76         vc.getScaledOverflingDistance();
     77         vc.getScaledOverscrollDistance();
     78         vc.getScaledPagingTouchSlop();
     79         vc.getScaledScrollBarSize();
     80         vc.getScaledHorizontalScrollFactor();
     81         vc.getScaledVerticalScrollFactor();
     82         vc.getScaledTouchSlop();
     83         vc.getScaledWindowTouchSlop();
     84         vc.hasPermanentMenuKey();
     85     }
     86 }
     87