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 2d126d2 + 0895c56 commit e9b7e59
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.takahirom.roborazzi.sample

import android.app.Application
import android.content.pm.ActivityInfo
import android.content.ComponentName
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.compose.foundation.layout.Box
Expand All @@ -18,6 +18,7 @@ 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
import com.github.takahirom.roborazzi.RoborazziTransparentActivity
import com.github.takahirom.roborazzi.captureRoboImage
import org.junit.Rule
import org.junit.Test
Expand All @@ -42,12 +43,12 @@ class DefaultThemeComposeTest {
override fun starting(description: Description?) {
super.starting(description)
val appContext: Application = ApplicationProvider.getApplicationContext()
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)
Shadows.shadowOf(appContext.packageManager).addActivityIfNotPresent(
ComponentName(
appContext.packageName,
DefaultThemeActivity::class.java.name,
)
)
}
}

Expand Down

0 comments on commit e9b7e59

Please sign in to comment.