• 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 import android.support.test.filters.LargeTest;
22 
23 import com.android.documentsui.files.FilesActivity;
24 
25 @LargeTest
26 public class BandSelectionUiTest extends ActivityTest<FilesActivity> {
27 
BandSelectionUiTest()28     public BandSelectionUiTest() {
29         super(FilesActivity.class);
30     }
31 
32     @Override
setUp()33     public void setUp() throws Exception {
34         super.setUp();
35         initTestFiles();
36         bots.roots.closeDrawer();
37     }
38 
testBandSelection_allFiles()39     public void testBandSelection_allFiles() throws Exception {
40         bots.main.switchToGridMode();
41         Rect dirListBounds = bots.directory.findDocumentsList().getBounds();
42         Point start = new Point(dirListBounds.right - 1, dirListBounds.bottom - 1);
43         Point end = new Point(dirListBounds.left + 1, dirListBounds.top + 1);
44         bots.gesture.bandSelection(start, end);
45 
46         bots.directory.assertSelection(4);
47     }
48 
testBandSelection_someFiles()49     public void testBandSelection_someFiles() throws Exception {
50         bots.main.switchToGridMode();
51         Rect dirListBounds = bots.directory.findDocumentsList().getBounds();
52         Rect startDoc = bots.directory.findDocument(fileName2).getBounds();
53         // 100 pixels below bottom of file2
54         Point start = new Point(startDoc.centerX(), startDoc.bottom + 100);
55         // Top left corner
56         Point end = new Point(dirListBounds.left + 1, dirListBounds.top + 1);
57         bots.gesture.bandSelection(start, end);
58 
59         bots.directory.assertSelection(3);
60     }
61 }
62