1616package com.android.developers.androidify.home
1717
1818import androidx.activity.ComponentActivity
19+ import androidx.compose.runtime.CompositionLocalProvider
20+ import androidx.compose.ui.platform.LocalInspectionMode
1921import androidx.compose.ui.test.assertIsDisplayed
2022import androidx.compose.ui.test.assertIsNotDisplayed
2123import androidx.compose.ui.test.junit4.v2.createAndroidComposeRule
@@ -47,15 +49,17 @@ class HomeScreenTest {
4749 // Directly render HomeScreenContents, passing a lambda to track the click
4850
4951 SharedElementContextPreview {
50- HomeScreenContents (
51- layoutType = HomeScreenLayoutType .Compact , // Provide a default or mock value
52- onClickLetsGo = { offset: IntOffset -> // Match the lambda signature
53- wasClicked = true
54- },
55- onAboutClicked = {}, // Provide a default or mock value,
56- videoLink = " " ,
57- dancingBotLink = " " ,
58- )
52+ CompositionLocalProvider (LocalInspectionMode provides true ) {
53+ HomeScreenContents (
54+ layoutType = HomeScreenLayoutType .Compact , // Provide a default or mock value
55+ onClickLetsGo = { offset: IntOffset -> // Match the lambda signature
56+ wasClicked = true
57+ },
58+ onAboutClicked = {}, // Provide a default or mock value,
59+ videoLink = " " ,
60+ dancingBotLink = " " ,
61+ )
62+ }
5963 }
6064 }
6165
@@ -73,13 +77,15 @@ class HomeScreenTest {
7377
7478 composeTestRule.setContent {
7579 SharedElementContextPreview {
76- HomeScreenContents (
77- layoutType = HomeScreenLayoutType .Compact , // Ensure compact mode for pager
78- onClickLetsGo = { },
79- onAboutClicked = {},
80- videoLink = " " ,
81- dancingBotLink = " " ,
82- )
80+ CompositionLocalProvider (LocalInspectionMode provides true ) {
81+ HomeScreenContents (
82+ layoutType = HomeScreenLayoutType .Compact , // Ensure compact mode for pager
83+ onClickLetsGo = { },
84+ onAboutClicked = {},
85+ videoLink = " " ,
86+ dancingBotLink = " " ,
87+ )
88+ }
8389 }
8490 }
8591
0 commit comments