diff options
author | Stefan Niedermann <info@niedermann.it> | 2022-04-23 11:38:07 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2022-04-23 11:38:20 +0300 |
commit | d043b05367783235d4892b7aceb5c0f68cd2975a (patch) | |
tree | 1043dca36e1287aa8ab1da1736d225b1dc011b91 /app/src/test/java/it/niedermann/owncloud/notes/persistence | |
parent | d721cb128d837f8fb15e3d55565439c09fa44ef5 (diff) |
#1504 Sort notes using locale sorting rules
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/test/java/it/niedermann/owncloud/notes/persistence')
-rw-r--r-- | app/src/test/java/it/niedermann/owncloud/notes/persistence/NotesRepositoryTest.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/src/test/java/it/niedermann/owncloud/notes/persistence/NotesRepositoryTest.java b/app/src/test/java/it/niedermann/owncloud/notes/persistence/NotesRepositoryTest.java index 7df8c86f..7788c248 100644 --- a/app/src/test/java/it/niedermann/owncloud/notes/persistence/NotesRepositoryTest.java +++ b/app/src/test/java/it/niedermann/owncloud/notes/persistence/NotesRepositoryTest.java @@ -36,16 +36,20 @@ import com.nextcloud.android.sso.model.SingleSignOnAccount; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.Robolectric; import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import java.util.Calendar; import java.util.Collections; +import java.util.Locale; import java.util.concurrent.ExecutorService; import io.reactivex.Observable; @@ -284,4 +288,22 @@ public class NotesRepositoryTest { repo.updateDisplayName(account.getId(), null); assertEquals("Should read userName in favor of displayName if displayName is NULL", "彼得", db.getAccountDao().getAccountById(account.getId()).getDisplayName()); } + + @Config(qualifiers = "de") + @Test + @Ignore("Language is properly set to DE, but LOCALIZED SQL query does not work") + public void searchLexicographically() throws InterruptedException, IOException { + repo.searchRecentByModified(account.getId(), "").forEach(note -> repo.deleteByNoteId(note.getId(), note.getStatus())); + Arrays.stream(new Note[]{ + new Note(10, 1001L, Calendar.getInstance(), "Baaa", "", "Špagety", false, null, VOID, account.getId(), "", 0), + new Note(11, null, Calendar.getInstance(), "Aaaa", "", "Svíčková", false, null, VOID, account.getId(), "", 0), + new Note(12, 1003L, Calendar.getInstance(), "Äaaa", "", "Zelí", false, null, VOID, account.getId(), "", 0), + }).forEach(note -> db.getNoteDao().addNote(note)); + + final var recent = NotesTestingUtil.getOrAwaitValue(repo.searchRecentLexicographically$(account.getId(), "")); + assertEquals(3, recent.size()); + assertEquals(11, recent.get(0).getId()); + assertEquals(12, recent.get(1).getId()); + assertEquals(10, recent.get(2).getId()); + } }
\ No newline at end of file |