File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
ui/kotlinx-coroutines-javafx/test Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -11,19 +11,28 @@ import org.junit.Test
11
11
import kotlin.test.*
12
12
13
13
class JavaFxTest : TestBase () {
14
+
15
+ companion object {
16
+ val fxEnabled: Boolean = try {
17
+ initPlatform()
18
+ true
19
+ } catch (e: Throwable ) {
20
+ println (" Skipping JavaFxTest in headless environment" )
21
+ false
22
+ }
23
+
24
+ }
25
+
14
26
@Before
15
27
fun setup () {
16
28
ignoreLostThreads(" JavaFX Application Thread" , " Thread-" , " QuantumRenderer-" )
17
29
}
18
30
19
31
@Test
20
32
fun testDelay () {
21
- try {
22
- initPlatform()
23
- } catch (e: UnsupportedOperationException ) {
24
- println (" Skipping JavaFxTest in headless environment" )
25
- return // ignore test in headless environments
26
- }
33
+ if (! fxEnabled) {
34
+ return // ignore test in headless environments
35
+ }
27
36
28
37
runBlocking {
29
38
expect(1 )
@@ -41,10 +50,7 @@ class JavaFxTest : TestBase() {
41
50
42
51
@Test
43
52
fun testRunBlockingForbidden () {
44
- try {
45
- initPlatform()
46
- } catch (e: UnsupportedOperationException ) {
47
- println (" Skipping JavaFxTest in headless environment" )
53
+ if (! fxEnabled) {
48
54
return // ignore test in headless environments
49
55
}
50
56
You can’t perform that action at this time.
0 commit comments