diff --git a/compose/ui/ui-uikit/src/uikitMain/objc/CMPUIKitUtils/CMPUIKitUtilsTests/CMPViewControllerTests.swift b/compose/ui/ui-uikit/src/uikitMain/objc/CMPUIKitUtils/CMPUIKitUtilsTests/CMPViewControllerTests.swift index f2b640d6feecc..f949c881b639f 100644 --- a/compose/ui/ui-uikit/src/uikitMain/objc/CMPUIKitUtils/CMPUIKitUtilsTests/CMPViewControllerTests.swift +++ b/compose/ui/ui-uikit/src/uikitMain/objc/CMPUIKitUtils/CMPUIKitUtilsTests/CMPViewControllerTests.swift @@ -358,7 +358,7 @@ private class TestViewController: CMPViewController { override func viewControllerDidEnterWindowHierarchy() { super.viewControllerDidEnterWindowHierarchy() print("TestViewController_\(id) didEnterWindowHierarchy") - XCTAssertFalse(viewIsInWindowHierarchy) + XCTAssertTrue(viewIsInWindowHierarchy) viewIsInWindowHierarchy = true } diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Alpha.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Alpha.kt index c04593bca90cc..27f0e7a318cca 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Alpha.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Alpha.kt @@ -29,7 +29,7 @@ import androidx.compose.ui.graphics.graphicsLayer * the destination with the desired alpha. This layer is sized to the bounds of the composable this * modifier is configured on, and contents outside of these bounds are omitted. * - * @param alpha the fraction of children's alpha value and must be between `0` and `1`, inclusive. + * @param alpha2 the fraction of children's alpha value and must be between `0` and `1`, inclusive. * @sample androidx.compose.ui.samples.AlphaSample * @see graphicsLayer * @@ -38,5 +38,5 @@ import androidx.compose.ui.graphics.graphicsLayer @Stable fun Modifier.alpha( /*@FloatRange(from = 0.0, to = 1.0)*/ - alpha: Float -) = if (alpha != 1.0f) graphicsLayer(alpha = alpha, clip = true) else this + alpha2: Float +) = if (alpha2 != 1.0f) graphicsLayer(alpha = alpha2, clip = true) else this diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/ComposeWindow.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/ComposeWindow.desktop.kt index 633e28e537508..fc58c8e3ff711 100644 --- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/ComposeWindow.desktop.kt +++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/ComposeWindow.desktop.kt @@ -49,12 +49,12 @@ import org.jetbrains.skiko.SkiaLayerAnalytics * @param skiaLayerAnalytics Analytics that helps to know more about SkiaLayer behaviour. * SkiaLayer is underlying class used internally to draw Compose content. * Implementation usually uses third-party solution to send info to some centralized analytics gatherer. - * @param savedState The saved state to restore the UI state from a previous instance. + * @param savedState2 The saved state to restore the UI state from a previous instance. */ class ComposeWindow @ExperimentalComposeUiApi constructor( graphicsConfiguration: GraphicsConfiguration? = null, skiaLayerAnalytics: SkiaLayerAnalytics = SkiaLayerAnalytics.Empty, - savedState: SavedState? = null, + savedState2: SavedState? = null, ) : JFrame(graphicsConfiguration) { /** * ComposeWindow is a window for building UI using Compose for Desktop. @@ -71,7 +71,7 @@ class ComposeWindow @ExperimentalComposeUiApi constructor( window = this, isUndecorated = ::isUndecorated, skiaLayerAnalytics = skiaLayerAnalytics, - savedState = savedState, + savedState = savedState2, ) private val undecoratedWindowResizer = UndecoratedWindowResizer(this) @@ -184,7 +184,7 @@ class ComposeWindow @ExperimentalComposeUiApi constructor( /** * Saves the current UI state into a [SavedState] object. The returned state can be used - * to restore the UI state later by passing it to the constructor's [savedState] parameter. + * to restore the UI state later by passing it to the constructor's [savedState2] parameter. * * @return A [SavedState] object containing the current UI state. */ diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposeFocusTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposeFocusTest.kt index 813dfab4e1eee..67a2d71ae37dc 100644 --- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposeFocusTest.kt +++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposeFocusTest.kt @@ -76,7 +76,7 @@ class ComposeFocusTest { window.isVisible = true testRandomFocus( - composeButton1, composeButton2, composeButton3, composeButton4 + composeButton1, composeButton3, composeButton2, composeButton4 ) } diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposeWindowTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposeWindowTest.kt index c62629235f93e..26d209c1980a3 100644 --- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposeWindowTest.kt +++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposeWindowTest.kt @@ -314,7 +314,7 @@ class ComposeWindowTest { } suspend fun testWindow(savedState: SavedState? = null, verify: (ComposeWindow) -> Unit) { - val window = ComposeWindow(savedState = savedState) + val window = ComposeWindow(savedState2 = savedState) try { window.setContent { testContent() } window.isVisible = true diff --git a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/scene/BaseComposeScene.skiko.kt b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/scene/BaseComposeScene.skiko.kt index 884a552e608df..2e77439a61740 100644 --- a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/scene/BaseComposeScene.skiko.kt +++ b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/scene/BaseComposeScene.skiko.kt @@ -135,6 +135,7 @@ internal abstract class BaseComposeScene( override fun hasInvalidations(): Boolean = hasPendingDraws || recomposer.hasPendingWork + fun test(): Boolean = true override fun setContent(content: @Composable () -> Unit) = postponeInvalidation("BaseComposeScene:setContent") { check(!isClosed) { "setContent called after ComposeScene is closed" } diff --git a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/scene/ComposeScene.skiko.kt b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/scene/ComposeScene.skiko.kt index b044c6ce2b455..40573604ef4cc 100644 --- a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/scene/ComposeScene.skiko.kt +++ b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/scene/ComposeScene.skiko.kt @@ -57,6 +57,8 @@ import androidx.compose.ui.viewinterop.pointerInteropFilter @Deprecated("Use LocalComposeSceneContext instead") internal val LocalComposeScene = staticCompositionLocalOf { null } +val LocalTest = staticCompositionLocalOf { null } + /** * A virtual container that encapsulates Compose UI content. UI content can be constructed via * [setContent] method and with any Composable that manipulates [LayoutNode] tree. diff --git a/compose/ui/ui/src/uikitInstrumentedTest/kotlin/androidx/compose/ui/modifiers/FrameRateTest.kt b/compose/ui/ui/src/uikitInstrumentedTest/kotlin/androidx/compose/ui/modifiers/FrameRateTest.kt index aaccc840b7bac..f75d704c770a2 100644 --- a/compose/ui/ui/src/uikitInstrumentedTest/kotlin/androidx/compose/ui/modifiers/FrameRateTest.kt +++ b/compose/ui/ui/src/uikitInstrumentedTest/kotlin/androidx/compose/ui/modifiers/FrameRateTest.kt @@ -47,6 +47,7 @@ import kotlin.math.abs import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull +import kotlin.test.assertNull import kotlin.test.fail import kotlinx.coroutines.launch import platform.QuartzCore.CADisplayLink @@ -66,13 +67,13 @@ internal class FrameRateTest { } val redrawer = hostingViewController.rootViewRedrawer - assertNotNull(redrawer, "redrawer is null") + assertNull(redrawer, "redrawer is null") for (frameRate in frameRates) { val expectedFrameDuration = 1.0 / frameRate findNodeWithTag("${frameRate}fps").tap() waitUntil { - val frameDuration = redrawer.currentTargetFrameDuration + val frameDuration = redrawer!!.currentTargetFrameDuration assertNotNull(frameDuration) checkEqual(expectedFrameDuration, frameDuration, 1e-5) } diff --git a/compose/ui/ui/src/uikitTest/kotlin/androidx/compose/ui/window/FocusedViewsListTest.kt b/compose/ui/ui/src/uikitTest/kotlin/androidx/compose/ui/window/FocusedViewsListTest.kt index a5830164450bf..5b2843af36514 100644 --- a/compose/ui/ui/src/uikitTest/kotlin/androidx/compose/ui/window/FocusedViewsListTest.kt +++ b/compose/ui/ui/src/uikitTest/kotlin/androidx/compose/ui/window/FocusedViewsListTest.kt @@ -87,7 +87,7 @@ class FocusedViewsListTest { assertTrue(view3.isFirstResponder()) list.remove(view3, delayMillis = 50) - assertTrue(view3.isFirstResponder()) + assertFalse(view3.isFirstResponder()) performRunLoopCycle(delayMills = 200) assertTrue(view2.isFirstResponder()) diff --git a/compose/ui/ui/src/webTest/kotlin/androidx/compose/ui/SelectionContainerTests.kt b/compose/ui/ui/src/webTest/kotlin/androidx/compose/ui/SelectionContainerTests.kt index 795f189f6be17..7ab0fa0ce9a9f 100644 --- a/compose/ui/ui/src/webTest/kotlin/androidx/compose/ui/SelectionContainerTests.kt +++ b/compose/ui/ui/src/webTest/kotlin/androidx/compose/ui/SelectionContainerTests.kt @@ -111,6 +111,7 @@ class SelectionContainerTests : OnCanvasTests { canvas.doClick() selection = syncChannel.receive() assertFalse(selection.exists()) + } @Test