Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ private class TestViewController: CMPViewController {
override func viewControllerDidEnterWindowHierarchy() {
super.viewControllerDidEnterWindowHierarchy()
print("TestViewController_\(id) didEnterWindowHierarchy")
XCTAssertFalse(viewIsInWindowHierarchy)
XCTAssertTrue(viewIsInWindowHierarchy)
viewIsInWindowHierarchy = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -71,7 +71,7 @@ class ComposeWindow @ExperimentalComposeUiApi constructor(
window = this,
isUndecorated = ::isUndecorated,
skiaLayerAnalytics = skiaLayerAnalytics,
savedState = savedState,
savedState = savedState2,
)
private val undecoratedWindowResizer = UndecoratedWindowResizer(this)

Expand Down Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class ComposeFocusTest {
window.isVisible = true

testRandomFocus(
composeButton1, composeButton2, composeButton3, composeButton4
composeButton1, composeButton3, composeButton2, composeButton4
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ import androidx.compose.ui.viewinterop.pointerInteropFilter
@Deprecated("Use LocalComposeSceneContext instead")
internal val LocalComposeScene = staticCompositionLocalOf<ComposeScene?> { null }

val LocalTest = staticCompositionLocalOf<ComposeScene?> { 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class SelectionContainerTests : OnCanvasTests {
canvas.doClick()
selection = syncChannel.receive()
assertFalse(selection.exists())

}

@Test
Expand Down
Loading