Comments (6)
Does it work without Koin? Without resources?
from compose-multiplatform.
That's a very good question... No, it also fails with the exact same error. However, in Android it crashes because at some point the Koin Graph is needed to get the injections. Which leads me to think that something else is happening and my iOS' MainViewController
is not being rendered.
$ gradle shared:connectedAndroidTest
java.lang.IllegalStateException: KoinApplication has not been started
at org.koin.core.context.GlobalContext.get(GlobalContext.kt:36)
at org.koin.compose.KoinApplicationKt.getKoinContext(KoinApplication.kt:52)
at org.koin.compose.KoinApplicationKt.access$getKoinContext(KoinApplication.kt:1)
The sample code runs fine even with Koin and resources, though:
@BeforeTest
fun setup() {
initKoin(appModule = module)
}
@AfterTest
fun tearDown() {
stopKoin()
}
@Test
fun test_titleChangesWhenBottomIconIsSelected() = uiTest {
val title = resourcesProvider.getString(HomeSection.Tasks.title.desc())
setContent {
var text by remember { mutableStateOf(title) }
Text(
text = text,
modifier = Modifier.testTag("text")
)
Button(
onClick = { text = "Compose" },
modifier = Modifier.testTag("button")
) {
Text("Click me")
}
}
onNodeWithTag("text").assertTextEquals(title)
onNodeWithTag("button").performClick()
onNodeWithTag("text").assertTextEquals("Compose")
}
from compose-multiplatform.
Wait, the testing framework only works with Compose UI. It won't work with native elements such as UIViewController.
from compose-multiplatform.
But if I update the coding to directly call the AlkaaMultiplatformApp()
directly in iOS, I face the following issue:
kotlin.IllegalStateException: CompositionLocal UIViewController not provided
That's my iOS's MainViewController
:
@OptIn(ExperimentalComposeApi::class)
@Suppress("Unused", "FunctionName")
fun MainViewController(): UIViewController = ComposeUIViewController(
configure = {
accessibilitySyncOptions = AccessibilitySyncOptions.Always(AccessibilityDebugLoggerImpl())
},
) {
AlkaaMultiplatformApp()
}
Is there a way to use it directly and provide this custom CompositionLocal
?
from compose-multiplatform.
You need to remove the direct dependency on UIViewController from the code you're trying to test.
from compose-multiplatform.
Got it. The reason was the WindowSizeClass
inside my AppState
class. Removing caused another problems with UNUserNotificationCenter.currentNotificationCenter()
but definitely not related to ComposeUIViewController
as I reported. Thank you for the help!
from compose-multiplatform.
Related Issues (20)
- Compose 1.6.2 iOS ComposeContainer memory leak HOT 2
- ComposeUIViewController don't Update View HOT 2
- TextField cannot input in ExposedDropdownMenuBox, when ExposedDropdownMenu is expanded HOT 4
- 🚀 Low-code tools to speed up and ease app development HOT 1
- java.lang.SecurityException: SHA-256 digest error for org/bouncycastle/operator/OperatorCreationException.class HOT 3
- [IOS-Simulator] TextField Text Cursor Jumps Around After Using CMD+A then Delete to clear all text preventing further text input.
- Using `ComposeScene`s with anything but `MainUIDispatcher` results in a deadlock HOT 19
- Generate XCFramework with UI, resources and dependencies HOT 2
- Remove compose ui fallback from LocalViewModelStoreOwner HOT 3
- Kotlin/Wasm responsive layout HOT 7
- Support text hyphenation HOT 1
- How to monitor finger position like touch_down\touch_move on Android platform?
- Brush.linearGradient don't work HOT 1
- Order of accessibility nodes is wrong HOT 2
- When targeting Android for a KMP project using `Coil 3.0.0-alpha06`, attempting to use `.toBitmap()` and `.asComposeImageBitmap()` results in `Unresolved reference` HOT 2
- Consider removing `Unconfined` dispatcher as default `CoroutineContext` for `ComposeScene` creation HOT 1
- Consider adding a boolean to disable `GlobalSnapshotManager.ensureStarted()` call during scene creation
- PressInteraction.Cancel is sent on mouse press and drag outside surface HOT 1
- Are there any good suggestions about using compose to generate UI through drag and drop and output the code to the local? HOT 5
- Erratic window focus behavior HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compose-multiplatform.