X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fschemes%2FPIDColourSchemeTest.java;h=dff19cd65228c4be92aed3937c7d3a830157ee8e;hb=a7169b1c72607f3c9357195b4999869650a2a891;hp=6f60e50245194d6a5cfa6708256ae04d1a7e64d7;hpb=9270bd30c65a1304c4228b2f07734bc8461cd531;p=jalview.git
diff --git a/test/jalview/schemes/PIDColourSchemeTest.java b/test/jalview/schemes/PIDColourSchemeTest.java
index 6f60e50..dff19cd 100644
--- a/test/jalview/schemes/PIDColourSchemeTest.java
+++ b/test/jalview/schemes/PIDColourSchemeTest.java
@@ -1,17 +1,37 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.schemes;
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;
@@ -35,13 +55,14 @@ public class PIDColourSchemeTest
*
case insensitive matching
*
*/
- @Test
+ @Test(groups = "Functional")
public void testFindColour()
{
ColourSchemeI scheme = new PIDColourScheme();
/*
* doesn't use column or sequence
+ * we assume consensus residue is computed as upper case
*/
assertEquals(scheme.findColour('A', 0, null, "A", 0f), white);
assertEquals(scheme.findColour('A', 0, null, "A", 40f), white);
@@ -54,8 +75,6 @@ public class PIDColourSchemeTest
assertEquals(scheme.findColour('A', 0, null, "KFV", 100f), white);
assertEquals(scheme.findColour('a', 0, null, "A", 80f), over60);
- assertEquals(scheme.findColour('A', 0, null, "a", 80f), over60);
- assertEquals(scheme.findColour('a', 0, null, "a", 80f), over60);
assertEquals(scheme.findColour('A', 0, null, "AC", 80f), over60);
assertEquals(scheme.findColour('A', 0, null, "KCA", 80f), over60);
}
@@ -65,7 +84,7 @@ public class PIDColourSchemeTest
* option on the annotation label popup menu) results in a change to the
* colouring
*/
- @Test
+ @Test(groups = "Functional")
public void testFindColour_ignoreGaps()
{
/*
@@ -78,10 +97,23 @@ public class PIDColourSchemeTest
* 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);
+ do
+ {
+ try
+ {
+ Thread.sleep(50);
+ } catch (InterruptedException x)
+ {
+ }
+ } while (af.getViewport().getCalcManager().isWorking());
af.changeColour_actionPerformed(JalviewColourScheme.PID.toString());
SequenceI seq = viewport.getAlignment().getSequenceAt(0);
@@ -89,16 +121,14 @@ public class PIDColourSchemeTest
/*
* including gaps, A should be coloured for 50% consensus
*/
- Color c = viewport
- .getViewportColourScheme().findColour('A', 0, seq);
+ 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
- .getViewportColourScheme().findColour('A', 0, seq);
+ c = viewport.getResidueShading().findColour('A', 0, seq);
assertEquals(c, over60);
}
}