File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ plugins {
33 alias(libs.plugins.kotlin.android)
44 alias(libs.plugins.kotlin.compose)
55 alias(libs.plugins.kotlin.serialization)
6+ alias(libs.plugins.screenshot)
67 id(" kotlin-parcelize" )
78}
89
@@ -74,6 +75,12 @@ android {
7475 includeInApk = false
7576 includeInBundle = false
7677 }
78+ experimentalProperties[" android.experimental.enableScreenshotTest" ] = true
79+ testOptions {
80+ screenshotTests {
81+ imageDifferenceThreshold = 0.0001f // 0.01%
82+ }
83+ }
7784}
7885
7986dependencies {
@@ -135,4 +142,5 @@ dependencies {
135142 debugImplementation(libs.ui.test.manifest)
136143 debugImplementation(libs.androidx.ui.tooling)
137144 debugImplementation(libs.androidx.ui.test.manifest)
145+ screenshotTestImplementation(libs.androidx.compose.ui.tooling)
138146}
Original file line number Diff line number Diff line change @@ -3,4 +3,5 @@ plugins {
33 alias(libs.plugins.android.application) apply false
44 alias(libs.plugins.kotlin.android) apply false
55 alias(libs.plugins.kotlin.compose) apply false
6+ alias(libs.plugins.screenshot) apply false
67}
Original file line number Diff line number Diff line change @@ -20,4 +20,5 @@ kotlin.code.style=official
2020# Enables namespacing of each library's R class so that its R class includes only the
2121# resources declared in the library itself and none from the library's dependencies,
2222# thereby reducing the size of the R class for that library
23- android.nonTransitiveRClass =true
23+ android.nonTransitiveRClass =true
24+ android.experimental.enableScreenshotTest =true
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ zoomable = "2.6.0"
3838cameraCamera2 = " 1.4.2"
3939cameraView = " 1.4.2"
4040foundation = " 1.8.1"
41+ screenshot = " 0.0.1-alpha09"
4142
4243[libraries ]
4344accompanist-permissions = { module = " com.google.accompanist:accompanist-permissions" , version.ref = " accompanistPermissions" }
@@ -93,9 +94,11 @@ ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
9394ui-test-manifest = { module = " androidx.compose.ui:ui-test-manifest" }
9495zoomable = { module = " net.engawapg.lib:zoomable" , version.ref = " zoomable" }
9596androidx-work-runtime-ktx = { module = " androidx.work:work-runtime-ktx" , version.ref = " workManager" }
97+ androidx-compose-ui-tooling = { group = " androidx.compose.ui" , name = " ui-tooling" }
9698
9799[plugins ]
98100android-application = { id = " com.android.application" , version.ref = " agp" }
99101kotlin-android = { id = " org.jetbrains.kotlin.android" , version.ref = " kotlin" }
100102kotlin-compose = { id = " org.jetbrains.kotlin.plugin.compose" , version.ref = " kotlin" }
101103kotlin-serialization = { id = " org.jetbrains.kotlin.plugin.serialization" , version.ref = " kotlin" }
104+ screenshot = { id = " com.android.compose.screenshot" , version.ref = " screenshot" }
You can’t perform that action at this time.
0 commit comments