Created
May 7, 2026 19:50
-
-
Save LethalMaus/9396753e4fe7846c7e8cf3553c3984ee to your computer and use it in GitHub Desktop.
Dejavu minimal rule fix for article
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package dejavu | |
| import androidx.activity.ComponentActivity | |
| import androidx.compose.ui.test.junit4.ComposeContentTestRule | |
| import androidx.compose.ui.test.junit4.ComposeTestRule | |
| import androidx.compose.ui.test.junit4.AndroidComposeTestRule | |
| import androidx.compose.ui.test.junit4.createAndroidComposeRule | |
| import androidx.test.ext.junit.rules.ActivityScenarioRule | |
| import org.junit.runner.Description | |
| import org.junit.runners.model.Statement | |
| public class DejavuComposeTestRule<A : ComponentActivity>( | |
| private val delegate: AndroidComposeTestRule<ActivityScenarioRule<A>, A> | |
| ) : ComposeContentTestRule by delegate { | |
| public val activity: A get() = delegate.activity | |
| override fun apply(base: Statement, description: Description): Statement { | |
| return delegate.apply(object : Statement() { | |
| override fun evaluate() { | |
| Dejavu.enable(delegate.activity.application) | |
| dejavu.internal.Runtime.setActiveActivity(delegate.activity) | |
| delegate.waitForIdle() | |
| DejavuTest.resetCounts() | |
| base.evaluate() | |
| } | |
| }, description) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment