Skip to content

Commit 18dabc8

Browse files
committed
Register the Skiko UI implementation at Compose entry points
Wire registerSkikoComposeImplementation() into the Skiko-backed Compose entry points so the ui-graphics/ui-text registries are populated before any scene is created: desktop ComposePanel/ComposeWindowPanel, macOS ComposeWindow, iOS ComposeUIViewController, web ComposeWindowInternal, ImageComposeScene, and the ui-test rules. Adds the :compose:ui:ui-skiko dependency to the modules that rely on the Skiko backend transitively (ui, ui-test, ui-test-junit4, foundation) and registers in the affected test harnesses.
1 parent 9b25724 commit 18dabc8

32 files changed

Lines changed: 161 additions & 12 deletions

File tree

compose/foundation/foundation/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ androidXMultiplatform {
124124
dependencies {
125125
// TODO(https://youtrack.jetbrains.com/issue/CMP-219) Remove API
126126
api(libs.skiko)
127+
// TODO(https://youtrack.jetbrains.com/issue/CMP-10338): Remove direct dependency
128+
implementation(project(":compose:ui:ui-skiko"))
129+
127130
implementation(libs.atomicFu)
128131
}
129132
}

compose/foundation/foundation/src/skikoTest/kotlin/androidx/compose/foundation/copyPasteAndroidTests/text/TextDelegateIntegrationTest.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import androidx.compose.foundation.isEqualTo
2121
import androidx.compose.foundation.isTrue
2222
import androidx.compose.foundation.text.InternalFoundationTextApi
2323
import androidx.compose.foundation.text.TextDelegate
24+
import androidx.compose.ui.InternalComposeUiApi
25+
import androidx.compose.ui.platform.registerSkikoComposeImplementation
2426
import androidx.compose.ui.text.AnnotatedString
2527
import androidx.compose.ui.text.SpanStyle
2628
import androidx.compose.ui.text.TextStyle
@@ -32,12 +34,18 @@ import androidx.compose.ui.unit.Density
3234
import androidx.compose.ui.unit.LayoutDirection
3335
import androidx.compose.ui.unit.sp
3436
import kotlin.math.roundToInt
37+
import kotlin.test.BeforeTest
3538
import kotlin.test.Ignore
3639
import kotlin.test.Test
3740

38-
@OptIn(InternalFoundationTextApi::class)
41+
@OptIn(InternalFoundationTextApi::class, InternalComposeUiApi::class)
3942
class TextDelegateIntegrationTest {
4043

44+
@BeforeTest
45+
fun registerSkikoBackend() {
46+
registerSkikoComposeImplementation()
47+
}
48+
4149
@Test
4250
@Ignore // TODO: test is failing
4351
fun minIntrinsicWidth_getter() = with(Density(1f, 1f)) {

compose/foundation/foundation/src/skikoTest/kotlin/androidx/compose/foundation/shape/AbsoluteCutCornerShapeTest.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
package androidx.compose.foundation.shape
1818

19+
import androidx.compose.ui.InternalComposeUiApi
20+
import androidx.compose.ui.platform.registerSkikoComposeImplementation
21+
import kotlin.test.BeforeTest
1922
import androidx.compose.foundation.assertThat
2023
import androidx.compose.foundation.isEqualTo
2124
import androidx.compose.foundation.isFalse
@@ -31,8 +34,14 @@ import androidx.compose.ui.unit.dp
3134
import kotlin.test.Test
3235
import kotlin.test.assertEquals
3336

37+
@OptIn(InternalComposeUiApi::class)
3438
class AbsoluteCutCornerShapeTest {
3539

40+
@BeforeTest
41+
fun registerSkikoBackend() {
42+
registerSkikoComposeImplementation()
43+
}
44+
3645
private var layoutDirection: LayoutDirection? = null
3746

3847
private val testParameters = arrayOf(

compose/foundation/foundation/src/skikoTest/kotlin/androidx/compose/foundation/shape/AbsoluteRoundedCornerShapeTest.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
package androidx.compose.foundation.shape
1818

19+
import androidx.compose.ui.InternalComposeUiApi
20+
import androidx.compose.ui.platform.registerSkikoComposeImplementation
21+
import kotlin.test.BeforeTest
1922
import androidx.compose.foundation.assertThat
2023
import androidx.compose.foundation.isEqualTo
2124
import androidx.compose.foundation.isFalse
@@ -32,8 +35,14 @@ import androidx.compose.ui.unit.dp
3235
import kotlin.test.Test
3336
import kotlin.test.assertEquals
3437

38+
@OptIn(InternalComposeUiApi::class)
3539
class AbsoluteRoundedCornerShapeTest {
3640

41+
@BeforeTest
42+
fun registerSkikoBackend() {
43+
registerSkikoComposeImplementation()
44+
}
45+
3746
private var layoutDirection: LayoutDirection? = null
3847

3948
private val testParameters = arrayOf(

compose/foundation/foundation/src/skikoTest/kotlin/androidx/compose/foundation/shape/CutCornerShapeTest.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
package androidx.compose.foundation.shape
1818

19+
import androidx.compose.ui.InternalComposeUiApi
20+
import androidx.compose.ui.platform.registerSkikoComposeImplementation
21+
import kotlin.test.BeforeTest
1922
import androidx.compose.foundation.assertThat
2023
import androidx.compose.foundation.isEqualTo
2124
import androidx.compose.foundation.isFalse
@@ -33,8 +36,14 @@ import kotlin.test.Test
3336
import kotlin.test.assertEquals
3437
import kotlin.test.assertTrue
3538

39+
@OptIn(InternalComposeUiApi::class)
3640
class CutCornerShapeTest {
3741

42+
@BeforeTest
43+
fun registerSkikoBackend() {
44+
registerSkikoComposeImplementation()
45+
}
46+
3847
private val density = Density(2f)
3948
private val size = Size(100.0f, 150.0f)
4049

compose/foundation/foundation/src/skikoTest/kotlin/androidx/compose/foundation/shape/RoundedCornerShapeTest.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
package androidx.compose.foundation.shape
1818

19+
import androidx.compose.ui.InternalComposeUiApi
20+
import androidx.compose.ui.platform.registerSkikoComposeImplementation
21+
import kotlin.test.BeforeTest
1922
import androidx.compose.foundation.assertThat
2023
import androidx.compose.foundation.isEqualTo
2124
import androidx.compose.foundation.isFalse
@@ -32,8 +35,14 @@ import androidx.compose.ui.unit.dp
3235
import kotlin.test.Test
3336
import kotlin.test.assertEquals
3437

38+
@OptIn(InternalComposeUiApi::class)
3539
class RoundedCornerShapeTest {
3640

41+
@BeforeTest
42+
fun registerSkikoBackend() {
43+
registerSkikoComposeImplementation()
44+
}
45+
3746
private val density = Density(2f)
3847
private val size = Size(100.0f, 150.0f)
3948

compose/foundation/foundation/src/skikoTest/kotlin/androidx/compose/foundation/text/CupertinoTextFieldDelegateTest.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
package androidx.compose.foundation.text
1818

19+
import androidx.compose.ui.InternalComposeUiApi
20+
import androidx.compose.ui.platform.registerSkikoComposeImplementation
21+
import kotlin.test.BeforeTest
1922
import androidx.compose.ui.text.AnnotatedString
2023
import androidx.compose.ui.text.MultiParagraph
2124
import androidx.compose.ui.text.TextLayoutInput
@@ -34,7 +37,13 @@ import kotlin.test.Test
3437
import kotlin.test.assertEquals
3538
import kotlinx.test.IgnoreWasmTarget
3639

40+
@OptIn(InternalComposeUiApi::class)
3741
class CupertinoTextFieldDelegateTest {
42+
43+
@BeforeTest
44+
fun registerSkikoBackend() {
45+
registerSkikoComposeImplementation()
46+
}
3847
private val sampleText =
3948
"aaaa bbb cccc dd e fffffffff?????????!!!!!!! ...\n" + "ggggggg tttt\n" +
4049
"Family emoji: \uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC66\uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC66, and some text at the end\n" +

compose/mpp/demo/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ kotlin {
136136
implementation(project(":compose:ui:ui-graphics"))
137137
implementation(project(":compose:ui:ui-text"))
138138
implementation(project(":compose:ui:ui-backhandler"))
139+
implementation(project(":compose:ui:ui-skiko"))
139140
implementation(project(":lifecycle:lifecycle-common"))
140141
implementation(project(":lifecycle:lifecycle-runtime"))
141142
implementation(project(":lifecycle:lifecycle-runtime-compose"))

compose/ui/ui-test-junit4/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ androidXMultiplatform {
119119
dependencies {
120120
implementation(libs.truth)
121121
implementation(libs.skiko)
122+
implementation(project(":compose:ui:ui-skiko"))
122123
}
123124
}
124125

compose/ui/ui-test-junit4/src/desktopMain/kotlin/androidx/compose/ui/test/junit4/DesktopComposeTestRule.desktop.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ import org.junit.runners.model.Statement
4444
"coroutines are queued rather than executed immediately.",
4545
level = DeprecationLevel.WARNING,
4646
)
47-
@OptIn(InternalTestApi::class, ExperimentalTestApi::class)
48-
actual fun createComposeRule(): ComposeContentTestRule =
49-
DesktopComposeTestRule(
47+
@OptIn(InternalTestApi::class, ExperimentalTestApi::class, InternalComposeUiApi::class)
48+
actual fun createComposeRule(): ComposeContentTestRule {
49+
return DesktopComposeTestRule(
5050
DesktopComposeUiTest(
5151
effectContext = EmptyCoroutineContext,
5252
useStandardTestDispatcherForComposition = false
5353
)
5454
)
55+
}
5556

5657
@Deprecated(
5758
message =
@@ -61,14 +62,15 @@ actual fun createComposeRule(): ComposeContentTestRule =
6162
level = DeprecationLevel.WARNING,
6263
)
6364
@ExperimentalTestApi
64-
@OptIn(InternalTestApi::class)
65-
actual fun createComposeRule(effectContext: CoroutineContext): ComposeContentTestRule =
66-
DesktopComposeTestRule(
65+
@OptIn(InternalTestApi::class, InternalComposeUiApi::class)
66+
actual fun createComposeRule(effectContext: CoroutineContext): ComposeContentTestRule {
67+
return DesktopComposeTestRule(
6768
DesktopComposeUiTest(
6869
effectContext = effectContext,
6970
useStandardTestDispatcherForComposition = false
7071
)
7172
)
73+
}
7274

7375
@InternalTestApi
7476
@OptIn(ExperimentalTestApi::class)

0 commit comments

Comments
 (0)