Loading tests/common/com/android/documentsui/bots/SortBot.java +5 −3 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class SortBot extends Bots.BaseBot { final @StringRes int labelId = mSortModel.getDimensionById(id).getLabelId(); final String label = mContext.getString(labelId); final boolean result; if (isHeaderShow()) { if (isSortHeaderShown(label)) { result = mColumnBot.sortBy(label, direction); } else { result = sortByMenu(id, direction); Loading @@ -82,8 +82,10 @@ public class SortBot extends Bots.BaseBot { assertTrue("Sorting by id: " + id + " in direction: " + direction + " failed.", result); } public boolean isHeaderShow() { return Matchers.present(ColumnSortBot.MATCHER); /** Check if the appropriate sort header is shown */ public boolean isSortHeaderShown(String label) { return Matchers.present( allOf(withChild(withText(label)), isDescendantOfA(ColumnSortBot.MATCHER))); } public void assertHeaderHide() { Loading tests/functional/com/android/documentsui/SortDocumentUiTest.java +4 −3 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.KeyEvent; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.LargeTest; import com.android.documentsui.base.RootInfo; import com.android.documentsui.files.FilesActivity; import com.android.documentsui.rules.TestFilesRule; import com.android.documentsui.sorting.SortDimension; Loading Loading @@ -98,17 +99,17 @@ public class SortDocumentUiTest extends ActivityTestJunit4<FilesActivity> { * @param sleep time to sleep in ms */ private void initFiles(long sleep) throws Exception { RootInfo root = mTestFilesRule.docsHelper.getRoot(StubProvider.ROOT_0_ID); for (int i = 0; i < FILES.length; ++i) { Uri uri = mTestFilesRule.docsHelper.createDocument( StubProvider.ROOT_0_ID, MIMES[i], FILES[i]); mTestFilesRule.docsHelper.createDocument(root, MIMES[i], FILES[i]); mTestFilesRule.docsHelper.writeDocument(uri, FILES[i].getBytes()); Thread.sleep(sleep); } for (String dir : DIRS) { mTestFilesRule.docsHelper.createFolder(StubProvider.ROOT_0_ID, dir); mTestFilesRule.docsHelper.createFolder(root, dir); Thread.sleep(sleep); } Loading Loading
tests/common/com/android/documentsui/bots/SortBot.java +5 −3 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class SortBot extends Bots.BaseBot { final @StringRes int labelId = mSortModel.getDimensionById(id).getLabelId(); final String label = mContext.getString(labelId); final boolean result; if (isHeaderShow()) { if (isSortHeaderShown(label)) { result = mColumnBot.sortBy(label, direction); } else { result = sortByMenu(id, direction); Loading @@ -82,8 +82,10 @@ public class SortBot extends Bots.BaseBot { assertTrue("Sorting by id: " + id + " in direction: " + direction + " failed.", result); } public boolean isHeaderShow() { return Matchers.present(ColumnSortBot.MATCHER); /** Check if the appropriate sort header is shown */ public boolean isSortHeaderShown(String label) { return Matchers.present( allOf(withChild(withText(label)), isDescendantOfA(ColumnSortBot.MATCHER))); } public void assertHeaderHide() { Loading
tests/functional/com/android/documentsui/SortDocumentUiTest.java +4 −3 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.KeyEvent; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.LargeTest; import com.android.documentsui.base.RootInfo; import com.android.documentsui.files.FilesActivity; import com.android.documentsui.rules.TestFilesRule; import com.android.documentsui.sorting.SortDimension; Loading Loading @@ -98,17 +99,17 @@ public class SortDocumentUiTest extends ActivityTestJunit4<FilesActivity> { * @param sleep time to sleep in ms */ private void initFiles(long sleep) throws Exception { RootInfo root = mTestFilesRule.docsHelper.getRoot(StubProvider.ROOT_0_ID); for (int i = 0; i < FILES.length; ++i) { Uri uri = mTestFilesRule.docsHelper.createDocument( StubProvider.ROOT_0_ID, MIMES[i], FILES[i]); mTestFilesRule.docsHelper.createDocument(root, MIMES[i], FILES[i]); mTestFilesRule.docsHelper.writeDocument(uri, FILES[i].getBytes()); Thread.sleep(sleep); } for (String dir : DIRS) { mTestFilesRule.docsHelper.createFolder(StubProvider.ROOT_0_ID, dir); mTestFilesRule.docsHelper.createFolder(root, dir); Thread.sleep(sleep); } Loading