jalview.bin.Console.debug(Cache.getStackTraceString(e));
}
}
+
+ /**
+ * closes the current instance window, disposes and forgets about it.
+ */
+ public static void closeDesktop()
+ {
+ if (Desktop.instance != null) {
+ Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.instance.setVisible(false);
+ Desktop.instance.dispose();
+ Desktop.instance = null;
+ }
+ }
}
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- if (Desktop.instance != null)
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.closeDesktop();
+ }
+
+ public static void callJalviewMain(String[] args) {
+ if (Jalview.getInstance()!=null) {
+ Jalview.getInstance().doMain(args);
+ } else {
+ Jalview.main(args);
+ }
}
/* --setprops is currently disabled so this test won't work
int numFrames, String[] sequences)
{
String[] args = (cmdLine + " --gui").split("\\s+");
- Jalview.main(args);
+ callJalviewMain(args);
Commands cmds = Jalview.getInstance().getCommands();
Assert.assertNotNull(cmds);
Assert.assertEquals(cmds.commandArgsProvided(), cmdArgs,
{
cleanupFiles(filenames);
String[] args = (cmdLine + " --gui").split("\\s+");
- Jalview.main(args);
+ callJalviewMain(args);
Commands cmds = Jalview.getInstance().getCommands();
Assert.assertNotNull(cmds);
File lastFile = null;
{
cleanupFiles(filenames);
String[] args = (cmdLine + " --gui").split("\\s+");
- Jalview.main(args);
+ callJalviewMain(args);
Commands cmds = Jalview.getInstance().getCommands();
Assert.assertNotNull(cmds);
File lastFile = null;
String[] nonfilenames)
{
String[] args = (cmdLine + " --gui").split("\\s+");
- Jalview.main(args);
+ callJalviewMain(args);
Commands cmds = Jalview.getInstance().getCommands();
Assert.assertNotNull(cmds);
for (String filename : filenames)
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- if (Desktop.instance != null)
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.closeDesktop();
}
@Test(
{
String[] args = cmdLine.split("\\s+");
- Jalview.main(args);
+ CommandsTest.callJalviewMain(args);
try
{
// sleep for slow build server to open annotations and viewer windows