1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.datamodel; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
|
25 |
|
import jalview.gui.AlignFrame; |
26 |
|
import jalview.gui.AlignViewport; |
27 |
|
import jalview.gui.JvOptionPane; |
28 |
|
import jalview.io.DataSourceType; |
29 |
|
import jalview.io.FileLoader; |
30 |
|
|
31 |
|
import org.testng.annotations.BeforeClass; |
32 |
|
import org.testng.annotations.Test; |
33 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (48) |
Complexity: 3 |
Complexity Density: 0.07 |
|
34 |
|
public class AlignmentViewTest |
35 |
|
{ |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
37 |
1 |
@BeforeClass(alwaysRun = true)... |
38 |
|
public void setUpJvOptionPane() |
39 |
|
{ |
40 |
1 |
JvOptionPane.setInteractiveMode(false); |
41 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
42 |
|
} |
43 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
44 |
1 |
@Test(groups = { "Functional" })... |
45 |
|
public void testGetVisibleAlignmentGapChar() |
46 |
|
{ |
47 |
1 |
SeqCigar ss = new SeqCigar(new Sequence("One", "A..CDE")); |
48 |
1 |
CigarArray ca = new CigarArray(new CigarSimple[] { ss }); |
49 |
1 |
AlignmentView av = new AlignmentView(ca); |
50 |
1 |
String dots = av.getSequenceStrings('.')[0]; |
51 |
1 |
assertEquals(dots, "A..CDE"); |
52 |
1 |
String dollars = av.getSequenceStrings('$')[0]; |
53 |
1 |
assertEquals(dollars, "A$$CDE"); |
54 |
1 |
assertEquals(av.getVisibleAlignment('$').getSequenceAt(0) |
55 |
|
.getSequenceAsString(), "A$$CDE"); |
56 |
|
} |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (35) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
58 |
1 |
@Test(groups = { "Functional" })... |
59 |
|
public void testGetVisibleContigs() |
60 |
|
{ |
61 |
1 |
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( |
62 |
|
">s1\n0123456789\n", DataSourceType.PASTE); |
63 |
1 |
AlignViewport av = af.getViewport(); |
64 |
1 |
AlignmentView view = av.getAlignmentView(true); |
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
1 |
int[] contigs = view.getVisibleContigs(); |
72 |
1 |
assertEquals(contigs, new int[] { 0, 9 }); |
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
1 |
av.hideColumns(5, 7); |
78 |
|
|
79 |
1 |
contigs = view.getVisibleContigs(); |
80 |
1 |
assertEquals(contigs, new int[] { 0, 9 }); |
81 |
|
|
82 |
1 |
view = av.getAlignmentView(true); |
83 |
1 |
contigs = view.getVisibleContigs(); |
84 |
1 |
assertEquals(contigs, new int[] { 0, 4, 8, 9 }); |
85 |
|
|
86 |
|
|
87 |
1 |
av.hideColumns(0, 1); |
88 |
1 |
view = av.getAlignmentView(true); |
89 |
1 |
contigs = view.getVisibleContigs(); |
90 |
1 |
assertEquals(contigs, new int[] { 2, 4, 8, 9 }); |
91 |
|
|
92 |
|
|
93 |
1 |
av.hideColumns(9, 9); |
94 |
1 |
view = av.getAlignmentView(true); |
95 |
1 |
contigs = view.getVisibleContigs(); |
96 |
1 |
assertEquals(contigs, new int[] { 2, 4, 8, 8 }); |
97 |
|
|
98 |
|
|
99 |
1 |
av.showColumn(5); |
100 |
1 |
view = av.getAlignmentView(true); |
101 |
1 |
contigs = view.getVisibleContigs(); |
102 |
1 |
assertEquals(contigs, new int[] { 2, 8 }); |
103 |
|
|
104 |
|
|
105 |
1 |
av.hideColumns(2, 7); |
106 |
1 |
view = av.getAlignmentView(true); |
107 |
1 |
contigs = view.getVisibleContigs(); |
108 |
1 |
assertEquals(contigs, new int[] { 8, 8 }); |
109 |
|
|
110 |
|
|
111 |
1 |
av.hideColumns(8, 8); |
112 |
1 |
view = av.getAlignmentView(true); |
113 |
1 |
contigs = view.getVisibleContigs(); |
114 |
1 |
assertEquals(contigs, new int[] {}); |
115 |
|
|
116 |
|
|
117 |
1 |
av.showAllHiddenColumns(); |
118 |
1 |
view = av.getAlignmentView(true); |
119 |
1 |
contigs = view.getVisibleContigs(); |
120 |
1 |
assertEquals(contigs, new int[] { 0, 9 }); |
121 |
|
} |
122 |
|
} |