X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fgui%2FQuitHandlerTest.java;h=42df90e9cf6aa025ead220b79eac99d08fa38f42;hb=58827f5ad6ff27d76c20c1aba96cd3b4a200a691;hp=a8a7f08a40431146fae94dc82f2561c72d5e42b3;hpb=f205bfec471719e5735229689cab62e9b675ee2a;p=jalview.git diff --git a/test/jalview/gui/QuitHandlerTest.java b/test/jalview/gui/QuitHandlerTest.java index a8a7f08..42df90e 100644 --- a/test/jalview/gui/QuitHandlerTest.java +++ b/test/jalview/gui/QuitHandlerTest.java @@ -66,9 +66,12 @@ public class QuitHandlerTest // reset mock response JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); // close desktop windows/frames - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); // reset debug delay Jalview2XML.setDebugDelaySave(20); + // load normal testprops + Cache.loadProperties("test/jalview/testProps.jvprops"); } @BeforeMethod(alwaysRun = true) @@ -79,7 +82,8 @@ public class QuitHandlerTest // reset mock response JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); // close desktop windows/frames - Desktop.instance.closeAll_actionPerformed(null); + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); // reset debug delay Cache.setProperty("DEBUG_DELAY_SAVE", "false"); Jalview2XML.setDebugDelaySave(3); @@ -126,7 +130,6 @@ public class QuitHandlerTest Assert.assertTrue(end - start < 500, "Quit-with-no-save-needed took too long (" + (end - start) + "ms)"); - Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }, singleThreaded = true, priority = 10) @@ -154,8 +157,6 @@ public class QuitHandlerTest Assert.assertEquals(response, QResponse.QUIT); Assert.assertTrue(end - start > 2900, "Quit-whilst-saving was too short (" + (end - start) + "ms)"); - - Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }, singleThreaded = true, priority = 9) @@ -174,8 +175,6 @@ public class QuitHandlerTest Cache.setProperty("DEBUG_DELAY_SAVE", "false"); af.saveAlignment(saveProjectFile, FileFormat.Jalview); - Thread.sleep(1000); // give time for file to save - // this is only a two button dialog [Quit] [Cancel] so use NO_OPTION (to // mean [CANCEL] -- file should already be saved so this doesn't happen and // we get a QUIT response) @@ -184,7 +183,6 @@ public class QuitHandlerTest // if not saved this would be CANCEL_QUIT Assert.assertEquals(response, QResponse.QUIT); - Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }, singleThreaded = true, priority = 9) @@ -209,7 +207,6 @@ public class QuitHandlerTest // if not saved this would be CANCEL_QUIT Assert.assertEquals(response, QResponse.QUIT); - Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }, singleThreaded = true, priority = 1) @@ -229,7 +226,6 @@ public class QuitHandlerTest QResponse response = QuitHandler.getQuitResponse(true); Assert.assertEquals(response, QResponse.CANCEL_QUIT); - Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }, singleThreaded = true, priority = 1) @@ -257,7 +253,6 @@ public class QuitHandlerTest QResponse response = QuitHandler.getQuitResponse(false); Assert.assertEquals(response, QResponse.QUIT); - Desktop.instance.closeAll_actionPerformed(null); } @Test(groups = { "Functional" }, singleThreaded = true, priority = 11) @@ -300,7 +295,6 @@ public class QuitHandlerTest "Force-Quit-whilst-saving was too long (" + (end - start) + "ms)"); - Desktop.instance.closeAll_actionPerformed(null); } }