From c5a1980e0d25cca26914ea443124f157c2e5178c Mon Sep 17 00:00:00 2001 From: Koitharu Date: Mon, 18 Jul 2022 14:12:24 +0300 Subject: [PATCH] Fix tests for api21 --- .../koitharu/kotatsu/core/os/ShortcutsUpdaterTest.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/androidTest/java/org/koitharu/kotatsu/core/os/ShortcutsUpdaterTest.kt b/app/src/androidTest/java/org/koitharu/kotatsu/core/os/ShortcutsUpdaterTest.kt index 8b68552da..ec4c04edc 100644 --- a/app/src/androidTest/java/org/koitharu/kotatsu/core/os/ShortcutsUpdaterTest.kt +++ b/app/src/androidTest/java/org/koitharu/kotatsu/core/os/ShortcutsUpdaterTest.kt @@ -2,6 +2,7 @@ package org.koitharu.kotatsu.core.os import android.content.pm.ShortcutInfo import android.content.pm.ShortcutManager +import android.os.Build import androidx.core.content.getSystemService import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry @@ -32,6 +33,9 @@ class ShortcutsUpdaterTest : KoinTest { @Test fun testUpdateShortcuts() = runTest { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) { + return@runTest + } awaitUpdate() assertTrue(getShortcuts().isEmpty()) historyRepository.addOrUpdate( @@ -55,11 +59,7 @@ class ShortcutsUpdaterTest : KoinTest { private suspend fun awaitUpdate() { val instrumentation = InstrumentationRegistry.getInstrumentation() - while (true) { - instrumentation.awaitForIdle() - if (shortcutsUpdater.await()) { - return - } - } + instrumentation.awaitForIdle() + shortcutsUpdater.await() } } \ No newline at end of file