1 /* 2 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 package kotlinx.coroutines.javafx 6 7 import javafx.application.* 8 import kotlinx.coroutines.* 9 import org.junit.* 10 11 class JavaFxTest : TestBase() { 12 @Before setupnull13 fun setup() { 14 ignoreLostThreads("JavaFX Application Thread", "Thread-", "QuantumRenderer-", "InvokeLaterDispatcher") 15 } 16 17 @Test testDelaynull18 fun testDelay() { 19 if (!initPlatform()) { 20 println("Skipping JavaFxTest in headless environment") 21 return // ignore test in headless environments 22 } 23 24 runBlocking { 25 expect(1) 26 val job = launch(Dispatchers.JavaFx) { 27 check(Platform.isFxApplicationThread()) 28 expect(2) 29 delay(100) 30 check(Platform.isFxApplicationThread()) 31 expect(3) 32 } 33 job.join() 34 finish(4) 35 } 36 } 37 }