aboutsummaryrefslogtreecommitdiffstats
path: root/ui/kotlinx-coroutines-javafx/test
diff options
context:
space:
mode:
Diffstat (limited to 'ui/kotlinx-coroutines-javafx/test')
-rw-r--r--ui/kotlinx-coroutines-javafx/test/JavaFxObservableAsFlowTest.kt16
-rw-r--r--ui/kotlinx-coroutines-javafx/test/guide/example-ui-actor-02.kt2
-rw-r--r--ui/kotlinx-coroutines-javafx/test/guide/example-ui-actor-03.kt4
-rw-r--r--ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-01.kt2
-rw-r--r--ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-02.kt2
-rw-r--r--ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-03.kt2
6 files changed, 22 insertions, 6 deletions
diff --git a/ui/kotlinx-coroutines-javafx/test/JavaFxObservableAsFlowTest.kt b/ui/kotlinx-coroutines-javafx/test/JavaFxObservableAsFlowTest.kt
index 69640501..bc40b0fd 100644
--- a/ui/kotlinx-coroutines-javafx/test/JavaFxObservableAsFlowTest.kt
+++ b/ui/kotlinx-coroutines-javafx/test/JavaFxObservableAsFlowTest.kt
@@ -83,4 +83,20 @@ class JavaFxObservableAsFlowTest : TestBase() {
}
}
+ @Test
+ fun testIntermediateCrash() = runTest {
+ if (!initPlatform()) {
+ println("Skipping JavaFxTest in headless environment")
+ return@runTest // ignore test in headless environments
+ }
+
+ val property = SimpleIntegerProperty(0)
+
+ assertFailsWith<TestException> {
+ property.asFlow().onEach {
+ yield()
+ throw TestException()
+ }.collect()
+ }
+ }
}
diff --git a/ui/kotlinx-coroutines-javafx/test/guide/example-ui-actor-02.kt b/ui/kotlinx-coroutines-javafx/test/guide/example-ui-actor-02.kt
index 51e94779..ec8a09f9 100644
--- a/ui/kotlinx-coroutines-javafx/test/guide/example-ui-actor-02.kt
+++ b/ui/kotlinx-coroutines-javafx/test/guide/example-ui-actor-02.kt
@@ -67,6 +67,6 @@ fun Node.onClick(action: suspend (MouseEvent) -> Unit) {
}
// install a listener to offer events to this actor
onMouseClicked = EventHandler { event ->
- eventActor.offer(event)
+ eventActor.trySend(event)
}
}
diff --git a/ui/kotlinx-coroutines-javafx/test/guide/example-ui-actor-03.kt b/ui/kotlinx-coroutines-javafx/test/guide/example-ui-actor-03.kt
index 81371678..aa152b79 100644
--- a/ui/kotlinx-coroutines-javafx/test/guide/example-ui-actor-03.kt
+++ b/ui/kotlinx-coroutines-javafx/test/guide/example-ui-actor-03.kt
@@ -65,8 +65,8 @@ fun Node.onClick(action: suspend (MouseEvent) -> Unit) {
val eventActor = GlobalScope.actor<MouseEvent>(Dispatchers.Main, capacity = Channel.CONFLATED) { // <--- Changed here
for (event in channel) action(event) // pass event to action
}
- // install a listener to offer events to this actor
+ // install a listener to send events to this actor
onMouseClicked = EventHandler { event ->
- eventActor.offer(event)
+ eventActor.trySend(event)
}
}
diff --git a/ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-01.kt b/ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-01.kt
index ea5ac90a..0c89ea70 100644
--- a/ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-01.kt
+++ b/ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-01.kt
@@ -55,7 +55,7 @@ fun Node.onClick(action: suspend (MouseEvent) -> Unit) {
for (event in channel) action(event) // pass event to action
}
onMouseClicked = EventHandler { event ->
- eventActor.offer(event)
+ eventActor.trySend(event)
}
}
diff --git a/ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-02.kt b/ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-02.kt
index 504f2ee6..6e8b984a 100644
--- a/ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-02.kt
+++ b/ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-02.kt
@@ -55,7 +55,7 @@ fun Node.onClick(action: suspend (MouseEvent) -> Unit) {
for (event in channel) action(event) // pass event to action
}
onMouseClicked = EventHandler { event ->
- eventActor.offer(event)
+ eventActor.trySend(event)
}
}
diff --git a/ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-03.kt b/ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-03.kt
index 0e115367..3ff5d7d5 100644
--- a/ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-03.kt
+++ b/ui/kotlinx-coroutines-javafx/test/guide/example-ui-blocking-03.kt
@@ -55,7 +55,7 @@ fun Node.onClick(action: suspend (MouseEvent) -> Unit) {
for (event in channel) action(event) // pass event to action
}
onMouseClicked = EventHandler { event ->
- eventActor.offer(event)
+ eventActor.trySend(event)
}
}