• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 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 BandSelectionUiTest extends ActivityTest<FilesActivity> {
28 
BandSelectionUiTest()29     public BandSelectionUiTest() {
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 
testBandSelection_allFiles()40     public void testBandSelection_allFiles() throws Exception {
41         bots.main.switchToGridMode();
42         Rect dirListBounds = bots.directory.findDocumentsList().getBounds();
43         Rect startDir = bots.directory.findDocument(dirName1).getBounds();
44         Point start = new Point(dirListBounds.right - 1, startDir.centerY());
45         Point end = new Point(dirListBounds.left + 1, dirListBounds.bottom - 1);
46         bots.gesture.bandSelection(start, end);
47 
48         bots.directory.assertSelection(4);
49     }
50 
testBandSelection_someFiles()51     public void testBandSelection_someFiles() throws Exception {
52         bots.main.switchToGridMode();
53         Rect dirListBounds = bots.directory.findDocumentsList().getBounds();
54         Rect startDoc = bots.directory.findDocument(fileNameNoRename).getBounds();
55         Rect endDoc = bots.directory.findDocument(fileName1).getBounds();
56         // Start from right side of file NoRename.
57         Point start = new Point(dirListBounds.right - 1, startDoc.bottom - 1);
58         // End is center of file1
59         Point end = new Point(endDoc.centerX(), endDoc.centerY());
60         bots.gesture.bandSelection(start, end);
61 
62         bots.directory.assertSelection(3);
63     }
64 }
65