mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-31 23:03:54 +01:00
refactor gallery picker test
Signed-off-by: parneet-guraya <gurayaparneet@gmail.com>
This commit is contained in:
parent
2739fccec4
commit
68e36864d0
1 changed files with 7 additions and 2 deletions
|
|
@ -64,12 +64,17 @@ class FilePickerTest {
|
||||||
`when`(PreferenceManager.getDefaultSharedPreferences(activity)).thenReturn(sharedPref)
|
`when`(PreferenceManager.getDefaultSharedPreferences(activity)).thenReturn(sharedPref)
|
||||||
`when`(sharedPref.edit()).thenReturn(sharedPreferencesEditor)
|
`when`(sharedPref.edit()).thenReturn(sharedPreferencesEditor)
|
||||||
`when`(sharedPref.edit().putInt("type", 0)).thenReturn(sharedPreferencesEditor)
|
`when`(sharedPref.edit().putInt("type", 0)).thenReturn(sharedPreferencesEditor)
|
||||||
FilePicker.openGallery(activity, 0, nextBoolean())
|
val openDocumentPreferred = nextBoolean()
|
||||||
|
FilePicker.openGallery(activity, 0, openDocumentPreferred)
|
||||||
verify(activity).startActivityForResult(
|
verify(activity).startActivityForResult(
|
||||||
ArgumentMatchers.any(),
|
ArgumentMatchers.any(),
|
||||||
requestCodeCaptor?.capture()?.toInt()!!,
|
requestCodeCaptor?.capture()?.toInt()!!,
|
||||||
)
|
)
|
||||||
assertEquals(requestCodeCaptor?.value, RequestCodes.PICK_PICTURE_FROM_GALLERY)
|
if(openDocumentPreferred){
|
||||||
|
assertEquals(requestCodeCaptor?.value, RequestCodes.PICK_PICTURE_FROM_DOCUMENTS)
|
||||||
|
}else{
|
||||||
|
assertEquals(requestCodeCaptor?.value, RequestCodes.PICK_PICTURE_FROM_GALLERY)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue