1 /* 2 * Copyright (C) 2019 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 com.android.documentsui; 18 19 import android.graphics.Point; 20 import android.graphics.Rect; 21 22 import androidx.test.filters.LargeTest; 23 24 import com.android.documentsui.files.FilesActivity; 25 26 @LargeTest 27 public class FingerSelectionUiTest extends ActivityTest<FilesActivity> { 28 FingerSelectionUiTest()29 public FingerSelectionUiTest() { 30 super(FilesActivity.class); 31 } 32 33 @Override setUp()34 public void setUp() throws Exception { 35 super.setUp(); 36 initTestFiles(); 37 bots.roots.closeDrawer(); 38 } 39 testFingerSelection_outOfRange()40 public void testFingerSelection_outOfRange() throws Exception { 41 bots.main.switchToGridMode(); 42 Rect dirListBounds = bots.directory.findDocumentsList().getBounds(); 43 Rect firstDoc = bots.directory.findDocument(fileName1).getBounds(); 44 // Start from list right bottom. 45 Point start = new Point(firstDoc.centerX(), firstDoc.centerY()); 46 // End is center of file1 47 Point end = new Point(dirListBounds.right, dirListBounds.bottom); 48 bots.gesture.fingerSelection(start, end); 49 50 bots.directory.assertSelection(3); 51 } 52 } 53