From 2e88716c001a265f1b24b1560dcd3ffef06a1fed Mon Sep 17 00:00:00 2001 From: takahirom Date: Thu, 12 Dec 2024 13:02:18 +0900 Subject: [PATCH] Add shadow and change sdk versions --- gradle/android.gradle | 4 +-- gradle/libs.versions.toml | 2 +- include-build/roborazzi-core/build.gradle | 4 +-- roborazzi-accessibility-check/build.gradle | 4 +-- roborazzi-ai-gemini/build.gradle | 4 +-- roborazzi-ai-openai/build.gradle | 4 +-- roborazzi-junit-rule/build.gradle | 4 +-- sample-android-without-compose/build.gradle | 4 +-- .../sample/DefaultThemeComposeTest.kt | 25 +++++++++++++++++-- .../takahirom/roborazzi/sample/ManualTest.kt | 2 +- 10 files changed, 39 insertions(+), 18 deletions(-) diff --git a/gradle/android.gradle b/gradle/android.gradle index 23a25a324..87a6596c3 100644 --- a/gradle/android.gradle +++ b/gradle/android.gradle @@ -1,9 +1,9 @@ android { - compileSdk 34 + compileSdk 35 defaultConfig { minSdk 21 - targetSdk 32 + targetSdk 35 versionCode 1 versionName "1.0" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4b1351e55..73eadf787 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,7 @@ composeCompiler = "1.5.10" composeMultiplatform = "1.6.2" robolectric = "4.14.1" generativeaiGoogle = "0.9.0-1.0.1" -robolectric-android-all = "Q-robolectric-5415296" +robolectric-android-all = "15-robolectric-12650502" roborazzi-for-replacing-by-include-build = "1.0.0" diff --git a/include-build/roborazzi-core/build.gradle b/include-build/roborazzi-core/build.gradle index 165fa51ac..156d0f86d 100644 --- a/include-build/roborazzi-core/build.gradle +++ b/include-build/roborazzi-core/build.gradle @@ -96,11 +96,11 @@ kotlin { android { namespace 'com.github.takahirom.roborazzi.core' - compileSdk 34 + compileSdk 35 defaultConfig { minSdk 21 - targetSdk 32 + targetSdk 35 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/roborazzi-accessibility-check/build.gradle b/roborazzi-accessibility-check/build.gradle index c50af0ef5..52a453b3a 100644 --- a/roborazzi-accessibility-check/build.gradle +++ b/roborazzi-accessibility-check/build.gradle @@ -9,11 +9,11 @@ if (System.getenv("INTEGRATION_TEST") != "true") { android { namespace 'com.github.takahirom.roborazzi.accessibility.check' - compileSdk 34 + compileSdk 35 defaultConfig { minSdk 21 - targetSdk 32 + targetSdk 35 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/roborazzi-ai-gemini/build.gradle b/roborazzi-ai-gemini/build.gradle index 7850852e6..407afaab9 100644 --- a/roborazzi-ai-gemini/build.gradle +++ b/roborazzi-ai-gemini/build.gradle @@ -44,11 +44,11 @@ kotlin { android { namespace 'com.github.takahirom.roborazzi.ai.gemini' - compileSdk 34 + compileSdk 35 defaultConfig { minSdk 21 - targetSdk 32 + targetSdk 35 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/roborazzi-ai-openai/build.gradle b/roborazzi-ai-openai/build.gradle index bb8b5b152..deadf2cc9 100644 --- a/roborazzi-ai-openai/build.gradle +++ b/roborazzi-ai-openai/build.gradle @@ -49,11 +49,11 @@ kotlin { android { namespace 'com.github.takahirom.roborazzi.ai.openai' - compileSdk 34 + compileSdk 35 defaultConfig { minSdk 21 - targetSdk 32 + targetSdk 35 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/roborazzi-junit-rule/build.gradle b/roborazzi-junit-rule/build.gradle index ae3504a60..f5612ecd3 100644 --- a/roborazzi-junit-rule/build.gradle +++ b/roborazzi-junit-rule/build.gradle @@ -9,11 +9,11 @@ if (System.getenv("INTEGRATION_TEST") != "true") { android { namespace 'com.github.takahirom.roborazzi.junit.rule' - compileSdk 34 + compileSdk 35 defaultConfig { minSdk 21 - targetSdk 32 + targetSdk 35 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/sample-android-without-compose/build.gradle b/sample-android-without-compose/build.gradle index d0f2f6519..ec613bda7 100644 --- a/sample-android-without-compose/build.gradle +++ b/sample-android-without-compose/build.gradle @@ -6,11 +6,11 @@ plugins { android { namespace 'com.github.takahirom.roborazzi.sample' - compileSdk 34 + compileSdk 35 defaultConfig { minSdk 21 - targetSdk 32 + targetSdk 35 versionCode 1 versionName "1.0" diff --git a/sample-android/src/test/java/com/github/takahirom/roborazzi/sample/DefaultThemeComposeTest.kt b/sample-android/src/test/java/com/github/takahirom/roborazzi/sample/DefaultThemeComposeTest.kt index 22da4253a..102813c47 100644 --- a/sample-android/src/test/java/com/github/takahirom/roborazzi/sample/DefaultThemeComposeTest.kt +++ b/sample-android/src/test/java/com/github/takahirom/roborazzi/sample/DefaultThemeComposeTest.kt @@ -4,9 +4,17 @@ import android.app.Application import android.content.pm.ActivityInfo import android.os.Bundle import androidx.activity.ComponentActivity +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.CardDefaults +import androidx.compose.material3.ElevatedCard +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.material3.Text +import androidx.compose.ui.Modifier import androidx.compose.ui.test.junit4.createAndroidComposeRule import androidx.compose.ui.test.onRoot +import androidx.compose.ui.unit.dp import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import com.github.takahirom.roborazzi.RoborazziRule @@ -19,7 +27,7 @@ import org.junit.runner.RunWith import org.robolectric.Shadows import org.robolectric.annotation.GraphicsMode -class DefaultThemeActivity: ComponentActivity() { +class DefaultThemeActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { setTheme(android.R.style.Theme_Material_Light) super.onCreate(savedInstanceState) @@ -37,6 +45,7 @@ class DefaultThemeComposeTest { val activityInfo = ActivityInfo().apply { name = DefaultThemeActivity::class.java.name packageName = appContext.packageName + flags = flags or ActivityInfo.FLAG_HARDWARE_ACCELERATED } Shadows.shadowOf(appContext.packageManager).addOrUpdateActivity(activityInfo) } @@ -54,7 +63,19 @@ class DefaultThemeComposeTest { @Test fun composable() { composeTestRule.setContent { - Text("a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\nx\ny\nz") + MaterialTheme { + Surface { + Box(modifier = Modifier.padding(8.dp)) { + ElevatedCard( + elevation = CardDefaults.cardElevation( + defaultElevation = 6.dp + ), + ) { + Text("a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\nx\ny\nz") + } + } + } + } } composeTestRule.onRoot().captureRoboImage() } diff --git a/sample-android/src/test/java/com/github/takahirom/roborazzi/sample/ManualTest.kt b/sample-android/src/test/java/com/github/takahirom/roborazzi/sample/ManualTest.kt index 83c2092a0..83ea105d5 100644 --- a/sample-android/src/test/java/com/github/takahirom/roborazzi/sample/ManualTest.kt +++ b/sample-android/src/test/java/com/github/takahirom/roborazzi/sample/ManualTest.kt @@ -54,7 +54,7 @@ import java.io.File @RunWith(AndroidJUnit4::class) @GraphicsMode(GraphicsMode.Mode.NATIVE) @Config( - sdk = [30], + sdk = [35], qualifiers = RobolectricDeviceQualifiers.NexusOne ) class ManualTest {