Skip to content

Commit

Permalink
Check API 29(Q).
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaehwa-Noh committed Jun 22, 2024
1 parent 631b7c0 commit 0c763a7
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions app/src/androidTest/java/WorkerInstrumentationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

import android.content.Context
import android.os.Build
import androidx.test.core.app.ApplicationProvider
import androidx.work.ListenableWorker
import androidx.work.testing.TestListenableWorkerBuilder
Expand All @@ -23,6 +24,7 @@ import com.example.bluromatic.KEY_IMAGE_URI
import com.example.bluromatic.workers.BlurWorker
import com.example.bluromatic.workers.CleanupWorker
import com.example.bluromatic.workers.SaveImageToFileWorker
import junit.framework.TestCase
import kotlinx.coroutines.runBlocking
import org.junit.Assert.assertTrue
import org.junit.Before
Expand Down Expand Up @@ -75,10 +77,17 @@ class WorkerInstrumentationTest {
val resultUri = result.outputData.getString(KEY_IMAGE_URI)
assertTrue(result is ListenableWorker.Result.Success)
assertTrue(result.outputData.keyValueMap.containsKey(KEY_IMAGE_URI))
assertTrue(
resultUri?.startsWith("content://media/external/images/media/")
?: false
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
TestCase.assertTrue(
resultUri?.startsWith("content://media/external_primary/images/media/")
?: false
)
} else {
TestCase.assertTrue(
resultUri?.startsWith("content://media/external/images/media/")
?: false
)
}
}
}
}

0 comments on commit 0c763a7

Please sign in to comment.