JAL-4342 test and patch checking annotation csv export contains the annotations on...
[jalview.git] / test / jalview / gui / QuitHandlerTest.java
index b257088..b148d0b 100644 (file)
@@ -1,3 +1,23 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
 package jalview.gui;
 
 import static org.testng.Assert.assertNotNull;
@@ -55,7 +75,7 @@ public class QuitHandlerTest
 
     Jalview.main(
             new String[]
-            { "-nowebservicediscovery", "-nosplash", "-nonews" });
+            { "--nowebservicediscovery", "--nosplash", "--nonews" });
   }
 
   @AfterClass(alwaysRun = true)
@@ -66,9 +86,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 +102,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 +150,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 +177,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)
@@ -182,7 +203,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)
@@ -207,7 +227,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)
@@ -227,7 +246,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)
@@ -255,7 +273,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)
@@ -284,7 +301,6 @@ public class QuitHandlerTest
               jalview.bin.Console.debug(
                       "Setting FORCE_QUIT without actually quitting");
               QuitHandler.setResponse(QResponse.FORCE_QUIT);
-              return null;
             }, QuitHandler.defaultCancelQuit);
     long end = System.currentTimeMillis();
 
@@ -298,7 +314,6 @@ public class QuitHandlerTest
             "Force-Quit-whilst-saving was too long (" + (end - start)
                     + "ms)");
 
-    Desktop.instance.closeAll_actionPerformed(null);
   }
 
 }