import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignViewport;
import jalview.gui.JvOptionPane;
import jalview.gui.Preferences;
+import jalview.schemes.ColourSchemeI;
import jalview.schemes.UserColourScheme;
import jalview.schemes.ZappoColourScheme;
import java.awt.Color;
+import java.util.ArrayList;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
{
JvOptionPane.setInteractiveMode(false);
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ Cache.loadProperties("test/jalview/io/testProps.jvprops");
}
@Test(groups = { "Functional" })
}
@Test
- public void testGetBoxColour()
+ public void testGetResidueBoxColour_group()
{
- Cache.loadProperties("test/jalview/io/testProps.jvprops");
+ SequenceI seq = new Sequence("name", "MA--TVLGSPRAPAFF");
+ AlignmentI al = new Alignment(new SequenceI[] { seq });
+
+ ColourSchemeI cs = new ZappoColourScheme();
+ ArrayList<SequenceI> seqlist = new ArrayList<>();
+ seqlist.add(seq);
+ SequenceGroup sg = new SequenceGroup(seqlist, "testgroup", cs, true,
+ true, true, 5, 9);
+ al.addGroup(sg);
+ SequenceGroup[] groups = new SequenceGroup[1];
+ groups[0] = sg;
+
+ final AlignViewport av = new AlignViewport(al);
+ ResidueColourFinder rcf = new OverviewResColourFinder();
+
+ // G in group specified as magenta in Zappo
+ assertEquals(Color.magenta, rcf.getResidueColour(false,
+ av.getResidueShading(), groups, seq, 7, null));
+
+ // Residue outside group coloured white
+ assertEquals(Color.white, rcf.getResidueColour(false,
+ av.getResidueShading(), groups, seq, 0, null));
+
+ // Gap outside group coloured lightgray
+ assertEquals(Color.lightGray, rcf.getResidueColour(false,
+ av.getResidueShading(), groups, seq, 2, null));
+ rcf = new OverviewResColourFinder(true, Color.blue, Color.red);
+
+ // G in group specified as magenta in Zappo
+ assertEquals(Color.magenta, rcf.getResidueColour(false,
+ av.getResidueShading(), groups, seq, 7, null));
+
+ // Residue outside group coloured lightgray
+ assertEquals(Color.lightGray, rcf.getResidueColour(false,
+ av.getResidueShading(), groups, seq, 0, null));
+
+ // Gap outside group coloured white
+ assertEquals(Color.white, rcf.getResidueColour(false,
+ av.getResidueShading(), groups, seq, 2, null));
+ }
+
+ @Test
+ public void testGetBoxColour()
+ {
SequenceI seq = new Sequence("name", "MAT--GSPRAPAFF"); // FER1_MAIZE... + a
// gap
AlignmentI al = new Alignment(new SequenceI[] { seq });