@@ -5,6 +5,7 @@ import javafx.scene.control.TextField
55import kotlinx.coroutines.CoroutineScope
66import kotlinx.coroutines.Dispatchers
77import kotlinx.coroutines.SupervisorJob
8+ import kotlinx.coroutines.cancel
89import kotlinx.coroutines.javafx.JavaFx
910import kotlinx.coroutines.launch
1011import kotlinx.coroutines.withContext
@@ -13,19 +14,24 @@ import org.junit.jupiter.api.Test
1314class PropertySheetTest {
1415 private val coroutineScope = CoroutineScope (SupervisorJob ())
1516
16- fun `basic string property` () {
17+ @Test fun `basic string property` () {
1718 coroutineScope.launch {
18- withContext(Dispatchers .JavaFx ) {
19- val propertyPaneBuilder = PropertyPaneBuilder (DummyLocalizer , PropertyPane ())
20- val textProperty = ObservableString (" prop1" , " Lorem Ipsum" )
21- val editor = propertyPaneBuilder.createStringOptionEditor(textProperty)
22- (editor as ? TextField )?.let {
23- it.text = " Hello"
24- assert (textProperty.value == " Hello" )
19+ try {
20+ withContext(Dispatchers .JavaFx ) {
21+ val propertyPaneBuilder = PropertyPaneBuilder (DummyLocalizer , PropertyPane ())
22+ val textProperty = ObservableString (" prop1" , " Lorem Ipsum" )
23+ val editor = propertyPaneBuilder.createStringOptionEditor(textProperty)
24+ (editor as ? TextField )?.let {
25+ it.text = " Hello"
26+ assert (textProperty.value == " Hello" )
2527
26- textProperty.value = " Hello2"
27- assert (it.text == " Hello2" )
28+ textProperty.value = " Hello2"
29+ assert (it.text == " Hello2" )
30+ }
2831 }
32+ } catch (ex: Exception ) {
33+ ex.printStackTrace()
34+ this .cancel()
2935 }
3036 }
3137 }
0 commit comments