X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fbin%2FCommandsTest.java;h=61892dfbe8738cfdfa085d55849ad5ea3e3562c2;hb=9476b459d78a974bdb525600ada55d9f3ebde8f1;hp=7ed1ea38d7f8d4e728d802310b5593931a19eeb3;hpb=1d1edb58c9ee8baec12686a512eb18d97b9bdba1;p=jalview.git diff --git a/test/jalview/bin/CommandsTest.java b/test/jalview/bin/CommandsTest.java index 7ed1ea3..61892df 100644 --- a/test/jalview/bin/CommandsTest.java +++ b/test/jalview/bin/CommandsTest.java @@ -49,8 +49,15 @@ public class CommandsTest @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 @@ -70,8 +77,8 @@ public class CommandsTest public void commandsOpenTest(String cmdLine, boolean cmdArgs, int numFrames, String[] sequences) { - String[] args = cmdLine.split("\\s+"); - Jalview.main(args); + String[] args = (cmdLine + " --gui").split("\\s+"); + callJalviewMain(args); Commands cmds = Jalview.getInstance().getCommands(); Assert.assertNotNull(cmds); Assert.assertEquals(cmds.commandArgsProvided(), cmdArgs, @@ -110,8 +117,8 @@ public class CommandsTest throws IOException { cleanupFiles(filenames); - String[] args = cmdLine.split("\\s+"); - Jalview.main(args); + String[] args = (cmdLine + " --gui").split("\\s+"); + callJalviewMain(args); Commands cmds = Jalview.getInstance().getCommands(); Assert.assertNotNull(cmds); File lastFile = null; @@ -138,8 +145,8 @@ public class CommandsTest String[] filenames) throws IOException { cleanupFiles(filenames); - String[] args = cmdLine.split("\\s+"); - Jalview.main(args); + String[] args = (cmdLine + " --gui").split("\\s+"); + callJalviewMain(args); Commands cmds = Jalview.getInstance().getCommands(); Assert.assertNotNull(cmds); File lastFile = null; @@ -166,7 +173,7 @@ public class CommandsTest { return new Object[][] { // - { "--nonews --nosplash --open=./examples/test_fab41.result/sample.a2m " + { "--gui --nonews --nosplash --open=./examples/test_fab41.result/sample.a2m " + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb " + "--structureimage=" + testfiles + "/structureimage1.png " + "--open=./examples/test_fab41.result/sample.a2m " @@ -208,18 +215,18 @@ public class CommandsTest { return new Object[][] { // - { "--argfile=" + testfiles + "/**/*.txt", new String[] + { "--gui --argfile=" + testfiles + "/**/*.txt", new String[] { testfiles + "/dir1/test1.png", testfiles + "/dir2/test1.png", testfiles + "/dir3/subdir/test0.png" } }, - { "--argfile=" + testfiles + "/**/argfile.txt", new String[] + { "--gui --argfile=" + testfiles + "/**/argfile.txt", new String[] { testfiles + "/dir1/test1.png", testfiles + "/dir2/test1.png" } }, - { "--argfile=" + testfiles + "/dir*/argfile.txt", new String[] + { "--gui --argfile=" + testfiles + "/dir*/argfile.txt", new String[] { testfiles + "/dir1/test1.png", testfiles + "/dir2/test1.png" } }, - { "--initsubstitutions --append examples/uniref50.fa --image " + { "--gui --initsubstitutions --append examples/uniref50.fa --image " + testfiles + "/{basename}.png", new String[] { testfiles + "/uniref50.png" } }, - { "--append examples/uniref50.fa --nosubstitutions --image " + { "--gui --append examples/uniref50.fa --nosubstitutions --image " + testfiles + "/{basename}.png", new String[] { testfiles + "/{basename}.png" } } @@ -252,11 +259,11 @@ public class CommandsTest { "examples/uniref50.fa " + testfiles + "/test1.fa", true, 2, ArrayUtils.concatArrays(someUniref50Seqs, t1) }, { "examples/uniref50.fa " + testfiles + "/test1.fa", true, 2, t1 }, - { "--argfile=" + testfiles + "/argfile0.txt", true, 1, + { "--gui --argfile=" + testfiles + "/argfile0.txt", true, 1, ArrayUtils.concatArrays(t1, t3) }, - { "--argfile=" + testfiles + "/argfile*.txt", true, 5, + { "--gui --argfile=" + testfiles + "/argfile*.txt", true, 5, ArrayUtils.concatArrays(t1, t2, t3) }, - { "--argfile=" + testfiles + "/argfile.autocounter", true, 3, + { "--gui --argfile=" + testfiles + "/argfile.autocounter", true, 3, ArrayUtils.concatArrays(t1, t2) } }; } @@ -296,8 +303,8 @@ public class CommandsTest public void allLinkedIdsTest(String cmdLine, String[] filenames, String[] nonfilenames) { - String[] args = cmdLine.split("\\s+"); - Jalview.main(args); + String[] args = (cmdLine + " --gui").split("\\s+"); + callJalviewMain(args); Commands cmds = Jalview.getInstance().getCommands(); Assert.assertNotNull(cmds); for (String filename : filenames) @@ -324,19 +331,19 @@ public class CommandsTest // /* */ - { "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --output={dirname}/{basename}.stk --close", + { "--gui --open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --output={dirname}/{basename}.stk --close", new String[] { "test/jalview/bin/argparser/testfiles/test1.stk", "test/jalview/bin/argparser/testfiles/test2.stk", "test/jalview/bin/argparser/testfiles/test3.stk", }, null }, - { "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --image={dirname}/{basename}.png --close", + { "--gui --open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --image={dirname}/{basename}.png --close", new String[] { "test/jalview/bin/argparser/testfiles/test1.png", "test/jalview/bin/argparser/testfiles/test2.png", "test/jalview/bin/argparser/testfiles/test3.png", }, null }, - { "--open=test/jalview/bin/argparser/testfiles/*.fa --all --output={dirname}/{basename}.stk --close", + { "--gui --open=test/jalview/bin/argparser/testfiles/*.fa --all --output={dirname}/{basename}.stk --close", new String[] { "test/jalview/bin/argparser/testfiles/test1.stk", "test/jalview/bin/argparser/testfiles/test2.stk", @@ -351,7 +358,7 @@ public class CommandsTest "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk", "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk", "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, }, - { "--open=test/jalview/bin/argparser/**/*.fa --all --output={dirname}/{basename}.stk --close", + { "--gui --open=test/jalview/bin/argparser/**/*.fa --all --output={dirname}/{basename}.stk --close", new String[] { "test/jalview/bin/argparser/testfiles/test1.stk", "test/jalview/bin/argparser/testfiles/test2.stk", @@ -366,7 +373,7 @@ public class CommandsTest "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk", "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, null }, - { "--open=test/jalview/bin/argparser/**/*.fa --output=*.stk --close", + { "--gui --open=test/jalview/bin/argparser/**/*.fa --output=*.stk --close", new String[] { "test/jalview/bin/argparser/testfiles/test1.stk", "test/jalview/bin/argparser/testfiles/test2.stk", @@ -381,7 +388,7 @@ public class CommandsTest "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk", "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, null }, - { "--open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=*.stk --close", + { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=*.stk --close", new String[] { "test/jalview/bin/argparser/testfiles/dir1/test1.stk", "test/jalview/bin/argparser/testfiles/dir1/test2.stk", @@ -396,7 +403,7 @@ public class CommandsTest "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk", "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk", "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, }, - { "--open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=open*.stk --close", + { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=open*.stk --close", new String[] { "test/jalview/bin/argparser/testfiles/dir2/test1.stk", "test/jalview/bin/argparser/testfiles/dir2/test2.stk", @@ -411,7 +418,7 @@ public class CommandsTest "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk", "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk", "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, }, - { "--open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --opened --output={dirname}/{basename}.stk --close", + { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --opened --output={dirname}/{basename}.stk --close", new String[] { "test/jalview/bin/argparser/testfiles/dir2/test1.stk", "test/jalview/bin/argparser/testfiles/dir2/test2.stk", @@ -426,7 +433,7 @@ public class CommandsTest "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk", "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk", "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, }, - { "--open=test/jalview/bin/argparser/testfiles/dir1/*.fa --output open*.stk --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=open*.aln --close", + { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --output open*.stk --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=open*.aln --close", new String[] { "test/jalview/bin/argparser/testfiles/dir1/test1.stk", "test/jalview/bin/argparser/testfiles/dir1/test2.stk",