mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-11 08:27:50 -04:00
Refactored the FileUtilsInstrumentationTest.
This commit is contained in:
parent
d974822481
commit
4735933fd5
@ -340,7 +340,7 @@ class FileUtilsInstrumentationTest {
|
|||||||
// get the SD card path
|
// get the SD card path
|
||||||
val sdCardPath = context?.getExternalFilesDirs("")
|
val sdCardPath = context?.getExternalFilesDirs("")
|
||||||
?.get(1)?.path?.substringBefore("/Android")
|
?.get(1)?.path?.substringBefore("/Android")
|
||||||
val dummyUriData = listOf(
|
val dummyUriData = arrayListOf(
|
||||||
// test the download uri on older devices
|
// test the download uri on older devices
|
||||||
DummyUrlData(
|
DummyUrlData(
|
||||||
null,
|
null,
|
||||||
@ -385,14 +385,6 @@ class FileUtilsInstrumentationTest {
|
|||||||
"%3A$commonUri"
|
"%3A$commonUri"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
// test with USB stick uri
|
|
||||||
DummyUrlData(
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
"/mnt/media_rw/USB/$commonPath",
|
|
||||||
null,
|
|
||||||
Uri.parse("${primaryStorageUriPrefix}USB%3A$commonUri")
|
|
||||||
),
|
|
||||||
// test with invalid uri
|
// test with invalid uri
|
||||||
DummyUrlData(
|
DummyUrlData(
|
||||||
null,
|
null,
|
||||||
@ -421,6 +413,18 @@ class FileUtilsInstrumentationTest {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
// test with USB stick uri
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
|
||||||
|
dummyUriData.add(
|
||||||
|
DummyUrlData(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
"/mnt/media_rw/USB/$commonPath",
|
||||||
|
null,
|
||||||
|
Uri.parse("${primaryStorageUriPrefix}USB%3A$commonUri")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
context?.let { context ->
|
context?.let { context ->
|
||||||
CoroutineScope(Dispatchers.Main).launch {
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
dummyUriData.forEach { dummyUrlData ->
|
dummyUriData.forEach { dummyUrlData ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user