Loading tests/common/com/android/documentsui/bots/UiBot.java +7 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static androidx.test.espresso.matcher.ViewMatchers.withText; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertTrue; import static org.hamcrest.CoreMatchers.allOf; import static org.hamcrest.CoreMatchers.is; Loading Loading @@ -99,6 +100,12 @@ public class UiBot extends Bots.BaseBot { .check(matches(withToolbarTitle(is(expected)))); } public void assertSearchBarShow() { UiSelector selector = new UiSelector().text(mContext.getString(R.string.search_bar_hint)); UiObject searchHint = mDevice.findObject(selector); assertTrue(searchHint.exists()); } public void assertMenuEnabled(int id, boolean enabled) { UiObject2 menu = findMenuWithName(mContext.getString(id)); assertNotNull(menu); Loading tests/functional/com/android/documentsui/BandSelectionUiTest.java +4 −5 Original line number Diff line number Diff line Loading @@ -50,11 +50,10 @@ public class BandSelectionUiTest extends ActivityTest<FilesActivity> { public void testBandSelection_someFiles() throws Exception { bots.main.switchToGridMode(); Rect dirListBounds = bots.directory.findDocumentsList().getBounds(); Rect startDir = bots.directory.findDocument(dirName1).getBounds(); Rect endDoc = bots.directory.findDocument(fileName2).getBounds(); // Start from dir1 center of X and top of Y Point start = new Point(startDir.centerX(), dirListBounds.top); // End is center of file2 Rect endDoc = bots.directory.findDocument(fileName1).getBounds(); // Start from list right bottom. Point start = new Point(dirListBounds.right - 1, dirListBounds.bottom - 1); // End is center of file1 Point end = new Point(endDoc.centerX(), endDoc.centerY()); bots.gesture.bandSelection(start, end); Loading tests/functional/com/android/documentsui/FilesActivityUiTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ public class FilesActivityUiTest extends ActivityTest<FilesActivity> { // to be able to click on it. public void testClickRecent() throws Exception { bots.roots.openRoot("Recent"); bots.main.assertWindowTitle("Recent"); bots.main.assertSearchBarShow(); } public void testRootClick_SetsWindowTitle() throws Exception { Loading Loading
tests/common/com/android/documentsui/bots/UiBot.java +7 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static androidx.test.espresso.matcher.ViewMatchers.withText; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertTrue; import static org.hamcrest.CoreMatchers.allOf; import static org.hamcrest.CoreMatchers.is; Loading Loading @@ -99,6 +100,12 @@ public class UiBot extends Bots.BaseBot { .check(matches(withToolbarTitle(is(expected)))); } public void assertSearchBarShow() { UiSelector selector = new UiSelector().text(mContext.getString(R.string.search_bar_hint)); UiObject searchHint = mDevice.findObject(selector); assertTrue(searchHint.exists()); } public void assertMenuEnabled(int id, boolean enabled) { UiObject2 menu = findMenuWithName(mContext.getString(id)); assertNotNull(menu); Loading
tests/functional/com/android/documentsui/BandSelectionUiTest.java +4 −5 Original line number Diff line number Diff line Loading @@ -50,11 +50,10 @@ public class BandSelectionUiTest extends ActivityTest<FilesActivity> { public void testBandSelection_someFiles() throws Exception { bots.main.switchToGridMode(); Rect dirListBounds = bots.directory.findDocumentsList().getBounds(); Rect startDir = bots.directory.findDocument(dirName1).getBounds(); Rect endDoc = bots.directory.findDocument(fileName2).getBounds(); // Start from dir1 center of X and top of Y Point start = new Point(startDir.centerX(), dirListBounds.top); // End is center of file2 Rect endDoc = bots.directory.findDocument(fileName1).getBounds(); // Start from list right bottom. Point start = new Point(dirListBounds.right - 1, dirListBounds.bottom - 1); // End is center of file1 Point end = new Point(endDoc.centerX(), endDoc.centerY()); bots.gesture.bandSelection(start, end); Loading
tests/functional/com/android/documentsui/FilesActivityUiTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ public class FilesActivityUiTest extends ActivityTest<FilesActivity> { // to be able to click on it. public void testClickRecent() throws Exception { bots.roots.openRoot("Recent"); bots.main.assertWindowTitle("Recent"); bots.main.assertSearchBarShow(); } public void testRootClick_SetsWindowTitle() throws Exception { Loading