X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=test%2Fjalview%2Fbin%2FCommandsTest.java;h=62d1822bd1d13725673e0bfc3c98eefb7cef1a1f;hb=96f727b57ac588f9307116b79a7f1ab67dbff39b;hp=66250d8cbbe6918ffaea0d89281aab8637bba9ef;hpb=7b5d11bce39b76612773aa4d606ffbe55bb86a02;p=jalview.git diff --git a/test/jalview/bin/CommandsTest.java b/test/jalview/bin/CommandsTest.java index 66250d8..62d1822 100644 --- a/test/jalview/bin/CommandsTest.java +++ b/test/jalview/bin/CommandsTest.java @@ -2,11 +2,14 @@ package jalview.bin; import java.io.File; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; import java.nio.file.Files; import java.util.Date; import java.util.HashSet; import java.util.Set; +import javax.swing.SwingUtilities; + import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; @@ -48,7 +51,24 @@ public class CommandsTest @AfterMethod(alwaysRun = true) public void tearDown() { - Desktop.closeDesktop(); + try + { + // occasionally we are blocked by Jmol redraws + SwingUtilities.invokeAndWait(new Runnable() + { + + @Override + public void run() + { + Desktop.closeDesktop(); + } + }); + } catch (Exception foo) + { + System.err.println("Failed during teardown with exception"); + foo.printStackTrace(); + } + } public static void callJalviewMain(String[] args) @@ -76,7 +96,7 @@ public class CommandsTest } */ - @Test(groups = "Functional", dataProvider = "cmdLines") + @Test(groups = { "Functional", "testTask3" }, dataProvider = "cmdLines") public void commandsOpenTest(String cmdLine, boolean cmdArgs, int numFrames, String[] sequences) { @@ -91,13 +111,13 @@ public class CommandsTest Assert.assertEquals(cmds.argsWereParsed(), cmdArgs, "Overall command parse and operation is false"); - Assert.assertEquals(Desktop.getAlignFrames().length, numFrames, + Assert.assertEquals(Desktop.getDesktopAlignFrames().length, numFrames, "Wrong number of AlignFrames"); if (sequences != null) { Set openedSequenceNames = new HashSet<>(); - AlignFrame[] afs = Desktop.getAlignFrames(); + AlignFrame[] afs = Desktop.getDesktopAlignFrames(); for (AlignFrame af : afs) { openedSequenceNames.addAll( @@ -127,7 +147,7 @@ public class CommandsTest @Test( groups = - { "Functional", "testTask1" }, + { "Functional", "testTask3" }, dataProvider = "structureImageOutputFiles") public void structureImageOutputTest(String cmdLine, String[] filenames) throws IOException @@ -214,11 +234,11 @@ public class CommandsTest + "--open=./examples/test_fab41.result/sample.a2m " + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb " + "--structureimage=" + testfiles - + "/structureimage2.png --structureimagescale=1.5" + + "/structureimage2.png --scale=1.5 " + "--open=./examples/test_fab41.result/sample.a2m " + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb " + "--structureimage=" + testfiles - + "/structureimage3.png --structureimagescale=2.0", + + "/structureimage3.png --scale=2.0 ", new String[] { testfiles + "/structureimage1.png", testfiles + "/structureimage2.png", @@ -229,11 +249,11 @@ public class CommandsTest + "--open=./examples/test_fab41.result/sample.a2m " + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb " + "--structureimage=" + testfiles - + "/structureimage2.png --structureimagescale=1.5" + + "/structureimage2.png --scale=1.5 " + "--open=./examples/test_fab41.result/sample.a2m " + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb " + "--structureimage=" + testfiles - + "/structureimage3.png --structureimagescale=2.0", + + "/structureimage3.png --scale=2.0 ", new String[] { testfiles + "/structureimage1.png", testfiles + "/structureimage2.png", @@ -305,7 +325,7 @@ public class CommandsTest public static boolean lookForSequenceName(String sequenceName) { - AlignFrame[] afs = Desktop.getAlignFrames(); + AlignFrame[] afs = Desktop.getDesktopAlignFrames(); for (AlignFrame af : afs) { for (String name : af.getViewport().getAlignment().getSequenceNames())