Yokan / rebuild
Course 1 8624561

SystemIntentLinkTest.kt

composeApp/src/androidHostTest/kotlin/eu/friedcutlet/yokan/SystemIntentLinkTest.kt

test / fixture29 lines
1package eu.friedcutlet.yokan23import android.app.SearchManager4import android.content.Intent5import eu.friedcutlet.yokan.ui.navigation.searchDeepLink6import kotlin.test.Test7import kotlin.test.assertEquals8import kotlin.test.assertNull910class SystemIntentLinkTest {11    @Test12    fun sharedTextAndSystemSearchOpenGlobalSearch() {13        val extras = mapOf(Intent.EXTRA_TEXT to " Dandadan ", SearchManager.QUERY to "Frieren", Intent.EXTRA_PROCESS_TEXT to "Blue Lock")14        assertEquals(searchDeepLink("Dandadan"), systemIntentLink(Intent.ACTION_SEND, null, extras::get))15        assertEquals(searchDeepLink("Frieren"), systemIntentLink(Intent.ACTION_SEARCH, null, extras::get))16        assertEquals(searchDeepLink("Frieren"), systemIntentLink(Intent.ACTION_WEB_SEARCH, null, extras::get))17        assertEquals(searchDeepLink("Frieren"), systemIntentLink("com.google.android.gms.actions.SEARCH_ACTION", null, extras::get))18        assertEquals(searchDeepLink("Blue Lock"), systemIntentLink(Intent.ACTION_PROCESS_TEXT, null, extras::get))19        assertNull(systemIntentLink(Intent.ACTION_SEND, null) { "  " })20    }2122    @Test23    fun viewIntentsKeepTheirData() {24        val backup = "content://com.android.externalstorage.documents/document/primary%3Alibrary.tachibk"25        assertEquals(backup, systemIntentLink(Intent.ACTION_VIEW, backup) { null })26        assertEquals("yokan://updates", systemIntentLink(Intent.ACTION_VIEW, "yokan://updates") { null })27        assertNull(systemIntentLink(Intent.ACTION_MAIN, null) { null })28    }29}30

Search chapters, reference and source filenames.