Skip to content

Commit 254fa85

Browse files
Merge pull request #184 from zirman/main
Updates Compose to 1.10.1 and fixed tests
2 parents 44a031a + 55f0fdb commit 254fa85

File tree

9 files changed

+34
-23
lines changed

9 files changed

+34
-23
lines changed

compose-tests/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ plugins {
66
}
77

88
android {
9-
compileSdk = 34
9+
compileSdk = 35
1010

1111
compileOptions {
1212
sourceCompatibility = JavaVersion.VERSION_1_8
1313
targetCompatibility = JavaVersion.VERSION_1_8
1414
}
1515

1616
defaultConfig {
17-
minSdk = 21
18-
targetSdk = 34
17+
minSdk = 23
18+
targetSdk = 35
1919
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2020
}
2121

compose-tests/src/androidTest/java/radiography/test/compose/ComposeUiTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ class ComposeUiTest {
614614
"""
615615
|Box:
616616
|${BLANK}Box { test-tag:"parent" }
617-
|${BLANK}╰─LazyColumn { vertical-scroll-axis-range:"ScrollAxisRange(value=0.0, maxValue=0.0)", test-tag:"list" }
617+
|${BLANK}╰─LazyColumn { test-tag:"list", vertical-scroll-axis-range:"ScrollAxisRange(value=0.0, maxValue=0.0)" }
618618
|${BLANK} ├─<subcomposition of LazyColumn>
619619
|${BLANK} │ ╰─SkippableItem { test-tag:"child:1" }
620620
|${BLANK} ├─<subcomposition of LazyColumn>

compose-unsupported-tests/build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ plugins {
66
}
77

88
android {
9-
compileSdk = 34
9+
compileSdk = 35
1010

1111
compileOptions {
1212
sourceCompatibility = JavaVersion.VERSION_1_8
1313
targetCompatibility = JavaVersion.VERSION_1_8
1414
}
1515

1616
defaultConfig {
17-
minSdk = 21
18-
targetSdk = 34
17+
minSdk = 23
18+
targetSdk = 35
1919
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2020
}
2121

@@ -52,7 +52,7 @@ dependencies {
5252
androidTestImplementation(libs.appCompat)
5353
androidTestImplementation(libs.compose.old.activity)
5454
androidTestImplementation(libs.compose.old.material)
55-
androidTestImplementation(libs.compose.old.testing)
55+
androidTestImplementation(libs.compose.testing)
5656
androidTestImplementation(libs.test.androidx.rules)
5757
androidTestImplementation(libs.test.junit)
5858
androidTestImplementation(libs.test.androidx.runner)

gradle/libs.versions.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ compose-compiler = "1.5.3"
88
# We compile against an older version of Compose intentionally to support consumers that aren't on
99
# the latest.
1010
#noinspection GradleDependency
11-
compose = "1.7.0-beta05"
11+
compose = "1.10.1"
1212
# Allows using a different version of Compose to validate that we degrade gracefully on apps
1313
# built with unsupported Compose versions.
1414
#noinspection GradleDependency
@@ -52,8 +52,6 @@ compose-sample-tooling = { module = "androidx.compose.ui:ui-tooling", version.re
5252
compose-old-activity = "androidx.activity:activity-compose:1.3.0-alpha02"
5353
#noinspection SimilarGradleDependency
5454
compose-old-material = { module = "androidx.compose.material:material", version.ref = "compose-old" }
55-
#noinspection SimilarGradleDependency
56-
compose-old-testing = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose-old" }
5755

5856
test-junit = "junit:junit:4.13"
5957
test-mockito = "org.mockito:mockito-core:3.11.2"

radiography/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ plugins {
2222
}
2323

2424
android {
25-
compileSdk = 34
25+
compileSdk = 35
2626

2727
compileOptions {
2828
sourceCompatibility = JavaVersion.VERSION_1_8
2929
targetCompatibility = JavaVersion.VERSION_1_8
3030
}
3131

3232
defaultConfig {
33-
minSdk = 17
34-
targetSdk = 34
33+
minSdk = 23
34+
targetSdk = 35
3535
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3636
}
3737

radiography/src/main/java/radiography/ViewStateRenderers.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,23 @@ public object ViewStateRenderers {
7575
// Technically there can be multiple semantic modifiers on a single node, so read them
7676
// all.
7777
.flatten()
78+
.sortedBy { it.key.name }
7879
.forEach { (key, value) ->
7980
when (key) {
8081
SemanticsProperties.TestTag -> appendLabeledValue("test-tag", value)
8182
SemanticsProperties.ContentDescription -> appendLabeledValue(
8283
"content-description",
8384
(value as List<*>).map { "\"$it\"" }
8485
)
86+
8587
SemanticsProperties.StateDescription -> appendLabeledValue("state-description", value)
8688
SemanticsProperties.Disabled -> append("DISABLED")
8789
SemanticsProperties.Focused -> if (value == true) append("FOCUSED")
8890
SemanticsProperties.IsDialog -> append("DIALOG")
8991
SemanticsProperties.IsPopup -> append("POPUP")
9092
SemanticsProperties.ProgressBarRangeInfo ->
9193
appendLabeledValue("progress-bar-range", value)
94+
9295
SemanticsProperties.PaneTitle -> appendLabeledValue("pane-title", value)
9396
SemanticsProperties.SelectableGroup -> append("SELECTABLE-GROUP")
9497
SemanticsProperties.Heading -> append("HEADING")
@@ -98,11 +101,13 @@ public object ViewStateRenderers {
98101
"horizontal-scroll-axis-range",
99102
scrollAxisRangeToString(value as? ScrollAxisRange)
100103
)
104+
101105
SemanticsProperties.VerticalScrollAxisRange ->
102106
appendLabeledValue(
103107
"vertical-scroll-axis-range",
104108
scrollAxisRangeToString(value as? ScrollAxisRange)
105109
)
110+
106111
SemanticsProperties.Role -> appendLabeledValue("role", value)
107112
SemanticsProperties.TextSelectionRange -> append("SELECTED-TEXT")
108113
SemanticsProperties.ImeAction -> appendLabeledValue("ime-action", value)
@@ -244,7 +249,8 @@ public object ViewStateRenderers {
244249
*/
245250
// This function is only visible to Java consumers of this library.
246251
@JvmStatic
247-
@PublishedApi internal fun <T : Any> androidViewStateRendererFor(
252+
@PublishedApi
253+
internal fun <T : Any> androidViewStateRendererFor(
248254
renderedClass: Class<T>,
249255
renderer: AttributeAppendable.(T) -> Unit
250256
): ViewStateRenderer = ViewStateRenderer { scannableView ->

radiography/src/main/java/radiography/internal/CompositionContexts.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ private val REFLECTION_CONSTANTS by lazy(PUBLICATION) {
1313
Class.forName("androidx.compose.runtime.ComposerImpl\$CompositionContextHolder")
1414
val CompositionContextImplClass =
1515
Class.forName("androidx.compose.runtime.ComposerImpl\$CompositionContextImpl")
16+
val ReusableRememberObserverHolderClass =
17+
Class.forName("androidx.compose.runtime.ReusableRememberObserverHolder")
1618
val CompositionContextHolderRefField =
1719
CompositionContextHolderClass.getDeclaredField("ref")
1820
.apply { isAccessible = true }
@@ -29,8 +31,13 @@ private val REFLECTION_CONSTANTS by lazy(PUBLICATION) {
2931
internal fun Group.getCompositionContexts(): Sequence<CompositionContext> {
3032
return REFLECTION_CONSTANTS?.run {
3133
data.asSequence()
32-
.filter { it != null && it::class.java == CompositionContextHolderClass }
33-
.mapNotNull { holder -> holder.tryGetCompositionContext() }
34+
.filter { it != null && it::class.java == ReusableRememberObserverHolderClass }
35+
.mapNotNull { holder ->
36+
holder
37+
?.let { holder::class.java.getMethod("getWrapped") }
38+
?.invoke(holder)
39+
?.tryGetCompositionContext()
40+
}
3441
} ?: emptySequence()
3542
}
3643

sample-compose/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ plugins {
66
}
77

88
android {
9-
compileSdk = 34
9+
compileSdk = 35
1010

1111
compileOptions {
1212
sourceCompatibility = JavaVersion.VERSION_1_8
1313
targetCompatibility = JavaVersion.VERSION_1_8
1414
}
1515

1616
defaultConfig {
17-
minSdk = 21
18-
targetSdk = 34
17+
minSdk = 23
18+
targetSdk = 35
1919
applicationId = "com.squareup.radiography.sample.compose"
2020
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2121
}

sample/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ plugins {
2020
}
2121

2222
android {
23-
compileSdk = 34
23+
compileSdk = 35
2424

2525
compileOptions {
2626
sourceCompatibility = JavaVersion.VERSION_1_8
2727
targetCompatibility = JavaVersion.VERSION_1_8
2828
}
2929

3030
defaultConfig {
31-
minSdk = 21
32-
targetSdk = 34
31+
minSdk = 23
32+
targetSdk = 35
3333
applicationId = "com.squareup.radiography.sample"
3434
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3535
}

0 commit comments

Comments
 (0)