Oleksandr Karpovich
1 year ago
committed by
GitHub
9 changed files with 120 additions and 3 deletions
@ -0,0 +1,39 @@
|
||||
plugins { |
||||
kotlin("multiplatform") |
||||
id("org.jetbrains.compose") |
||||
} |
||||
|
||||
kotlin { |
||||
configureTargets() |
||||
|
||||
sourceSets { |
||||
val commonMain by getting { |
||||
dependencies { |
||||
implementation(compose.runtime) |
||||
implementation(getCommonLib()) |
||||
} |
||||
} |
||||
val commonTest by getting { |
||||
configureCommonTestDependencies() |
||||
} |
||||
|
||||
val nativeMain by creating { |
||||
dependsOn(commonMain) |
||||
} |
||||
val iosMain by getting { |
||||
dependsOn(nativeMain) |
||||
} |
||||
val linuxX64Main by getting { |
||||
dependsOn(nativeMain) |
||||
} |
||||
val macosX64Main by getting { |
||||
dependsOn(nativeMain) |
||||
} |
||||
val macosArm64Main by getting { |
||||
dependsOn(nativeMain) |
||||
} |
||||
val mingwX64Main by getting { |
||||
dependsOn(nativeMain) |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,10 @@
|
||||
import androidx.compose.runtime.Composable |
||||
|
||||
class Abc |
||||
|
||||
|
||||
val Abc.commonIntVal: Int |
||||
@Composable get() = 1000 |
||||
|
||||
expect val Abc.composableIntVal: Int |
||||
@Composable get |
@ -0,0 +1,4 @@
|
||||
import androidx.compose.runtime.Composable |
||||
|
||||
actual val Abc.composableIntVal: Int |
||||
@Composable get () = 100 |
@ -0,0 +1,4 @@
|
||||
import androidx.compose.runtime.Composable |
||||
|
||||
actual val Abc.composableIntVal: Int |
||||
@Composable get () = 100 |
@ -0,0 +1,4 @@
|
||||
import androidx.compose.runtime.Composable |
||||
|
||||
actual val Abc.composableIntVal: Int |
||||
@Composable get () = 100 |
@ -0,0 +1,21 @@
|
||||
plugins { |
||||
kotlin("multiplatform") |
||||
id("org.jetbrains.compose") |
||||
} |
||||
|
||||
kotlin { |
||||
configureTargets() |
||||
|
||||
sourceSets { |
||||
val commonMain by getting { |
||||
dependencies { |
||||
implementation(compose.runtime) |
||||
implementation(getCommonLib()) |
||||
implementation(getLibDependencyForMain()) |
||||
} |
||||
} |
||||
val commonTest by getting { |
||||
configureCommonTestDependencies() |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,32 @@
|
||||
import com.example.common.TextLeafNode |
||||
import com.example.common.composeText |
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi |
||||
import kotlinx.coroutines.test.runTest |
||||
import kotlin.test.Test |
||||
import kotlin.test.assertEquals |
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class) |
||||
class Tests { |
||||
|
||||
@Test |
||||
// K/JS fails. Related: https://github.com/JetBrains/compose-multiplatform/issues/3373 |
||||
fun composableExpectActualValGetter() = runTest { |
||||
val root = composeText { |
||||
val v = Abc().composableIntVal |
||||
TextLeafNode("$v") |
||||
} |
||||
|
||||
assertEquals("root:{100}", root.dump()) |
||||
} |
||||
|
||||
@Test |
||||
fun commonComposableValGetter() = runTest { |
||||
val root = composeText { |
||||
val v = Abc().commonIntVal |
||||
TextLeafNode("$v") |
||||
} |
||||
|
||||
assertEquals("root:{1000}", root.dump()) |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue