mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-11-19 01:52:29 +01:00
Dispose a leftover wizard dialog when a window test fails
Written-by: DeepSeek V4 Pro Written-by: Claude Fable 5.2
This commit is contained in:
1 file changed
+9
@@ -26,6 +26,13 @@ class SetupWizardWindowTest {
|
|||||||
private fun showingDialog(): Window? =
|
private fun showingDialog(): Window? =
|
||||||
Window.getWindows().firstOrNull { it.isShowing && it.javaClass.name.contains("ComposeDialog") }
|
Window.getWindows().firstOrNull { it.isShowing && it.javaClass.name.contains("ComposeDialog") }
|
||||||
|
|
||||||
|
/** Removes whatever dialog this test still has showing, without waiting and without failing again. */
|
||||||
|
private fun disposeLeftoverDialog() {
|
||||||
|
EventQueue.invokeLater {
|
||||||
|
showingDialog()?.dispose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private val closer = Executors.newSingleThreadExecutor()
|
private val closer = Executors.newSingleThreadExecutor()
|
||||||
|
|
||||||
/** Closes the dialog the way its X does, as soon as it is on screen. */
|
/** Closes the dialog the way its X does, as soon as it is on screen. */
|
||||||
@@ -57,6 +64,7 @@ class SetupWizardWindowTest {
|
|||||||
assertEquals("", prefs.getStn_loginCallSign(), "closing the window wrote something")
|
assertEquals("", prefs.getStn_loginCallSign(), "closing the window wrote something")
|
||||||
closing.get(1, TimeUnit.SECONDS)
|
closing.get(1, TimeUnit.SECONDS)
|
||||||
} finally {
|
} finally {
|
||||||
|
disposeLeftoverDialog()
|
||||||
worker.shutdownNow()
|
worker.shutdownNow()
|
||||||
closer.shutdownNow()
|
closer.shutdownNow()
|
||||||
}
|
}
|
||||||
@@ -78,6 +86,7 @@ class SetupWizardWindowTest {
|
|||||||
call.get(20, TimeUnit.SECONDS)
|
call.get(20, TimeUnit.SECONDS)
|
||||||
closing.get(1, TimeUnit.SECONDS)
|
closing.get(1, TimeUnit.SECONDS)
|
||||||
} finally {
|
} finally {
|
||||||
|
disposeLeftoverDialog()
|
||||||
worker.shutdownNow()
|
worker.shutdownNow()
|
||||||
closer.shutdownNow()
|
closer.shutdownNow()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user