+
+ /**
+ * Test that changing the 'ignore gaps in consensus' in the viewport (an
+ * option on the annotation label popup menu) results in a change to the
+ * colouring
+ */
+ @Test(groups = "Functional")
+ public void testFindColour_ignoreGaps()
+ {
+ /*
+ * AAAAA
+ * AAAAA
+ * -CCCC
+ * FFFFF
+ *
+ * first column consensus is A
+ * first column PID is 50%, or 67% ignoring gaps
+ */
+ String seqs = ">seq1\nAAAAA\n>seq2\nAAAAA\n>seq3\n-CCCC\n>seq4\nFFFFF\n";
+
+ /*
+ * load data and wait for consensus to be computed
+ */
+ AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(seqs,
+ DataSourceType.PASTE);
+ AlignViewport viewport = af.getViewport();
+ viewport.setIgnoreGapsConsensus(false, af.alignPanel);
+ while (viewport.getConsensusSeq() == null)
+ {
+ synchronized (this)
+ {
+ try
+ {
+ wait(50);
+ } catch (InterruptedException e)
+ {
+ }
+ }
+ }
+ af.changeColour_actionPerformed(JalviewColourScheme.PID.toString());
+
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);
+
+ /*
+ * including gaps, A should be coloured for 50% consensus
+ */
+ Color c = viewport
+ .getResidueShading().findColour('A', 0, seq);
+ assertEquals(c, over40);
+
+ /*
+ * now choose to ignore gaps; colour should be for 67%
+ */
+ viewport.setIgnoreGapsConsensus(true, af.alignPanel);
+ c = viewport
+ .getResidueShading().findColour('A', 0, seq);
+ assertEquals(c, over60);
+ }