From cf2d445362a791ae34a1fc80b526e9181c3f97c0 Mon Sep 17 00:00:00 2001 From: Simon Marquis Date: Sat, 18 Nov 2023 12:20:46 +0100 Subject: [PATCH 1/2] Move Android instrumented test `ThemeTest` to unit test --- core/designsystem/build.gradle.kts | 2 +- .../samples/apps/nowinandroid/core/designsystem/ThemeTest.kt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) rename core/designsystem/src/{androidTest => test}/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ThemeTest.kt (98%) diff --git a/core/designsystem/build.gradle.kts b/core/designsystem/build.gradle.kts index 7bd1d12d8..d94c15d68 100644 --- a/core/designsystem/build.gradle.kts +++ b/core/designsystem/build.gradle.kts @@ -42,5 +42,5 @@ dependencies { implementation(libs.androidx.core.ktx) implementation(libs.coil.kt.compose) - androidTestImplementation(projects.core.testing) + testImplementation(libs.androidx.compose.ui.testManifest) } diff --git a/core/designsystem/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ThemeTest.kt b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ThemeTest.kt similarity index 98% rename from core/designsystem/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ThemeTest.kt rename to core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ThemeTest.kt index b10df053c..06b516436 100644 --- a/core/designsystem/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ThemeTest.kt +++ b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ThemeTest.kt @@ -43,6 +43,9 @@ import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme import com.google.samples.apps.nowinandroid.core.designsystem.theme.TintTheme import org.junit.Rule import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.annotation.Config import kotlin.test.assertEquals /** @@ -53,6 +56,8 @@ import kotlin.test.assertEquals * [LocalBackgroundTheme] — have the expected values for a given theme mode, as specified by the * design system. */ +@RunWith(RobolectricTestRunner::class) +@Config(sdk = [33]) class ThemeTest { @get:Rule From c1118eaf2285a5af9818dc302bda47781316a56c Mon Sep 17 00:00:00 2001 From: Simon Marquis Date: Fri, 22 Dec 2023 14:43:44 +0100 Subject: [PATCH 2/2] Apply suggestions from code review --- .../samples/apps/nowinandroid/core/designsystem/ThemeTest.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ThemeTest.kt b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ThemeTest.kt index 06b516436..eb49cc374 100644 --- a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ThemeTest.kt +++ b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ThemeTest.kt @@ -45,7 +45,6 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner -import org.robolectric.annotation.Config import kotlin.test.assertEquals /** @@ -57,7 +56,6 @@ import kotlin.test.assertEquals * design system. */ @RunWith(RobolectricTestRunner::class) -@Config(sdk = [33]) class ThemeTest { @get:Rule