Skip to content

Commit

Permalink
Merge branch 'takahirom/add-default-theme-test/2024-12-12' into takah…
Browse files Browse the repository at this point in the history
…irom/add-workaround-for-overlap/2024-12-12
  • Loading branch information
takahirom authored Dec 12, 2024
2 parents b6ab0cd + 2e88716 commit 2d126d2
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 18 deletions.
4 changes: 2 additions & 2 deletions gradle/android.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
android {
compileSdk 34
compileSdk 35

defaultConfig {
minSdk 21
targetSdk 32
targetSdk 35
versionCode 1
versionName "1.0"

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions include-build/roborazzi-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
4 changes: 2 additions & 2 deletions roborazzi-accessibility-check/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
4 changes: 2 additions & 2 deletions roborazzi-ai-gemini/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
4 changes: 2 additions & 2 deletions roborazzi-ai-openai/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
4 changes: 2 additions & 2 deletions roborazzi-junit-rule/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
4 changes: 2 additions & 2 deletions sample-android-without-compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
}
Expand All @@ -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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2d126d2

Please sign in to comment.