2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import static org.testng.Assert.assertEquals;
25 import jalview.bin.Jalview;
26 import jalview.datamodel.Alignment;
27 import jalview.datamodel.AlignmentI;
28 import jalview.datamodel.Sequence;
29 import jalview.datamodel.SequenceGroup;
30 import jalview.datamodel.SequenceI;
31 import jalview.renderer.ResidueShader;
32 import jalview.renderer.ResidueShaderI;
33 import jalview.schemes.ZappoColourScheme;
35 import java.awt.Color;
37 import org.testng.annotations.BeforeClass;
38 import org.testng.annotations.BeforeMethod;
39 import org.testng.annotations.Test;
41 public class SequenceRendererTest
48 @BeforeClass(alwaysRun = true)
49 public static void setUpBeforeClass() throws Exception
53 { "-nonews", "-props", "test/jalview/testProps.jvprops" });
56 @BeforeMethod(alwaysRun = true)
59 seq1 = new Sequence("Seq1", "ABCEEEABCABC");
60 SequenceI seq2 = new Sequence("Seq2", "ABCABCABCABC");
61 SequenceI seq3 = new Sequence("Seq3", "ABCABCABCABC");
62 SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3 };
63 al = new Alignment(seqs);
65 av = new AlignViewport(al);
68 @Test(groups = "Functional")
69 public void testGetResidueColour_WithGroup()
71 SequenceRenderer sr = new SequenceRenderer(av);
72 SequenceGroup sg = new SequenceGroup();
73 sg.addSequence(seq1, false);
77 ResidueShaderI rs = new ResidueShader();
78 rs.setColourScheme(new ZappoColourScheme());
79 sg.setGroupColourScheme(rs);
81 av.getAlignment().addGroup(sg);
83 // outside group residues are white
84 assertEquals(Color.white, sr.getResidueColour(seq1, 1, null));
86 // within group use Zappo scheme - E = red
87 assertEquals(Color.red, sr.getResidueColour(seq1, 3, null));