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
49 @BeforeClass(alwaysRun = true)
50 public static void setUpBeforeClass() throws Exception
54 { "-nonews", "-props", "test/jalview/testProps.jvprops" });
57 @BeforeMethod(alwaysRun = true)
60 seq1 = new Sequence("Seq1", "ABCEEEABCABC");
61 SequenceI seq2 = new Sequence("Seq2", "ABCABCABCABC");
62 SequenceI seq3 = new Sequence("Seq3", "ABCABCABCABC");
63 SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3 };
64 al = new Alignment(seqs);
66 av = new AlignViewport(al);
69 @Test(groups = "Functional")
70 public void testGetResidueColour_WithGroup()
72 SequenceRenderer sr = new SequenceRenderer(av);
73 SequenceGroup sg = new SequenceGroup();
74 sg.addSequence(seq1, false);
78 ResidueShaderI rs = new ResidueShader();
79 rs.setColourScheme(new ZappoColourScheme());
80 sg.setGroupColourScheme(rs);
82 av.getAlignment().addGroup(sg);
84 // outside group residues are white
85 assertEquals(Color.white, sr.getResidueColour(seq1, 1, null));
87 // within group use Zappo scheme - E = red
88 assertEquals(Color.red, sr.getResidueColour(seq1, 3, null));