X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fgui%2FAlignFrameTest.java;h=d362d35c1d5a2ee1bcb58f3f6db121fcaa2ae28e;hb=1782673a61778d3aec570fbfc291ab21f99af7a3;hp=454ff610f3c62db8c5c53f00a8fb92d23cae0466;hpb=3c8a25936a2d805e7e3d7ab82f83b13135406d18;p=jalview.git diff --git a/test/jalview/gui/AlignFrameTest.java b/test/jalview/gui/AlignFrameTest.java index 454ff61..d362d35 100644 --- a/test/jalview/gui/AlignFrameTest.java +++ b/test/jalview/gui/AlignFrameTest.java @@ -27,6 +27,14 @@ import static org.testng.Assert.assertNotSame; import static org.testng.Assert.assertSame; import static org.testng.Assert.assertTrue; +import java.awt.Color; +import java.util.Iterator; + +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + import jalview.api.FeatureColourI; import jalview.bin.Cache; import jalview.bin.Jalview; @@ -49,20 +57,55 @@ import jalview.schemes.StrandColourScheme; import jalview.schemes.TurnColourScheme; import jalview.util.MessageManager; -import java.awt.Color; -import java.util.Iterator; - -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - public class AlignFrameTest { AlignFrame af; @BeforeClass(alwaysRun = true) - public void setUpJvOptionPane() + public static void setUpBeforeClass() throws Exception + { + setUpJvOptionPane(); + /* + * use read-only test properties file + */ + Cache.loadProperties("test/jalview/io/testProps.jvprops"); + Jalview.main(new String[] { "-nonews" }); + } + + @AfterMethod(alwaysRun = true) + public void tearDown() + { + Desktop.instance.closeAll_actionPerformed(null); + } + + /** + * configure (read-only) properties for test to ensure Consensus is computed for + * colour Above PID testing + */ + @BeforeMethod(alwaysRun = true) + public void setUp() + { + Cache.loadProperties("test/jalview/io/testProps.jvprops"); + Cache.applicationProperties.setProperty("SHOW_IDENTITY", + Boolean.TRUE.toString()); + af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa", + DataSourceType.FILE); + + /* + * wait for Consensus thread to complete + */ + do + { + try + { + Thread.sleep(50); + } catch (InterruptedException x) + { + } + } while (af.getViewport().getCalcManager().isWorking()); + } + + public static void setUpJvOptionPane() { JvOptionPane.setInteractiveMode(false); JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); @@ -151,52 +194,6 @@ public class AlignFrameTest assertEquals(next[1], 8); } - @BeforeClass(alwaysRun = true) - public static void setUpBeforeClass() throws Exception - { - /* - * use read-only test properties file - */ - Cache.loadProperties("test/jalview/io/testProps.jvprops"); - Jalview.main(new String[] { "-nonews" }); - } - - @AfterMethod(alwaysRun = true) - public void tearDown() - { - Desktop.instance.closeAll_actionPerformed(null); - } - - /** - * configure (read-only) properties for test to ensure Consensus is computed - * for colour Above PID testing - */ - @BeforeMethod(alwaysRun = true) - public void setUp() - { - Cache.loadProperties("test/jalview/io/testProps.jvprops"); - Cache.applicationProperties.setProperty("SHOW_IDENTITY", - Boolean.TRUE.toString()); - af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa", - DataSourceType.FILE); - - /* - * wait for Consensus thread to complete - */ - synchronized (this) - { - while (af.getViewport().getConsensusSeq() == null) - { - try - { - wait(50); - } catch (InterruptedException e) - { - } - } - } - } - /** * Test that changing background (alignment) colour scheme *