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
1111import kotlin.test.*
1212
1313class 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+
1426 @Before
1527 fun setup () {
1628 ignoreLostThreads(" JavaFX Application Thread" , " Thread-" , " QuantumRenderer-" )
1729 }
1830
1931 @Test
2032 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+ }
2736
2837 runBlocking {
2938 expect(1 )
@@ -41,10 +50,7 @@ class JavaFxTest : TestBase() {
4150
4251 @Test
4352 fun testRunBlockingForbidden () {
44- try {
45- initPlatform()
46- } catch (e: UnsupportedOperationException ) {
47- println (" Skipping JavaFxTest in headless environment" )
53+ if (! fxEnabled) {
4854 return // ignore test in headless environments
4955 }
5056
You can’t perform that action at this time.
0 commit comments