1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import static org.junit.Assert.assertNotEquals; |
24 |
|
import static org.testng.Assert.assertEquals; |
25 |
|
import static org.testng.Assert.assertFalse; |
26 |
|
import static org.testng.Assert.assertNotSame; |
27 |
|
import static org.testng.Assert.assertSame; |
28 |
|
import static org.testng.Assert.assertTrue; |
29 |
|
|
30 |
|
import java.awt.Color; |
31 |
|
import java.util.Iterator; |
32 |
|
|
33 |
|
import org.testng.annotations.AfterMethod; |
34 |
|
import org.testng.annotations.BeforeClass; |
35 |
|
import org.testng.annotations.BeforeMethod; |
36 |
|
import org.testng.annotations.Test; |
37 |
|
|
38 |
|
import jalview.api.FeatureColourI; |
39 |
|
import jalview.bin.Cache; |
40 |
|
import jalview.bin.Jalview; |
41 |
|
import jalview.datamodel.Alignment; |
42 |
|
import jalview.datamodel.AlignmentI; |
43 |
|
import jalview.datamodel.HiddenColumns; |
44 |
|
import jalview.datamodel.Sequence; |
45 |
|
import jalview.datamodel.SequenceFeature; |
46 |
|
import jalview.datamodel.SequenceGroup; |
47 |
|
import jalview.datamodel.SequenceI; |
48 |
|
import jalview.io.DataSourceType; |
49 |
|
import jalview.io.FileLoader; |
50 |
|
import jalview.project.Jalview2xmlTests; |
51 |
|
import jalview.renderer.ResidueShaderI; |
52 |
|
import jalview.schemes.BuriedColourScheme; |
53 |
|
import jalview.schemes.FeatureColour; |
54 |
|
import jalview.schemes.HelixColourScheme; |
55 |
|
import jalview.schemes.JalviewColourScheme; |
56 |
|
import jalview.schemes.StrandColourScheme; |
57 |
|
import jalview.schemes.TurnColourScheme; |
58 |
|
import jalview.util.MessageManager; |
59 |
|
|
|
|
| 99.3% |
Uncovered Elements: 2 (295) |
Complexity: 12 |
Complexity Density: 0.04 |
|
60 |
|
public class AlignFrameTest |
61 |
|
{ |
62 |
|
AlignFrame af; |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
64 |
1 |
@BeforeClass(alwaysRun = true)... |
65 |
|
public static void setUpBeforeClass() throws Exception |
66 |
|
{ |
67 |
1 |
setUpJvOptionPane(); |
68 |
|
|
69 |
|
|
70 |
|
|
71 |
1 |
Cache.loadProperties("test/jalview/io/testProps.jvprops"); |
72 |
1 |
Jalview.main(new String[] { "--nonews" }); |
73 |
|
} |
74 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
75 |
5 |
@AfterMethod(alwaysRun = true)... |
76 |
|
public void tearDown() |
77 |
|
{ |
78 |
5 |
if (Desktop.instance != null) |
79 |
5 |
Desktop.instance.closeAll_actionPerformed(null); |
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
|
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
86 |
5 |
@BeforeMethod(alwaysRun = true)... |
87 |
|
public void setUp() |
88 |
|
{ |
89 |
5 |
Cache.loadProperties("test/jalview/io/testProps.jvprops"); |
90 |
5 |
Cache.applicationProperties.setProperty("SHOW_IDENTITY", |
91 |
|
Boolean.TRUE.toString()); |
92 |
5 |
af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa", |
93 |
|
DataSourceType.FILE); |
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
5 |
do |
99 |
|
{ |
100 |
5 |
try |
101 |
|
{ |
102 |
5 |
Thread.sleep(50); |
103 |
|
} catch (InterruptedException x) |
104 |
|
{ |
105 |
|
} |
106 |
5 |
} while (af.getViewport().getCalcManager().isWorking()); |
107 |
|
} |
108 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
109 |
1 |
public static void setUpJvOptionPane()... |
110 |
|
{ |
111 |
1 |
JvOptionPane.setInteractiveMode(false); |
112 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
113 |
|
} |
114 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (39) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
115 |
1 |
@Test(groups = "Functional")... |
116 |
|
public void testHideFeatureColumns() |
117 |
|
{ |
118 |
1 |
SequenceI seq1 = new Sequence("Seq1", "ABCDEFGHIJ"); |
119 |
1 |
SequenceI seq2 = new Sequence("Seq2", "ABCDEFGHIJ"); |
120 |
1 |
seq1.addSequenceFeature( |
121 |
|
new SequenceFeature("Metal", "", 1, 5, 0f, null)); |
122 |
1 |
seq2.addSequenceFeature( |
123 |
|
new SequenceFeature("Metal", "", 6, 10, 10f, null)); |
124 |
1 |
seq1.addSequenceFeature( |
125 |
|
new SequenceFeature("Turn", "", 2, 4, Float.NaN, null)); |
126 |
1 |
seq2.addSequenceFeature( |
127 |
|
new SequenceFeature("Turn", "", 7, 9, Float.NaN, null)); |
128 |
1 |
AlignmentI al = new Alignment(new SequenceI[] { seq1, seq2 }); |
129 |
1 |
AlignFrame alignFrame = new AlignFrame(al, al.getWidth(), |
130 |
|
al.getHeight()); |
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
1 |
alignFrame.getFeatureRenderer().findAllFeatures(true); |
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
1 |
assertFalse(alignFrame.hideFeatureColumns("exon", true)); |
141 |
1 |
assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty()); |
142 |
|
|
143 |
1 |
assertEquals(alignFrame.getViewport().getAlignment().getHiddenColumns() |
144 |
|
.getNumberOfRegions(), 0); |
145 |
|
|
146 |
1 |
assertFalse(alignFrame.hideFeatureColumns("exon", false)); |
147 |
1 |
assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty()); |
148 |
|
|
149 |
1 |
assertEquals(alignFrame.getViewport().getAlignment().getHiddenColumns() |
150 |
|
.getNumberOfRegions(), 0); |
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
1 |
assertFalse(alignFrame.hideFeatureColumns("Metal", true)); |
156 |
1 |
assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty()); |
157 |
|
|
158 |
1 |
assertEquals(alignFrame.getViewport().getAlignment().getHiddenColumns() |
159 |
|
.getNumberOfRegions(), 0); |
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
1 |
FeatureColourI fc = new FeatureColour(null, Color.red, Color.blue, null, |
167 |
|
0f, 10f); |
168 |
1 |
fc.setAboveThreshold(true); |
169 |
1 |
fc.setThreshold(5f); |
170 |
1 |
alignFrame.getFeatureRenderer().setColour("Metal", fc); |
171 |
1 |
assertTrue(alignFrame.hideFeatureColumns("Metal", true)); |
172 |
1 |
HiddenColumns hidden = alignFrame.getViewport().getAlignment() |
173 |
|
.getHiddenColumns(); |
174 |
1 |
assertEquals(hidden.getNumberOfRegions(), 1); |
175 |
1 |
Iterator<int[]> regions = hidden.iterator(); |
176 |
1 |
int[] next = regions.next(); |
177 |
1 |
assertEquals(next[0], 5); |
178 |
1 |
assertEquals(next[1], 9); |
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
1 |
alignFrame.getViewport().showAllHiddenColumns(); |
186 |
1 |
assertTrue(alignFrame.hideFeatureColumns("Turn", true)); |
187 |
1 |
regions = alignFrame.getViewport().getAlignment().getHiddenColumns() |
188 |
|
.iterator(); |
189 |
1 |
assertEquals(alignFrame.getViewport().getAlignment().getHiddenColumns() |
190 |
|
.getNumberOfRegions(), 2); |
191 |
1 |
next = regions.next(); |
192 |
1 |
assertEquals(next[0], 1); |
193 |
1 |
assertEquals(next[1], 3); |
194 |
1 |
next = regions.next(); |
195 |
1 |
assertEquals(next[0], 6); |
196 |
1 |
assertEquals(next[1], 8); |
197 |
|
} |
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
|
209 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (66) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
210 |
1 |
@Test(groups = "Functional")... |
211 |
|
public void testChangeColour_background_groupsAndThresholds() |
212 |
|
{ |
213 |
1 |
AlignViewport av = af.getViewport(); |
214 |
1 |
AlignmentI al = av.getAlignment(); |
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
1 |
af.applyToAllGroups_actionPerformed(false); |
220 |
1 |
af.changeColour_actionPerformed(JalviewColourScheme.Buried.toString()); |
221 |
1 |
assertTrue(av.getGlobalColourScheme() instanceof BuriedColourScheme); |
222 |
1 |
assertFalse(av.getResidueShading().conservationApplied()); |
223 |
1 |
assertEquals(av.getResidueShading().getThreshold(), 0); |
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
1 |
af.conservationMenuItem_actionPerformed(true); |
229 |
1 |
SliderPanel sp = SliderPanel.getSliderPanel(); |
230 |
1 |
assertEquals(sp.getTitle(), MessageManager.formatMessage( |
231 |
|
"label.conservation_colour_increment", new String[] |
232 |
|
{ "Background" })); |
233 |
1 |
assertTrue(sp.isForConservation()); |
234 |
1 |
sp.valueChanged(20); |
235 |
1 |
assertTrue(av.getResidueShading().conservationApplied()); |
236 |
1 |
assertEquals(av.getResidueShading().getConservationInc(), 20); |
237 |
|
|
238 |
|
|
239 |
|
|
240 |
|
|
241 |
1 |
af.abovePIDThreshold_actionPerformed(true); |
242 |
1 |
sp = SliderPanel.getSliderPanel(); |
243 |
1 |
assertFalse(sp.isForConservation()); |
244 |
1 |
assertEquals(sp.getTitle(), MessageManager.formatMessage( |
245 |
|
"label.percentage_identity_threshold", new String[] |
246 |
|
{ "Background" })); |
247 |
1 |
sp.valueChanged(10); |
248 |
1 |
assertEquals(av.getResidueShading().getThreshold(), 10); |
249 |
1 |
assertTrue(av.getResidueShading().conservationApplied()); |
250 |
1 |
assertEquals(av.getResidueShading().getConservationInc(), 20); |
251 |
|
|
252 |
|
|
253 |
|
|
254 |
|
|
255 |
|
|
256 |
1 |
SequenceGroup sg = new SequenceGroup(); |
257 |
1 |
sg.addSequence(al.getSequenceAt(0), false); |
258 |
1 |
sg.setStartRes(15); |
259 |
1 |
sg.setEndRes(25); |
260 |
1 |
av.setSelectionGroup(sg); |
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
|
267 |
1 |
PopupMenu popupMenu = new PopupMenu(af.alignPanel, al.getSequenceAt(2), |
268 |
|
null); |
269 |
1 |
popupMenu.changeColour_actionPerformed( |
270 |
|
JalviewColourScheme.Strand.toString()); |
271 |
1 |
assertTrue(sg.getColourScheme() instanceof StrandColourScheme); |
272 |
1 |
assertEquals(al.getGroups().size(), 1); |
273 |
1 |
assertSame(al.getGroups().get(0), sg); |
274 |
1 |
popupMenu.conservationMenuItem_actionPerformed(true); |
275 |
1 |
sp = SliderPanel.getSliderPanel(); |
276 |
1 |
assertTrue(sp.isForConservation()); |
277 |
1 |
assertEquals(sp.getTitle(), MessageManager.formatMessage( |
278 |
|
"label.conservation_colour_increment", new String[] |
279 |
|
{ sg.getName() })); |
280 |
1 |
sp.valueChanged(30); |
281 |
1 |
assertTrue(sg.getGroupColourScheme().conservationApplied()); |
282 |
1 |
assertEquals(sg.getGroupColourScheme().getConservationInc(), 30); |
283 |
|
|
284 |
|
|
285 |
|
|
286 |
|
|
287 |
1 |
popupMenu.abovePIDColour_actionPerformed(true); |
288 |
1 |
sp = SliderPanel.getSliderPanel(); |
289 |
1 |
assertFalse(sp.isForConservation()); |
290 |
1 |
assertEquals(sp.getTitle(), MessageManager.formatMessage( |
291 |
|
"label.percentage_identity_threshold", new String[] |
292 |
|
{ sg.getName() })); |
293 |
1 |
sp.valueChanged(40); |
294 |
1 |
assertEquals(sg.getGroupColourScheme().getThreshold(), 40); |
295 |
|
|
296 |
1 |
assertTrue(sg.getGroupColourScheme().conservationApplied()); |
297 |
1 |
assertEquals(sg.getGroupColourScheme().getConservationInc(), 30); |
298 |
|
|
299 |
|
|
300 |
|
|
301 |
|
|
302 |
|
|
303 |
1 |
af.changeColour_actionPerformed(JalviewColourScheme.Turn.toString()); |
304 |
1 |
assertTrue(av.getGlobalColourScheme() instanceof TurnColourScheme); |
305 |
1 |
assertTrue(av.getResidueShading().conservationApplied()); |
306 |
1 |
assertEquals(av.getResidueShading().getConservationInc(), 20); |
307 |
1 |
assertEquals(av.getResidueShading().getThreshold(), 10); |
308 |
1 |
assertTrue(sg.getColourScheme() instanceof StrandColourScheme); |
309 |
1 |
assertTrue(sg.getGroupColourScheme().conservationApplied()); |
310 |
1 |
assertEquals(sg.getGroupColourScheme().getConservationInc(), 30); |
311 |
1 |
assertEquals(sg.getGroupColourScheme().getThreshold(), 40); |
312 |
|
|
313 |
|
|
314 |
|
|
315 |
|
|
316 |
|
|
317 |
1 |
af.applyToAllGroups_actionPerformed(true); |
318 |
1 |
af.changeColour_actionPerformed(JalviewColourScheme.Helix.toString()); |
319 |
1 |
assertTrue(av.getGlobalColourScheme() instanceof HelixColourScheme); |
320 |
1 |
assertTrue(av.getResidueShading().conservationApplied()); |
321 |
1 |
assertEquals(av.getResidueShading().getConservationInc(), 20); |
322 |
1 |
assertEquals(av.getResidueShading().getThreshold(), 10); |
323 |
1 |
assertTrue(sg.getColourScheme() instanceof HelixColourScheme); |
324 |
1 |
assertTrue(sg.getGroupColourScheme().conservationApplied()); |
325 |
1 |
assertEquals(sg.getGroupColourScheme().getConservationInc(), 30); |
326 |
1 |
assertEquals(sg.getGroupColourScheme().getThreshold(), 40); |
327 |
|
} |
328 |
|
|
329 |
|
|
330 |
|
|
331 |
|
|
332 |
|
|
333 |
|
|
334 |
|
|
335 |
|
|
336 |
|
|
337 |
|
|
338 |
|
|
339 |
|
|
340 |
|
|
341 |
|
|
342 |
|
|
343 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (95) |
Complexity: 1 |
Complexity Density: 0.01 |
1PASS
|
|
344 |
1 |
@Test(groups = "Functional")... |
345 |
|
public void testColourThresholdActions() |
346 |
|
{ |
347 |
1 |
AlignViewport av = af.getViewport(); |
348 |
1 |
AlignmentI al = av.getAlignment(); |
349 |
|
|
350 |
|
|
351 |
|
|
352 |
|
|
353 |
1 |
af.applyToAllGroups_actionPerformed(false); |
354 |
1 |
af.changeColour_actionPerformed(JalviewColourScheme.Helix.toString()); |
355 |
1 |
assertTrue(av.getGlobalColourScheme() instanceof HelixColourScheme); |
356 |
1 |
assertFalse(av.getResidueShading().conservationApplied()); |
357 |
1 |
assertEquals(av.getResidueShading().getThreshold(), 0); |
358 |
|
|
359 |
|
|
360 |
|
|
361 |
|
|
362 |
|
|
363 |
|
|
364 |
1 |
SequenceI ferCapan = al.findName("FER_CAPAN"); |
365 |
1 |
ResidueShaderI rs = av.getResidueShading(); |
366 |
1 |
Color c = rs.findColour('I', 14, ferCapan); |
367 |
1 |
Color i_original = new Color(138, 117, 138); |
368 |
1 |
assertEquals(c, i_original); |
369 |
1 |
c = rs.findColour('S', 15, ferCapan); |
370 |
1 |
Color s_original = new Color(54, 201, 54); |
371 |
1 |
assertEquals(c, s_original); |
372 |
|
|
373 |
|
|
374 |
|
|
375 |
|
|
376 |
1 |
af.conservationMenuItem_actionPerformed(true); |
377 |
1 |
SliderPanel sp = SliderPanel.getSliderPanel(); |
378 |
1 |
assertTrue(sp.isForConservation()); |
379 |
1 |
assertEquals(sp.getValue(), 30); |
380 |
1 |
c = rs.findColour('I', 14, ferCapan); |
381 |
1 |
Color i_faded = new Color(255, 255, 255); |
382 |
1 |
assertEquals(c, i_faded); |
383 |
1 |
sp.valueChanged(10); |
384 |
1 |
assertSame(rs, av.getResidueShading()); |
385 |
1 |
assertEquals(rs.getConservationInc(), 10); |
386 |
1 |
c = rs.findColour('I', 14, ferCapan); |
387 |
1 |
i_faded = new Color(196, 186, 196); |
388 |
1 |
assertEquals(c, i_faded); |
389 |
1 |
c = rs.findColour('S', 15, ferCapan); |
390 |
1 |
Color s_faded = new Color(144, 225, 144); |
391 |
1 |
assertEquals(c, s_faded); |
392 |
|
|
393 |
|
|
394 |
|
|
395 |
|
|
396 |
1 |
af.conservationMenuItem_actionPerformed(false); |
397 |
1 |
c = rs.findColour('S', 15, ferCapan); |
398 |
1 |
assertEquals(c, s_original); |
399 |
|
|
400 |
|
|
401 |
|
|
402 |
|
|
403 |
|
|
404 |
1 |
af.abovePIDThreshold_actionPerformed(true); |
405 |
1 |
sp = SliderPanel.getSliderPanel(); |
406 |
1 |
assertFalse(sp.isForConservation()); |
407 |
1 |
assertEquals(sp.getValue(), 0); |
408 |
1 |
c = rs.findColour('I', 14, ferCapan); |
409 |
1 |
assertEquals(c, i_original); |
410 |
1 |
c = rs.findColour('S', 15, ferCapan); |
411 |
1 |
assertEquals(c, s_original); |
412 |
|
|
413 |
|
|
414 |
|
|
415 |
|
|
416 |
|
|
417 |
|
|
418 |
1 |
sp.valueChanged(1); |
419 |
1 |
c = rs.findColour('I', 14, ferCapan); |
420 |
1 |
assertEquals(c, Color.white); |
421 |
1 |
c = rs.findColour('S', 15, ferCapan); |
422 |
1 |
assertEquals(c, s_original); |
423 |
|
|
424 |
|
|
425 |
|
|
426 |
|
|
427 |
1 |
sp.valueChanged(66); |
428 |
1 |
c = rs.findColour('I', 14, ferCapan); |
429 |
1 |
assertEquals(c, Color.white); |
430 |
1 |
c = rs.findColour('S', 15, ferCapan); |
431 |
1 |
assertEquals(c, s_original); |
432 |
|
|
433 |
|
|
434 |
|
|
435 |
|
|
436 |
1 |
sp.valueChanged(67); |
437 |
1 |
c = rs.findColour('I', 14, ferCapan); |
438 |
1 |
assertEquals(c, Color.white); |
439 |
1 |
c = rs.findColour('S', 15, ferCapan); |
440 |
1 |
assertEquals(c, Color.white); |
441 |
|
|
442 |
|
|
443 |
|
|
444 |
|
|
445 |
1 |
af.abovePIDThreshold_actionPerformed(false); |
446 |
1 |
c = rs.findColour('I', 14, ferCapan); |
447 |
1 |
assertEquals(c, i_original); |
448 |
1 |
c = rs.findColour('S', 15, ferCapan); |
449 |
1 |
assertEquals(c, s_original); |
450 |
|
|
451 |
|
|
452 |
|
|
453 |
|
|
454 |
|
|
455 |
|
|
456 |
1 |
af.abovePIDThreshold_actionPerformed(true); |
457 |
1 |
sp = SliderPanel.getSliderPanel(); |
458 |
1 |
assertFalse(sp.isForConservation()); |
459 |
1 |
sp.valueChanged(50); |
460 |
1 |
af.conservationMenuItem_actionPerformed(true); |
461 |
1 |
sp = SliderPanel.getSliderPanel(); |
462 |
1 |
assertTrue(sp.isForConservation()); |
463 |
1 |
sp.valueChanged(10); |
464 |
1 |
c = rs.findColour('I', 14, ferCapan); |
465 |
1 |
assertEquals(c, Color.white); |
466 |
1 |
c = rs.findColour('S', 15, ferCapan); |
467 |
1 |
assertEquals(c, s_faded); |
468 |
|
|
469 |
|
|
470 |
|
|
471 |
|
|
472 |
1 |
af.abovePIDThreshold_actionPerformed(false); |
473 |
1 |
c = rs.findColour('I', 14, ferCapan); |
474 |
1 |
assertEquals(c, i_faded); |
475 |
1 |
c = rs.findColour('S', 15, ferCapan); |
476 |
1 |
assertEquals(c, s_faded); |
477 |
|
|
478 |
|
|
479 |
|
|
480 |
|
|
481 |
|
|
482 |
1 |
af.abovePIDThreshold_actionPerformed(true); |
483 |
1 |
SliderPanel.getSliderPanel().valueChanged(50); |
484 |
1 |
c = rs.findColour('I', 14, ferCapan); |
485 |
1 |
assertEquals(c, Color.white); |
486 |
1 |
c = rs.findColour('S', 15, ferCapan); |
487 |
1 |
assertEquals(c, s_faded); |
488 |
|
|
489 |
|
|
490 |
|
|
491 |
|
|
492 |
|
|
493 |
1 |
af.conservationMenuItem_actionPerformed(false); |
494 |
1 |
c = rs.findColour('I', 14, ferCapan); |
495 |
1 |
assertEquals(c, Color.white); |
496 |
1 |
c = rs.findColour('S', 15, ferCapan); |
497 |
1 |
assertEquals(c, s_original); |
498 |
|
|
499 |
|
|
500 |
|
|
501 |
|
|
502 |
1 |
af.abovePIDThreshold_actionPerformed(false); |
503 |
1 |
c = rs.findColour('I', 14, ferCapan); |
504 |
1 |
assertEquals(c, i_original); |
505 |
1 |
c = rs.findColour('S', 15, ferCapan); |
506 |
1 |
assertEquals(c, s_original); |
507 |
|
} |
508 |
|
|
509 |
|
|
510 |
|
|
511 |
|
|
512 |
|
|
513 |
|
|
514 |
|
|
515 |
|
@see |
516 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (63) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
517 |
1 |
@Test(groups = "Functional")... |
518 |
|
public void testNewView_colourThresholds() |
519 |
|
{ |
520 |
1 |
AlignViewport av = af.getViewport(); |
521 |
1 |
AlignmentI al = av.getAlignment(); |
522 |
|
|
523 |
|
|
524 |
|
|
525 |
|
|
526 |
1 |
af.changeColour_actionPerformed(JalviewColourScheme.Buried.toString()); |
527 |
1 |
assertTrue(av.getGlobalColourScheme() instanceof BuriedColourScheme); |
528 |
1 |
af.abovePIDThreshold_actionPerformed(true); |
529 |
1 |
SliderPanel sp = SliderPanel.getSliderPanel(); |
530 |
1 |
assertFalse(sp.isForConservation()); |
531 |
1 |
sp.valueChanged(10); |
532 |
1 |
af.conservationMenuItem_actionPerformed(true); |
533 |
1 |
sp = SliderPanel.getSliderPanel(); |
534 |
1 |
assertTrue(sp.isForConservation()); |
535 |
1 |
sp.valueChanged(20); |
536 |
1 |
ResidueShaderI rs = av.getResidueShading(); |
537 |
1 |
assertEquals(rs.getThreshold(), 10); |
538 |
1 |
assertTrue(rs.conservationApplied()); |
539 |
1 |
assertEquals(rs.getConservationInc(), 20); |
540 |
|
|
541 |
|
|
542 |
|
|
543 |
|
|
544 |
|
|
545 |
1 |
SequenceGroup sg = new SequenceGroup(); |
546 |
1 |
sg.addSequence(al.getSequenceAt(0), false); |
547 |
1 |
sg.setStartRes(15); |
548 |
1 |
sg.setEndRes(25); |
549 |
1 |
av.setSelectionGroup(sg); |
550 |
1 |
PopupMenu popupMenu = new PopupMenu(af.alignPanel, al.getSequenceAt(0), |
551 |
|
null); |
552 |
1 |
popupMenu.changeColour_actionPerformed( |
553 |
|
JalviewColourScheme.Strand.toString()); |
554 |
1 |
assertTrue(sg.getColourScheme() instanceof StrandColourScheme); |
555 |
1 |
assertEquals(al.getGroups().size(), 1); |
556 |
1 |
assertSame(al.getGroups().get(0), sg); |
557 |
1 |
popupMenu.conservationMenuItem_actionPerformed(true); |
558 |
1 |
sp = SliderPanel.getSliderPanel(); |
559 |
1 |
assertTrue(sp.isForConservation()); |
560 |
1 |
sp.valueChanged(30); |
561 |
1 |
popupMenu.abovePIDColour_actionPerformed(true); |
562 |
1 |
sp = SliderPanel.getSliderPanel(); |
563 |
1 |
assertFalse(sp.isForConservation()); |
564 |
1 |
sp.valueChanged(40); |
565 |
1 |
rs = sg.getGroupColourScheme(); |
566 |
1 |
assertTrue(rs.conservationApplied()); |
567 |
1 |
assertEquals(rs.getConservationInc(), 30); |
568 |
1 |
assertEquals(rs.getThreshold(), 40); |
569 |
|
|
570 |
|
|
571 |
|
|
572 |
|
|
573 |
1 |
af.conservationMenuItem_actionPerformed(true); |
574 |
1 |
sp = SliderPanel.getSliderPanel(); |
575 |
1 |
assertTrue(sp.isForConservation()); |
576 |
1 |
assertEquals(sp.getTitle(), MessageManager.formatMessage( |
577 |
|
"label.conservation_colour_increment", new String[] |
578 |
|
{ "Background" })); |
579 |
|
|
580 |
|
|
581 |
|
|
582 |
|
|
583 |
1 |
af.newView_actionPerformed(null); |
584 |
1 |
assertEquals(af.alignPanel.getViewName(), "View 1"); |
585 |
1 |
AlignViewport av2 = af.getViewport(); |
586 |
1 |
assertNotSame(av, av2); |
587 |
1 |
assertSame(av2, af.alignPanel.av); |
588 |
1 |
rs = av2.getResidueShading(); |
589 |
1 |
assertNotSame(av.getResidueShading(), rs); |
590 |
1 |
assertEquals(rs.getThreshold(), 10); |
591 |
1 |
assertTrue(rs.conservationApplied(), rs.toString()); |
592 |
1 |
assertEquals(rs.getConservationInc(), 20); |
593 |
1 |
assertEquals(av2.getAlignment().getGroups().size(), 1); |
594 |
1 |
sg = av2.getAlignment().getGroups().get(0); |
595 |
1 |
rs = sg.getGroupColourScheme(); |
596 |
1 |
assertTrue(rs.conservationApplied()); |
597 |
1 |
assertEquals(rs.getConservationInc(), 30); |
598 |
1 |
assertEquals(rs.getThreshold(), 40); |
599 |
|
|
600 |
|
|
601 |
|
|
602 |
|
|
603 |
|
|
604 |
1 |
sp = SliderPanel.getSliderPanel(); |
605 |
1 |
assertTrue(sp.isForConservation()); |
606 |
1 |
assertEquals(sp.getTitle(), MessageManager.formatMessage( |
607 |
|
"label.conservation_colour_increment", new String[] |
608 |
|
{ "View 1" })); |
609 |
1 |
sp.valueChanged(22); |
610 |
1 |
assertEquals(av2.getResidueShading().getConservationInc(), 22); |
611 |
|
} |
612 |
|
|
613 |
|
|
614 |
|
|
615 |
|
|
616 |
|
|
617 |
|
|
618 |
|
|
619 |
|
@see |
620 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
621 |
1 |
@Test(groups = "Functional")... |
622 |
|
public void testNewView_dsRefPreserved() |
623 |
|
{ |
624 |
1 |
AlignViewport av = af.getViewport(); |
625 |
1 |
AlignmentI al = av.getAlignment(); |
626 |
1 |
AlignmentI original_ds = al.getDataset(); |
627 |
1 |
af.newView_actionPerformed(null); |
628 |
1 |
assertNotEquals("New view didn't select the a new panel", av, |
629 |
|
af.getViewport()); |
630 |
1 |
org.testng.Assert.assertEquals(original_ds, |
631 |
|
af.getViewport().getAlignment().getDataset(), |
632 |
|
"Dataset was not preserved in new view"); |
633 |
|
} |
634 |
|
} |