-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Implement LifecycleOwner in tests #1294
base: jb-main
Are you sure you want to change the base?
Conversation
implementation(project(":lifecycle:lifecycle-common")) | ||
implementation(project(":lifecycle:lifecycle-runtime")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be in common?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't used in Android or commonMain, so we should keep it here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not required in common, as I introduced changes in skikoMain
/skikoTest
only, so I decided to include dependencies only for these source roots.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see some common API at some point, but it requires changes in AOSP first
compose/ui/ui-test/src/skikoMain/kotlin/androidx/compose/ui/test/ComposeUiTest.skikoMain.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui-test/src/skikoMain/kotlin/androidx/compose/ui/test/ComposeUiTest.skikoMain.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui-test/src/skikoMain/kotlin/androidx/compose/ui/test/ComposeUiTest.skikoMain.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui-test/src/skikoMain/kotlin/androidx/compose/ui/test/ComposeUiTest.skikoMain.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui-test/src/skikoTest/kotlin/LifecycleInTestsTest.kt
Outdated
Show resolved
Hide resolved
b7acd5b
to
c42d96d
Compare
lifecycleOwner.lifecycle.handleLifecycleEvent(event) | ||
} | ||
|
||
private fun ProvideTestCompositionLocals(composable: @Composable () -> Unit): @Composable () -> Unit = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private fun ProvideTestCompositionLocals(composable: @Composable () -> Unit): @Composable () -> Unit = { | |
@Composable | |
private fun ProvideTestCompositionLocals(content: @Composable () -> Unit) { |
@@ -443,4 +462,9 @@ actual sealed interface ComposeUiTest : SemanticsNodeInteractionsProvider { | |||
actual fun registerIdlingResource(idlingResource: IdlingResource) | |||
actual fun unregisterIdlingResource(idlingResource: IdlingResource) | |||
actual fun setContent(composable: @Composable () -> Unit) | |||
fun sendLifecycleEvent(event: Lifecycle.Event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KDoc is required for all public APIs
Does Android provide LifecycleOwner in tests? |
I don't think so. Delegating the review to m-sasha, as the owner of ui-test |
@m-sasha |
If Android's ui-test doesn't include lifecycle stuff, I'm thinking maybe we shouldn't either. Can we provide the same functionality from e.g. lifecycle-test? |
Proposed Changes
LifecycleOwner
in tests, provide it inLocalLifecycleOwner
Lifecycle
inrunComposeUiTest
Testing
Test: LifecycleInTestsTest