mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 13:15:35 +03:00
Add test case for (de)select when in single file fragment
Signed-off-by: ZetaTom <70907959+ZetaTom@users.noreply.github.com>
This commit is contained in:
parent
0e13fe2c4d
commit
f39170bc0d
1 changed files with 46 additions and 0 deletions
|
@ -269,6 +269,52 @@ class FileMenuFilterIT : AbstractIT() {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun filter_select_all() {
|
||||
configureCapability(OCCapability())
|
||||
|
||||
launchActivity<TestActivity>().use {
|
||||
it.onActivity { activity ->
|
||||
val filterFactory = FileMenuFilter.Factory(mockStorageManager, activity, editorUtils)
|
||||
|
||||
val files = listOf<OCFile>(OCFile("/foo.bin"), OCFile("/bar.bin"), OCFile("/baz.bin"))
|
||||
|
||||
// single file
|
||||
var sut = filterFactory.newInstance(files.first(), mockComponentsGetter, true, user)
|
||||
|
||||
var toHide = sut.getToHide(true)
|
||||
assertTrue(toHide.contains(R.id.action_select_all_action_menu))
|
||||
assertTrue(toHide.contains(R.id.action_deselect_all_action_menu))
|
||||
|
||||
toHide = sut.getToHide(false)
|
||||
assertTrue(toHide.contains(R.id.action_select_all_action_menu))
|
||||
assertTrue(toHide.contains(R.id.action_deselect_all_action_menu))
|
||||
|
||||
// multiple files, all selected
|
||||
sut = filterFactory.newInstance(files.size, files, mockComponentsGetter, false, user)
|
||||
|
||||
toHide = sut.getToHide(true)
|
||||
assertTrue(toHide.contains(R.id.action_select_all_action_menu))
|
||||
assertTrue(toHide.contains(R.id.action_deselect_all_action_menu))
|
||||
|
||||
toHide = sut.getToHide(false)
|
||||
assertTrue(toHide.contains(R.id.action_select_all_action_menu))
|
||||
assertFalse(toHide.contains(R.id.action_deselect_all_action_menu))
|
||||
|
||||
// multiple files, all but one selected
|
||||
sut = filterFactory.newInstance(files.size + 1, files, mockComponentsGetter, false, user)
|
||||
|
||||
toHide = sut.getToHide(true)
|
||||
assertTrue(toHide.contains(R.id.action_select_all_action_menu))
|
||||
assertTrue(toHide.contains(R.id.action_deselect_all_action_menu))
|
||||
|
||||
toHide = sut.getToHide(false)
|
||||
assertFalse(toHide.contains(R.id.action_select_all_action_menu))
|
||||
assertFalse(toHide.contains(R.id.action_deselect_all_action_menu))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private data class ExpectedLockVisibilities(
|
||||
val lockFile: Boolean,
|
||||
val unlockFile: Boolean
|
||||
|
|
Loading…
Reference in a new issue