Skip to content

Commit a4732ff

Browse files
authored
Copy material3 1.5.0-alpha12 and material3-adaptive 1.3.0-alpha06 (#2688)
| GroupId | ReleaseVersion | ReleaseSHA | ReleaseBuildId | ReleaseDate | | --- | --- | --- | --- | --- | | androidx.compose.material3 | 1.5.0-alpha12 | adeb519 | 14680202 | 1/14/2026 | | androidx.compose.material3.adaptive | 1.3.0-alpha06 | adeb519 | 14680202 | 1/14/2026 | Fixes https://youtrack.jetbrains.com/issue/CMP-9495 ## Testing N/A ## Release Notes N/A
2 parents 9efa330 + 0e35007 commit a4732ff

File tree

278 files changed

+3036
-792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

278 files changed

+3036
-792
lines changed

compose/material3/adaptive/adaptive-layout/lint-baseline.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<issues format="6" by="lint 9.0.0-alpha13" type="baseline" client="gradle" dependencies="false" name="AGP (9.0.0-alpha13)" variant="all" version="9.0.0-alpha13">
2+
<issues format="6" by="lint 9.0.0-beta02" type="baseline" client="gradle" dependencies="false" name="AGP (9.0.0-beta02)" variant="all" version="9.0.0-beta02">
33

44
<issue
55
id="ListIterator"

compose/material3/adaptive/adaptive-layout/src/androidDeviceTest/kotlin/androidx/compose/material3/adaptive/layout/LargeScreenTestUtils.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,21 @@ import androidx.compose.runtime.Composable
2323
import androidx.compose.runtime.CompositionLocalProvider
2424
import androidx.compose.ui.Modifier
2525
import androidx.compose.ui.platform.LocalDensity
26+
import androidx.compose.ui.platform.LocalLayoutDirection
2627
import androidx.compose.ui.platform.LocalWindowInfo
2728
import androidx.compose.ui.platform.WindowInfo
2829
import androidx.compose.ui.test.junit4.ComposeContentTestRule
2930
import androidx.compose.ui.unit.Density
3031
import androidx.compose.ui.unit.Dp
3132
import androidx.compose.ui.unit.DpSize
3233
import androidx.compose.ui.unit.IntSize
34+
import androidx.compose.ui.unit.LayoutDirection
3335
import androidx.compose.ui.unit.toSize
3436

3537
internal fun ComposeContentTestRule.setContentWithSimulatedSize(
3638
simulatedWidth: Dp,
3739
simulatedHeight: Dp,
40+
simulatedLayoutDirection: LayoutDirection = LayoutDirection.Ltr,
3841
content: @Composable () -> Unit,
3942
) {
4043
setContent {
@@ -46,6 +49,7 @@ internal fun ComposeContentTestRule.setContentWithSimulatedSize(
4649
CompositionLocalProvider(
4750
LocalDensity provides simulatedDensity,
4851
LocalWindowInfo provides MockWindowInfo(windowInfo.containerSize, simulatedDensity),
52+
LocalLayoutDirection provides simulatedLayoutDirection,
4953
) {
5054
Box(Modifier.fillMaxWidth().height(simulatedHeight)) { content() }
5155
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package androidx.compose.material3.adaptive.layout
18+
19+
import androidx.compose.foundation.background
20+
import androidx.compose.foundation.layout.fillMaxSize
21+
import androidx.compose.foundation.shape.RoundedCornerShape
22+
import androidx.compose.material3.BottomSheetDefaults
23+
import androidx.compose.material3.ExperimentalMaterial3Api
24+
import androidx.compose.material3.MaterialTheme
25+
import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi
26+
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
27+
import androidx.compose.runtime.Composable
28+
import androidx.compose.testutils.assertAgainstGolden
29+
import androidx.compose.ui.Alignment
30+
import androidx.compose.ui.Modifier
31+
import androidx.compose.ui.draw.clip
32+
import androidx.compose.ui.platform.testTag
33+
import androidx.compose.ui.test.captureToImage
34+
import androidx.compose.ui.test.junit4.v2.createComposeRule
35+
import androidx.compose.ui.test.onNodeWithTag
36+
import androidx.compose.ui.unit.dp
37+
import androidx.test.ext.junit.runners.AndroidJUnit4
38+
import androidx.test.filters.MediumTest
39+
import androidx.test.filters.SdkSuppress
40+
import androidx.test.screenshot.AndroidXScreenshotTestRule
41+
import kotlinx.coroutines.test.StandardTestDispatcher
42+
import org.junit.Rule
43+
import org.junit.Test
44+
import org.junit.runner.RunWith
45+
46+
@MediumTest
47+
@RunWith(AndroidJUnit4::class)
48+
@SdkSuppress(minSdkVersion = 35, maxSdkVersion = 35)
49+
@OptIn(ExperimentalMaterial3AdaptiveApi::class)
50+
class LevitatedPaneScreenshotTest {
51+
@get:Rule val rule = createComposeRule(StandardTestDispatcher())
52+
53+
@get:Rule val screenshotRule = AndroidXScreenshotTestRule(GOLDEN_MATERIAL3_ADAPTIVE)
54+
55+
@Test
56+
fun levitatedPane_asDialog_default() {
57+
rule.setContent {
58+
ThreePaneScaffoldWithLevitatedPane(
59+
levitatedPaneValue = PaneAdaptedValue.Levitated(Alignment.Center)
60+
)
61+
}
62+
63+
rule
64+
.onNodeWithTag(ThreePaneScaffoldTestTag)
65+
.captureToImage()
66+
.assertAgainstGolden(screenshotRule, "levitatedPane_asDialog_default")
67+
}
68+
69+
@Test
70+
fun levitatedPane_asDialog_withScrim() {
71+
rule.setContent {
72+
ThreePaneScaffoldWithLevitatedPane(
73+
levitatedPaneValue =
74+
PaneAdaptedValue.Levitated(
75+
alignment = Alignment.Center,
76+
scrim = { LevitatedPaneScrim() },
77+
)
78+
)
79+
}
80+
81+
rule
82+
.onNodeWithTag(ThreePaneScaffoldTestTag)
83+
.captureToImage()
84+
.assertAgainstGolden(screenshotRule, "levitatedPane_asDialog_withScrim")
85+
}
86+
87+
@Test
88+
fun levitatedPane_asDialog_withShape() {
89+
rule.setContent {
90+
ThreePaneScaffoldWithLevitatedPane(
91+
levitatedPaneValue = PaneAdaptedValue.Levitated(Alignment.Center),
92+
levitatedPaneModifier = { Modifier.clip(RoundedCornerShape(32.dp)) },
93+
)
94+
}
95+
96+
rule
97+
.onNodeWithTag(ThreePaneScaffoldTestTag)
98+
.captureToImage()
99+
.assertAgainstGolden(screenshotRule, "levitatedPane_asDialog_withShape")
100+
}
101+
102+
@Test
103+
fun levitatedPane_asBottomSheet_default() {
104+
rule.setContent {
105+
ThreePaneScaffoldWithLevitatedPane(
106+
levitatedPaneValue = PaneAdaptedValue.Levitated(Alignment.BottomCenter),
107+
levitatedPaneModifier = { Modifier.preferredWidth(1f).preferredHeight(0.5f) },
108+
)
109+
}
110+
111+
rule
112+
.onNodeWithTag(ThreePaneScaffoldTestTag)
113+
.captureToImage()
114+
.assertAgainstGolden(screenshotRule, "levitatedPane_asBottomSheet_default")
115+
}
116+
117+
@Test
118+
fun levitatedPane_asBottomSheet_withDragHandle() {
119+
rule.setContent {
120+
ThreePaneScaffoldWithLevitatedPane(
121+
levitatedPaneValue =
122+
PaneAdaptedValue.Levitated(
123+
alignment = Alignment.BottomCenter,
124+
dragToResizeState =
125+
rememberDragToResizeState(dockedEdge = DockedEdge.Bottom),
126+
),
127+
levitatedPaneModifier = { Modifier.preferredWidth(1f).preferredHeight(0.5f) },
128+
)
129+
}
130+
131+
rule
132+
.onNodeWithTag(ThreePaneScaffoldTestTag)
133+
.captureToImage()
134+
.assertAgainstGolden(screenshotRule, "levitatedPane_asBottomSheet_withDragHandle")
135+
}
136+
137+
@Test
138+
fun levitatedPane_asBottomSheet_withShape() {
139+
rule.setContent {
140+
ThreePaneScaffoldWithLevitatedPane(
141+
levitatedPaneValue = PaneAdaptedValue.Levitated(Alignment.BottomCenter),
142+
levitatedPaneModifier = {
143+
Modifier.preferredWidth(1f)
144+
.preferredHeight(0.5f)
145+
.clip(RoundedCornerShape(32.dp, 32.dp, 0.dp, 0.dp))
146+
},
147+
)
148+
}
149+
150+
rule
151+
.onNodeWithTag(ThreePaneScaffoldTestTag)
152+
.captureToImage()
153+
.assertAgainstGolden(screenshotRule, "levitatedPane_asBottomSheet_withShape")
154+
}
155+
156+
@Test
157+
fun levitatedPane_asBottomSheet_withDragHandleAndShape() {
158+
rule.setContent {
159+
ThreePaneScaffoldWithLevitatedPane(
160+
levitatedPaneValue =
161+
PaneAdaptedValue.Levitated(
162+
alignment = Alignment.BottomCenter,
163+
dragToResizeState =
164+
rememberDragToResizeState(dockedEdge = DockedEdge.Bottom),
165+
),
166+
levitatedPaneModifier = {
167+
Modifier.preferredWidth(1f)
168+
.preferredHeight(0.5f)
169+
.clip(RoundedCornerShape(32.dp, 32.dp, 0.dp, 0.dp))
170+
},
171+
)
172+
}
173+
174+
rule
175+
.onNodeWithTag(ThreePaneScaffoldTestTag)
176+
.captureToImage()
177+
.assertAgainstGolden(
178+
screenshotRule,
179+
"levitatedPane_asBottomSheet_withDragHandleAndShape",
180+
)
181+
}
182+
}
183+
184+
@OptIn(ExperimentalMaterial3AdaptiveApi::class, ExperimentalMaterial3Api::class)
185+
@Composable
186+
private fun ThreePaneScaffoldWithLevitatedPane(
187+
levitatedPaneValue: PaneAdaptedValue.Levitated,
188+
levitatedPaneModifier: PaneScaffoldScope.() -> Modifier = { Modifier },
189+
primaryContent: (@Composable ThreePaneScaffoldScope.() -> Unit) = {},
190+
secondaryContent: (@Composable ThreePaneScaffoldScope.() -> Unit) = {},
191+
tertiaryContent: (@Composable ThreePaneScaffoldScope.() -> Unit) = {},
192+
) {
193+
val directive = calculatePaneScaffoldDirective(currentWindowAdaptiveInfo())
194+
val value =
195+
ThreePaneScaffoldValue(
196+
PaneAdaptedValue.Expanded,
197+
PaneAdaptedValue.Hidden,
198+
levitatedPaneValue,
199+
)
200+
ListDetailPaneScaffold(
201+
modifier = Modifier.fillMaxSize().testTag(ThreePaneScaffoldTestTag),
202+
directive = directive,
203+
value = value,
204+
listPane = {
205+
AnimatedPane(
206+
modifier =
207+
Modifier.testTag(tag = "SecondaryPane")
208+
.background(color = MaterialTheme.colorScheme.secondary)
209+
) {
210+
secondaryContent()
211+
}
212+
},
213+
detailPane = {
214+
AnimatedPane(
215+
modifier =
216+
Modifier.testTag(tag = "PrimaryPane")
217+
.background(color = MaterialTheme.colorScheme.primary)
218+
) {
219+
primaryContent()
220+
}
221+
},
222+
extraPane = {
223+
AnimatedPane(
224+
modifier =
225+
levitatedPaneModifier()
226+
.testTag(tag = "TertiaryPane")
227+
.background(color = MaterialTheme.colorScheme.tertiary),
228+
dragToResizeHandle = { BottomSheetDefaults.DragHandle() },
229+
) {
230+
tertiaryContent()
231+
}
232+
},
233+
)
234+
}

compose/material3/adaptive/adaptive-layout/src/androidDeviceTest/kotlin/androidx/compose/material3/adaptive/layout/PaneExpansionStateTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import androidx.compose.runtime.mutableStateListOf
2222
import androidx.compose.runtime.mutableStateOf
2323
import androidx.compose.runtime.saveable.rememberSaveable
2424
import androidx.compose.ui.test.junit4.StateRestorationTester
25-
import androidx.compose.ui.test.junit4.createComposeRule
25+
import androidx.compose.ui.test.junit4.v2.createComposeRule
2626
import androidx.compose.ui.unit.dp
2727
import androidx.test.ext.junit.runners.AndroidJUnit4
2828
import androidx.test.filters.MediumTest

compose/material3/adaptive/adaptive-layout/src/androidDeviceTest/kotlin/androidx/compose/material3/adaptive/layout/ThreePaneScaffoldMotionScreenshotTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import androidx.compose.testutils.assertAgainstGolden
2727
import androidx.compose.ui.Modifier
2828
import androidx.compose.ui.platform.testTag
2929
import androidx.compose.ui.test.captureToImage
30-
import androidx.compose.ui.test.junit4.createComposeRule
30+
import androidx.compose.ui.test.junit4.v2.createComposeRule
3131
import androidx.compose.ui.test.onNodeWithTag
3232
import androidx.compose.ui.unit.dp
3333
import androidx.test.ext.junit.runners.AndroidJUnit4

0 commit comments

Comments
 (0)