From e7d78a7c3c6e3435f60003a8b68e721c6caf55d0 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Wed, 21 Nov 2018 09:47:15 +0100 Subject: [PATCH] Test case for sorting hidden files/folders - see #3280 --- .../owncloud/android/utils/TestSorting.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/test/java/com/owncloud/android/utils/TestSorting.java b/src/test/java/com/owncloud/android/utils/TestSorting.java index 91da24efccca..591b020d2709 100644 --- a/src/test/java/com/owncloud/android/utils/TestSorting.java +++ b/src/test/java/com/owncloud/android/utils/TestSorting.java @@ -372,6 +372,34 @@ public void testSortCloudFilesWithDots() { assertTrue(sortAndTest(array)); } + @Test + public void testDotFilesAndFolders() { + List array = new ArrayList<>(); + + array.add(new OCFile("/.apache2").setFolder()); + array.add(new OCFile("/.cache").setFolder()); + array.add(new OCFile("/.config").setFolder()); + array.add(new OCFile("/.local").setFolder()); + array.add(new OCFile("/.logs").setFolder()); + array.add(new OCFile("/.nano").setFolder()); + array.add(new OCFile("/.nginx").setFolder()); + array.add(new OCFile("/.script-credentials").setFolder()); + array.add(new OCFile("/.ssh").setFolder()); + array.add(new OCFile("/.subversion").setFolder()); + array.add(new OCFile("/.znc").setFolder()); + array.add(new OCFile("/.bash_aliases")); + array.add(new OCFile("/.bash_history")); + array.add(new OCFile("/.bash_logout")); + array.add(new OCFile("/.bashrc")); + array.add(new OCFile("/.feral_aliases")); + array.add(new OCFile("/.mysql_history")); + array.add(new OCFile("/.profile")); + array.add(new OCFile("/.selected_editor")); + array.add(new OCFile("/.wget-hsts")); + + assertTrue(sortAndTest(array)); + } + private List shuffle(List files) { List shuffled = new ArrayList<>(); shuffled.addAll(files);