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;
/*
* wait for Consensus thread to complete
*/
- synchronized (this)
+ do
{
- while (af.getViewport().getConsensusSeq() == null)
+ try
+ {
+ Thread.sleep(50);
+ } catch (InterruptedException x)
{
- try
- {
- wait(50);
- } catch (InterruptedException e)
- {
- }
}
- }
+ } while (af.getViewport().getCalcManager().isWorking());
}
public static void setUpJvOptionPane()
/*
* 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);
* wait for Conservation thread to complete
*/
AlignViewport viewport = af.getViewport();
+ waitForCalculations(viewport);
+ AlignmentAnnotation[] anns = viewport.getAlignment()
+ .getAlignmentAnnotation();
+ assertNotNull("No annotations found", anns);
+ assertEquals("More than one annotation found", 1, anns.length);
+ assertTrue("Annotation is not Quality",
+ anns[0].description.startsWith("Alignment Quality"));
+ Annotation[] annotations = anns[0].annotations;
+ assertNotNull("Quality annotations are null", annotations);
+ assertNotNull("Quality in column 1 is null", annotations[0]);
+ assertTrue("No quality value in column 1", annotations[0].value > 10f);
+ }
+
+ /**
+ * Wait for consensus etc calculation threads to complete
+ *
+ * @param viewport
+ */
+ protected void waitForCalculations(AlignViewport viewport)
+ {
synchronized (this)
{
while (viewport.getCalcManager().isWorking())
}
}
}
- AlignmentAnnotation[] anns = viewport.getAlignment()
- .getAlignmentAnnotation();
- assertNotNull("No annotations found", anns);
- assertEquals("More than one annotation found", 1, anns.length);
- assertTrue("Annotation is not Quality",
- anns[0].description.startsWith("Alignment Quality"));
- Annotation[] annotations = anns[0].annotations;
- assertNotNull("Quality annotations are null", annotations);
- assertNotNull("Quality in column 1 is null", annotations[0]);
- assertTrue("No quality value in column 1", annotations[0].value > 10f);
}
@Test(groups = { "Functional" })
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(fasta,
DataSourceType.PASTE);
AlignViewport testme = af.getViewport();
+ waitForCalculations(testme);
SequenceI cons = testme.getConsensusSeq();
assertEquals("A-C", cons.getSequenceAsString());
}
/*
* wait for Consensus thread to complete
*/
- synchronized (this)
+ do
{
- while (af.getViewport().getConsensusSeq() == null)
+ try
+ {
+ Thread.sleep(50);
+ } catch (InterruptedException x)
{
- try
- {
- wait(50);
- } catch (InterruptedException e)
- {
- }
}
- }
+ } while (af.getViewport().getCalcManager().isWorking());
}
/**
import static org.testng.Assert.assertEquals;
+import java.awt.Color;
+
+import org.testng.annotations.Test;
+
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.AlignViewport;
import jalview.io.DataSourceType;
import jalview.io.FileLoader;
-import java.awt.Color;
-
-import org.testng.annotations.Test;
-
public class PIDColourSchemeTest
{
static final Color white = Color.white;
DataSourceType.PASTE);
AlignViewport viewport = af.getViewport();
viewport.setIgnoreGapsConsensus(false, af.alignPanel);
- while (viewport.getConsensusSeq() == null)
+ do
{
- synchronized (this)
+ try
+ {
+ Thread.sleep(50);
+ } catch (InterruptedException x)
{
- try
- {
- wait(50);
- } catch (InterruptedException e)
- {
- }
}
- }
+ } while (af.getViewport().getCalcManager().isWorking());
af.changeColour_actionPerformed(JalviewColourScheme.PID.toString());
SequenceI seq = viewport.getAlignment().getSequenceAt(0);