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;
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);
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
* <ul>
/*
* apply 30% Conservation to group
+ * (notice menu action applies to selection group even if mouse click
+ * is at a sequence not in the group)
*/
- PopupMenu popupMenu = new PopupMenu(af.alignPanel, null, null);
+ PopupMenu popupMenu = new PopupMenu(af.alignPanel, al.getSequenceAt(2),
+ null);
popupMenu.changeColour_actionPerformed(JalviewColourScheme.Strand
.toString());
assertTrue(sg.getColourScheme() instanceof StrandColourScheme);
/*
* inspect the colour of
- * FER_CAPAN.9(I), column 14 (14 base 0)
+ * FER_CAPAN.9(I), column 15 (14 base 0)
* FER_CAPAN.10(SER), column 16 (15 base 0)
*/
SequenceI ferCapan = al.findName("FER_CAPAN");
SliderPanel sp = SliderPanel.getSliderPanel();
assertTrue(sp.isForConservation());
assertEquals(sp.getValue(), 30); // initial slider setting
+ c = rs.findColour('I', 14, ferCapan);
+ Color i_faded = new Color(255, 255, 255);
+ assertEquals(c, i_faded);
sp.valueChanged(10);
assertSame(rs, av.getResidueShading());
+ assertEquals(rs.getConservationInc(), 10);
c = rs.findColour('I', 14, ferCapan);
- Color i_faded = new Color(196, 186, 196);
+ i_faded = new Color(196, 186, 196);
assertEquals(c, i_faded);
c = rs.findColour('S', 15, ferCapan);
Color s_faded = new Color(144, 225, 144);
sg.setStartRes(15);
sg.setEndRes(25);
av.setSelectionGroup(sg);
- PopupMenu popupMenu = new PopupMenu(af.alignPanel, null, null);
+ PopupMenu popupMenu = new PopupMenu(af.alignPanel, al.getSequenceAt(0),
+ null);
popupMenu.changeColour_actionPerformed(JalviewColourScheme.Strand
.toString());
assertTrue(sg.getColourScheme() instanceof StrandColourScheme);