1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.viewmodel; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
import static org.testng.Assert.assertFalse; |
25 |
|
import static org.testng.Assert.assertTrue; |
26 |
|
|
27 |
|
import jalview.analysis.AlignmentGenerator; |
28 |
|
import jalview.datamodel.AlignmentI; |
29 |
|
import jalview.datamodel.ColumnSelection; |
30 |
|
import jalview.datamodel.HiddenColumns; |
31 |
|
import jalview.datamodel.HiddenSequences; |
32 |
|
|
33 |
|
import java.beans.PropertyChangeEvent; |
34 |
|
import java.util.ArrayList; |
35 |
|
import java.util.Arrays; |
36 |
|
import java.util.Collections; |
37 |
|
import java.util.List; |
38 |
|
|
39 |
|
import org.testng.annotations.BeforeClass; |
40 |
|
import org.testng.annotations.BeforeMethod; |
41 |
|
import org.testng.annotations.Test; |
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (543) |
Complexity: 35 |
Complexity Density: 0.07 |
|
43 |
|
public class ViewportRangesTest |
44 |
|
{ |
45 |
|
|
46 |
|
AlignmentGenerator gen = new AlignmentGenerator(false); |
47 |
|
|
48 |
|
AlignmentI al = gen.generate(20, 30, 1, 5, 5); |
49 |
|
|
50 |
|
AlignmentI smallAl = gen.generate(7, 2, 2, 5, 5); |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
52 |
1 |
@BeforeClass(alwaysRun = true)... |
53 |
|
public void setUp() |
54 |
|
{ |
55 |
1 |
gen = new AlignmentGenerator(false); |
56 |
1 |
al = gen.generate(20, 30, 1, 5, 5); |
57 |
1 |
smallAl = gen.generate(7, 2, 2, 5, 5); |
58 |
|
} |
59 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
60 |
28 |
@BeforeMethod(alwaysRun = true)... |
61 |
|
public void cleanUp() |
62 |
|
{ |
63 |
28 |
ColumnSelection sel = new ColumnSelection(); |
64 |
28 |
al.getHiddenColumns().revealAllHiddenColumns(sel); |
65 |
28 |
al.getHiddenSequences().showAll(null); |
66 |
28 |
smallAl.getHiddenColumns().revealAllHiddenColumns(sel); |
67 |
28 |
smallAl.getHiddenSequences().showAll(null); |
68 |
|
} |
69 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
70 |
1 |
@Test(groups = { "Functional" })... |
71 |
|
public void testViewportRanges() |
72 |
|
{ |
73 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
74 |
|
|
75 |
1 |
assertEquals(vr.getStartRes(), 0); |
76 |
1 |
assertEquals(vr.getEndRes(), al.getWidth() - 1); |
77 |
1 |
assertEquals(vr.getStartSeq(), 0); |
78 |
1 |
assertEquals(vr.getEndSeq(), al.getHeight() - 1); |
79 |
|
} |
80 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
81 |
1 |
@Test(groups = { "Functional" })... |
82 |
|
public void testGetAbsoluteAlignmentHeight() |
83 |
|
{ |
84 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
85 |
|
|
86 |
1 |
assertEquals(vr.getAbsoluteAlignmentHeight(), al.getHeight()); |
87 |
|
|
88 |
1 |
al.getHiddenSequences().hideSequence(al.getSequenceAt(3)); |
89 |
1 |
assertEquals(vr.getAbsoluteAlignmentHeight(), al.getHeight() + 1); |
90 |
|
} |
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
92 |
1 |
@Test(groups = { "Functional" })... |
93 |
|
public void testGetAbsoluteAlignmentWidth() |
94 |
|
{ |
95 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
96 |
1 |
assertEquals(vr.getAbsoluteAlignmentWidth(), al.getWidth()); |
97 |
|
} |
98 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
99 |
1 |
@Test(groups = { "Functional" })... |
100 |
|
public void testSetEndSeq() |
101 |
|
{ |
102 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
103 |
1 |
vr.setEndSeq(-1); |
104 |
1 |
assertEquals(vr.getEndSeq(), 0); |
105 |
|
|
106 |
1 |
vr.setEndSeq(al.getHeight()); |
107 |
1 |
assertEquals(vr.getEndSeq(), al.getHeight() - 1); |
108 |
|
|
109 |
1 |
vr.setEndSeq(al.getHeight() - 1); |
110 |
1 |
assertEquals(vr.getEndSeq(), al.getHeight() - 1); |
111 |
|
} |
112 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
113 |
1 |
@Test(groups = { "Functional" })... |
114 |
|
public void testSetStartRes() |
115 |
|
{ |
116 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
117 |
1 |
vr.setStartRes(-1); |
118 |
1 |
assertEquals(vr.getStartRes(), 0); |
119 |
|
|
120 |
1 |
vr.setStartRes(al.getWidth()); |
121 |
1 |
assertEquals(vr.getStartRes(), al.getWidth() - 1); |
122 |
|
|
123 |
1 |
vr.setStartRes(al.getWidth() - 1); |
124 |
1 |
assertEquals(vr.getStartRes(), al.getWidth() - 1); |
125 |
|
} |
126 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
127 |
1 |
@Test(groups = { "Functional" })... |
128 |
|
public void testSetStartSeq() |
129 |
|
{ |
130 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
131 |
1 |
vr.setStartSeq(-1); |
132 |
1 |
assertEquals(vr.getStartSeq(), 0); |
133 |
|
|
134 |
1 |
vr.setStartSeq(al.getHeight() - vr.getViewportHeight() + 1); |
135 |
1 |
assertEquals(vr.getStartSeq(), al.getHeight() - vr.getViewportHeight()); |
136 |
|
|
137 |
1 |
vr.setStartSeq(al.getHeight() - vr.getViewportHeight()); |
138 |
1 |
assertEquals(vr.getStartSeq(), al.getHeight() - vr.getViewportHeight()); |
139 |
|
} |
140 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
141 |
1 |
@Test(groups = { "Functional" })... |
142 |
|
public void testSetStartEndRes() |
143 |
|
{ |
144 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
145 |
1 |
vr.setStartEndRes(-1, -1); |
146 |
1 |
assertEquals(vr.getStartRes(), 0); |
147 |
1 |
assertEquals(vr.getEndRes(), 0); |
148 |
|
|
149 |
1 |
vr.setStartEndRes(5, 19); |
150 |
1 |
assertEquals(vr.getStartRes(), 5); |
151 |
1 |
assertEquals(vr.getEndRes(), 19); |
152 |
|
|
153 |
1 |
vr.setStartEndRes(al.getWidth(), al.getWidth()); |
154 |
1 |
assertEquals(vr.getEndRes(), al.getWidth() - 1); |
155 |
|
|
156 |
1 |
ViewportRanges vrsmall = new ViewportRanges(smallAl); |
157 |
1 |
vrsmall.setStartEndRes(al.getWidth(), al.getWidth()); |
158 |
1 |
assertEquals(vrsmall.getEndRes(), 6); |
159 |
|
|
160 |
|
|
161 |
1 |
smallAl.getHiddenColumns().hideColumns(0, 6); |
162 |
1 |
vrsmall.setStartEndRes(0, 4); |
163 |
1 |
assertEquals(vrsmall.getStartRes(), 0); |
164 |
1 |
assertEquals(vrsmall.getEndRes(), 0); |
165 |
|
} |
166 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
167 |
1 |
@Test(groups = { "Functional" })... |
168 |
|
public void testSetStartEndSeq() |
169 |
|
{ |
170 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
171 |
1 |
vr.setStartEndSeq(-1, -1); |
172 |
1 |
assertEquals(vr.getStartSeq(), 0); |
173 |
1 |
assertEquals(vr.getEndSeq(), 0); |
174 |
|
|
175 |
1 |
vr.setStartEndSeq(5, 19); |
176 |
1 |
assertEquals(vr.getStartSeq(), 5); |
177 |
1 |
assertEquals(vr.getEndSeq(), 19); |
178 |
|
|
179 |
1 |
vr.setStartEndSeq(al.getHeight(), al.getHeight()); |
180 |
1 |
assertEquals(vr.getEndSeq(), al.getHeight() - 1); |
181 |
|
|
182 |
|
|
183 |
1 |
smallAl.getHiddenSequences().hideSequence(smallAl.getSequenceAt(0)); |
184 |
1 |
smallAl.getHiddenSequences().hideSequence(smallAl.getSequenceAt(0)); |
185 |
1 |
ViewportRanges vrsmall = new ViewportRanges(smallAl); |
186 |
1 |
vrsmall.setStartEndSeq(0, 3); |
187 |
1 |
assertEquals(vrsmall.getStartSeq(), 0); |
188 |
1 |
assertEquals(vrsmall.getEndSeq(), 0); |
189 |
|
} |
190 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
191 |
1 |
@Test(groups = { "Functional" })... |
192 |
|
public void testSetStartResAndSeq() |
193 |
|
{ |
194 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
195 |
1 |
vr.setViewportHeight(10); |
196 |
1 |
vr.setStartResAndSeq(3, 6); |
197 |
1 |
assertEquals(vr.getStartRes(), 3); |
198 |
1 |
assertEquals(vr.getStartSeq(), 6); |
199 |
1 |
assertEquals(vr.getEndRes(), 3 + vr.getViewportWidth() - 1); |
200 |
1 |
assertEquals(vr.getEndSeq(), 6 + vr.getViewportHeight() - 1); |
201 |
|
|
202 |
1 |
vr.setStartResAndSeq(10, 25); |
203 |
1 |
assertEquals(vr.getStartRes(), 10); |
204 |
1 |
assertEquals(vr.getStartSeq(), 19); |
205 |
1 |
assertEquals(vr.getEndRes(), 10 + vr.getViewportWidth() - 1); |
206 |
1 |
assertEquals(vr.getEndSeq(), 19 + vr.getViewportHeight() - 1); |
207 |
|
} |
208 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
209 |
1 |
@Test(groups = { "Functional" })... |
210 |
|
public void testSetViewportHeight() |
211 |
|
{ |
212 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
213 |
1 |
vr.setViewportHeight(13); |
214 |
1 |
assertEquals(vr.getViewportHeight(), 13); |
215 |
|
} |
216 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
217 |
1 |
@Test(groups = { "Functional" })... |
218 |
|
public void testSetViewportWidth() |
219 |
|
{ |
220 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
221 |
1 |
vr.setViewportWidth(13); |
222 |
1 |
assertEquals(vr.getViewportWidth(), 13); |
223 |
|
} |
224 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
1PASS
|
|
225 |
1 |
@Test(groups = { "Functional" })... |
226 |
|
public void testSetViewportStartAndHeight() |
227 |
|
{ |
228 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
229 |
1 |
vr.setViewportStartAndHeight(2, 6); |
230 |
1 |
assertEquals(vr.getViewportHeight(), 6); |
231 |
1 |
assertEquals(vr.getStartSeq(), 2); |
232 |
|
|
233 |
|
|
234 |
1 |
vr.setViewportStartAndHeight(-1, 7); |
235 |
1 |
assertEquals(vr.getViewportHeight(), 7); |
236 |
1 |
assertEquals(vr.getStartSeq(), 0); |
237 |
|
|
238 |
|
|
239 |
1 |
vr.setViewportStartAndHeight(35, 5); |
240 |
1 |
assertEquals(vr.getViewportHeight(), 5); |
241 |
1 |
assertEquals(vr.getStartSeq(), 24); |
242 |
|
} |
243 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
244 |
1 |
@Test(groups = { "Functional" })... |
245 |
|
public void testSetViewportStartAndWidth() |
246 |
|
{ |
247 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
248 |
1 |
vr.setViewportStartAndWidth(2, 6); |
249 |
1 |
assertEquals(vr.getViewportWidth(), 6); |
250 |
1 |
assertEquals(vr.getStartRes(), 2); |
251 |
|
|
252 |
|
|
253 |
1 |
vr.setViewportStartAndWidth(-1, 7); |
254 |
1 |
assertEquals(vr.getViewportWidth(), 7); |
255 |
1 |
assertEquals(vr.getStartRes(), 0); |
256 |
|
|
257 |
|
|
258 |
1 |
vr.setViewportStartAndWidth(35, 5); |
259 |
1 |
assertEquals(vr.getViewportWidth(), 5); |
260 |
1 |
assertEquals(vr.getStartRes(), 16); |
261 |
|
|
262 |
|
|
263 |
1 |
ViewportRanges vrsmall = new ViewportRanges(smallAl); |
264 |
1 |
vrsmall.setViewportStartAndWidth(0, 63); |
265 |
1 |
assertEquals(vrsmall.getViewportWidth(), 7); |
266 |
1 |
assertEquals(vrsmall.getStartRes(), 0); |
267 |
|
} |
268 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
269 |
1 |
@Test(groups = { "Functional" })... |
270 |
|
public void testPageUpDown() |
271 |
|
{ |
272 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
273 |
1 |
vr.setViewportStartAndHeight(8, 6); |
274 |
1 |
vr.pageDown(); |
275 |
1 |
assertEquals(vr.getStartSeq(), 13); |
276 |
|
|
277 |
1 |
vr.pageUp(); |
278 |
1 |
assertEquals(vr.getStartSeq(), 8); |
279 |
|
|
280 |
1 |
vr.pageUp(); |
281 |
1 |
assertEquals(vr.getStartSeq(), 3); |
282 |
|
|
283 |
1 |
vr.pageUp(); |
284 |
|
|
285 |
1 |
assertEquals(vr.getStartSeq(), 0); |
286 |
1 |
assertEquals(vr.getViewportHeight(), 6); |
287 |
|
|
288 |
1 |
vr.pageDown(); |
289 |
1 |
vr.pageDown(); |
290 |
1 |
vr.pageDown(); |
291 |
1 |
vr.pageDown(); |
292 |
1 |
vr.pageDown(); |
293 |
|
|
294 |
|
|
295 |
1 |
assertEquals(vr.getStartSeq(), 24); |
296 |
1 |
assertEquals(vr.getViewportHeight(), 6); |
297 |
|
} |
298 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
299 |
1 |
@Test(groups = { "Functional" })... |
300 |
|
public void testScrollUp() |
301 |
|
{ |
302 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
303 |
1 |
vr.setViewportStartAndHeight(1, 5); |
304 |
1 |
vr.scrollUp(true); |
305 |
1 |
assertEquals(vr.getStartSeq(), 0); |
306 |
|
|
307 |
1 |
vr.scrollUp(true); |
308 |
1 |
assertEquals(vr.getStartSeq(), 0); |
309 |
|
|
310 |
1 |
vr.setViewportStartAndHeight(24, 5); |
311 |
1 |
vr.scrollUp(false); |
312 |
1 |
assertEquals(vr.getStartSeq(), 25); |
313 |
|
|
314 |
1 |
vr.scrollUp(false); |
315 |
1 |
assertEquals(vr.getStartSeq(), 25); |
316 |
|
} |
317 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
318 |
1 |
@Test(groups = { "Functional" })... |
319 |
|
public void testScrollUpWithHidden() |
320 |
|
{ |
321 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
322 |
|
|
323 |
|
|
324 |
1 |
HiddenSequences hidden = new HiddenSequences(al); |
325 |
1 |
hidden.hideSequence(al.getSequenceAt(29)); |
326 |
|
|
327 |
1 |
vr.setViewportStartAndHeight(1, 5); |
328 |
1 |
vr.scrollUp(true); |
329 |
1 |
assertEquals(vr.getStartSeq(), 0); |
330 |
|
|
331 |
1 |
vr.scrollUp(true); |
332 |
1 |
assertEquals(vr.getStartSeq(), 0); |
333 |
|
|
334 |
1 |
vr.setViewportStartAndHeight(23, 5); |
335 |
1 |
vr.scrollUp(false); |
336 |
1 |
assertEquals(vr.getStartSeq(), 24); |
337 |
|
|
338 |
1 |
vr.scrollUp(false); |
339 |
1 |
assertEquals(vr.getStartSeq(), 24); |
340 |
|
} |
341 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
342 |
1 |
@Test(groups = { "Functional" })... |
343 |
|
public void testScrollRight() |
344 |
|
{ |
345 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
346 |
1 |
vr.setViewportStartAndWidth(1, 5); |
347 |
1 |
vr.scrollRight(false); |
348 |
1 |
assertEquals(vr.getStartRes(), 0); |
349 |
|
|
350 |
1 |
vr.scrollRight(false); |
351 |
1 |
assertEquals(vr.getStartRes(), 0); |
352 |
|
|
353 |
1 |
vr.setViewportStartAndWidth(15, 5); |
354 |
1 |
vr.scrollRight(true); |
355 |
1 |
assertEquals(vr.getStartRes(), 16); |
356 |
|
|
357 |
1 |
vr.scrollRight(true); |
358 |
1 |
assertEquals(vr.getStartRes(), 16); |
359 |
|
} |
360 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
361 |
1 |
@Test(groups = { "Functional" })... |
362 |
|
public void testScrollRightWithHidden() |
363 |
|
{ |
364 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
365 |
|
|
366 |
|
|
367 |
1 |
HiddenColumns cols = new HiddenColumns(); |
368 |
1 |
cols.hideColumns(19, 20); |
369 |
1 |
al.setHiddenColumns(cols); |
370 |
|
|
371 |
1 |
vr.setViewportStartAndWidth(1, 5); |
372 |
1 |
vr.scrollRight(false); |
373 |
1 |
assertEquals(vr.getStartRes(), 0); |
374 |
|
|
375 |
1 |
vr.scrollRight(false); |
376 |
1 |
assertEquals(vr.getStartRes(), 0); |
377 |
|
|
378 |
1 |
vr.setViewportStartAndWidth(13, 5); |
379 |
1 |
vr.scrollRight(true); |
380 |
1 |
assertEquals(vr.getStartRes(), 14); |
381 |
|
|
382 |
1 |
vr.scrollRight(true); |
383 |
1 |
assertEquals(vr.getStartRes(), 14); |
384 |
|
} |
385 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (21) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
386 |
1 |
@Test(groups = { "Functional" })... |
387 |
|
public void testScrollToWrappedVisible() |
388 |
|
{ |
389 |
1 |
AlignmentI al2 = gen.generate(60, 30, 1, 5, 5); |
390 |
|
|
391 |
1 |
ViewportRanges vr = new ViewportRanges(al2); |
392 |
|
|
393 |
|
|
394 |
1 |
vr.setViewportStartAndWidth(5, 10); |
395 |
1 |
assertEquals(vr.getStartRes(), 5); |
396 |
1 |
assertEquals(vr.getEndRes(), 14); |
397 |
|
|
398 |
|
|
399 |
1 |
assertFalse(vr.scrollToWrappedVisible(12)); |
400 |
1 |
assertEquals(vr.getStartRes(), 5); |
401 |
|
|
402 |
|
|
403 |
1 |
assertTrue(vr.scrollToWrappedVisible(2)); |
404 |
1 |
assertEquals(vr.getStartRes(), 0); |
405 |
1 |
assertEquals(vr.getEndRes(), 9); |
406 |
|
|
407 |
|
|
408 |
1 |
assertFalse(vr.scrollToWrappedVisible(9)); |
409 |
1 |
assertEquals(vr.getStartRes(), 0); |
410 |
|
|
411 |
|
|
412 |
1 |
assertTrue(vr.scrollToWrappedVisible(12)); |
413 |
1 |
assertEquals(vr.getStartRes(), 10); |
414 |
1 |
assertEquals(vr.getEndRes(), 19); |
415 |
|
|
416 |
1 |
vr.setStartRes(13); |
417 |
1 |
assertEquals(vr.getStartRes(), 13); |
418 |
1 |
assertEquals(vr.getEndRes(), 22); |
419 |
|
|
420 |
|
|
421 |
1 |
assertTrue(vr.scrollToWrappedVisible(45)); |
422 |
1 |
assertEquals(vr.getStartRes(), 43); |
423 |
1 |
assertEquals(vr.getEndRes(), 52); |
424 |
|
} |
425 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
426 |
1 |
@Test(groups = { "Functional" })... |
427 |
|
public void testScrollToVisible() |
428 |
|
{ |
429 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
430 |
1 |
vr.setViewportStartAndWidth(12, 5); |
431 |
1 |
vr.setViewportStartAndHeight(10, 6); |
432 |
1 |
vr.scrollToVisible(13, 14); |
433 |
|
|
434 |
|
|
435 |
1 |
assertEquals(vr.getStartRes(), 12); |
436 |
1 |
assertEquals(vr.getStartSeq(), 10); |
437 |
|
|
438 |
1 |
vr.scrollToVisible(5, 6); |
439 |
1 |
assertEquals(vr.getStartRes(), 5); |
440 |
1 |
assertEquals(vr.getStartSeq(), 6); |
441 |
|
|
442 |
|
|
443 |
1 |
al.getHiddenColumns().hideColumns(1, 3); |
444 |
1 |
vr.scrollToVisible(13, 3); |
445 |
1 |
assertEquals(vr.getStartRes(), 6); |
446 |
1 |
assertEquals(vr.getStartSeq(), 3); |
447 |
|
|
448 |
1 |
vr.scrollToVisible(2, 9); |
449 |
1 |
assertEquals(vr.getStartRes(), 0); |
450 |
1 |
assertEquals(vr.getStartSeq(), 4); |
451 |
|
} |
452 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (94) |
Complexity: 1 |
Complexity Density: 0.01 |
1PASS
|
|
453 |
1 |
@Test(groups = { "Functional" })... |
454 |
|
public void testEventFiring() |
455 |
|
{ |
456 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
457 |
1 |
MockPropChangeListener l = new MockPropChangeListener(vr); |
458 |
1 |
List<String> emptylist = new ArrayList<>(); |
459 |
|
|
460 |
1 |
vr.setViewportWidth(5); |
461 |
1 |
vr.setViewportHeight(5); |
462 |
1 |
l.reset(); |
463 |
|
|
464 |
|
|
465 |
1 |
vr.setStartRes(4); |
466 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTRES))); |
467 |
1 |
l.reset(); |
468 |
|
|
469 |
|
|
470 |
1 |
vr.setStartRes(4); |
471 |
1 |
assertTrue(l.verify(0, emptylist)); |
472 |
1 |
l.reset(); |
473 |
|
|
474 |
1 |
vr.setStartSeq(4); |
475 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTSEQ))); |
476 |
1 |
l.reset(); |
477 |
|
|
478 |
1 |
vr.setStartSeq(4); |
479 |
1 |
assertTrue(l.verify(0, emptylist)); |
480 |
1 |
l.reset(); |
481 |
|
|
482 |
1 |
vr.setEndSeq(10); |
483 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTSEQ))); |
484 |
1 |
l.reset(); |
485 |
|
|
486 |
1 |
vr.setEndSeq(10); |
487 |
1 |
assertTrue(l.verify(0, emptylist)); |
488 |
1 |
l.reset(); |
489 |
|
|
490 |
1 |
vr.setStartEndRes(2, 15); |
491 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTRES))); |
492 |
1 |
l.reset(); |
493 |
|
|
494 |
1 |
vr.setStartEndRes(2, 15); |
495 |
1 |
assertTrue(l.verify(0, emptylist)); |
496 |
1 |
l.reset(); |
497 |
|
|
498 |
|
|
499 |
1 |
vr.setStartEndRes(-1, 5); |
500 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTRES), |
501 |
|
Arrays.asList(0))); |
502 |
1 |
l.reset(); |
503 |
|
|
504 |
|
|
505 |
1 |
vr.setStartEndRes(0, -1); |
506 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.ENDRES), |
507 |
|
Arrays.asList(0))); |
508 |
1 |
l.reset(); |
509 |
|
|
510 |
1 |
vr.setStartEndSeq(2, 15); |
511 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTSEQ))); |
512 |
1 |
l.reset(); |
513 |
|
|
514 |
1 |
vr.setStartEndSeq(2, 15); |
515 |
1 |
assertTrue(l.verify(0, emptylist)); |
516 |
1 |
l.reset(); |
517 |
|
|
518 |
1 |
vr.setStartEndRes(2, 2); |
519 |
|
|
520 |
1 |
l.reset(); |
521 |
|
|
522 |
|
|
523 |
1 |
vr.setStartEndSeq(-1, 5); |
524 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTSEQ), |
525 |
|
Arrays.asList(0))); |
526 |
1 |
l.reset(); |
527 |
|
|
528 |
|
|
529 |
1 |
vr.setStartEndSeq(0, -1); |
530 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.ENDSEQ), |
531 |
|
Arrays.asList(0))); |
532 |
1 |
l.reset(); |
533 |
|
|
534 |
|
|
535 |
1 |
vr.setStartEndSeq(2, 15); |
536 |
1 |
l.reset(); |
537 |
|
|
538 |
|
|
539 |
1 |
vr.setViewportHeight(10); |
540 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.ENDSEQ))); |
541 |
1 |
l.reset(); |
542 |
|
|
543 |
1 |
vr.setViewportWidth(18); |
544 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.ENDRES))); |
545 |
1 |
l.reset(); |
546 |
|
|
547 |
|
|
548 |
1 |
vr.setViewportStartAndHeight(2, 16); |
549 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.ENDSEQ))); |
550 |
1 |
l.reset(); |
551 |
|
|
552 |
1 |
vr.setViewportStartAndWidth(1, 14); |
553 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTRES))); |
554 |
1 |
l.reset(); |
555 |
|
|
556 |
|
|
557 |
1 |
vr.pageUp(); |
558 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTSEQ))); |
559 |
1 |
l.reset(); |
560 |
|
|
561 |
1 |
vr.pageDown(); |
562 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTSEQ))); |
563 |
1 |
l.reset(); |
564 |
|
|
565 |
|
|
566 |
1 |
vr.scrollUp(true); |
567 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTSEQ))); |
568 |
1 |
l.reset(); |
569 |
|
|
570 |
1 |
vr.scrollUp(false); |
571 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTSEQ))); |
572 |
1 |
l.reset(); |
573 |
|
|
574 |
1 |
vr.scrollRight(true); |
575 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTRES))); |
576 |
1 |
l.reset(); |
577 |
|
|
578 |
1 |
vr.scrollRight(false); |
579 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTRES))); |
580 |
1 |
l.reset(); |
581 |
|
|
582 |
1 |
vr.scrollToVisible(10, 10); |
583 |
1 |
assertTrue(l.verify(4, |
584 |
|
Arrays.asList(ViewportRanges.STARTSEQ, ViewportRanges.STARTSEQ, |
585 |
|
ViewportRanges.STARTSEQ, ViewportRanges.STARTSEQ))); |
586 |
1 |
l.reset(); |
587 |
|
|
588 |
|
|
589 |
|
|
590 |
|
|
591 |
|
|
592 |
1 |
assertFalse(vr.scrollToWrappedVisible(5)); |
593 |
1 |
assertTrue(l.verify(0, Collections.<String> emptyList())); |
594 |
1 |
l.reset(); |
595 |
|
|
596 |
1 |
vr.scrollToWrappedVisible(25); |
597 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTRES))); |
598 |
1 |
l.reset(); |
599 |
|
|
600 |
|
|
601 |
1 |
vr.setStartResAndSeq(5, 7); |
602 |
1 |
assertTrue(l.verify(1, Arrays.asList(ViewportRanges.STARTRESANDSEQ), |
603 |
|
Arrays.asList(5, 7))); |
604 |
|
|
605 |
1 |
l.reset(); |
606 |
|
} |
607 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 3 |
Complexity Density: 0.25 |
1PASS
|
|
608 |
1 |
@Test(groups = { "Functional" })... |
609 |
|
public void testGetWrappedScrollPosition() |
610 |
|
{ |
611 |
1 |
AlignmentI al2 = gen.generate(157, 15, 1, 5, 5); |
612 |
1 |
ViewportRanges vr = new ViewportRanges(al2); |
613 |
1 |
vr.setStartEndRes(0, 39); |
614 |
1 |
int width = vr.getViewportWidth(); |
615 |
|
|
616 |
|
|
617 |
|
|
618 |
|
|
619 |
1 |
assertEquals(vr.getWrappedScrollPosition(0), 0); |
620 |
|
|
621 |
|
|
622 |
|
|
623 |
|
|
624 |
1 |
int i = 1; |
625 |
1 |
int j = width; |
626 |
41 |
for (; i <= j; i++) |
627 |
|
{ |
628 |
40 |
assertEquals(1, vr.getWrappedScrollPosition(i)); |
629 |
|
} |
630 |
|
|
631 |
|
|
632 |
|
|
633 |
|
|
634 |
1 |
j += width; |
635 |
41 |
for (; i <= j; i++) |
636 |
|
{ |
637 |
40 |
assertEquals(2, vr.getWrappedScrollPosition(i), "For " + i); |
638 |
|
} |
639 |
|
} |
640 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (61) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
641 |
1 |
@Test(groups = { "Functional" })... |
642 |
|
public void testPageUpDownWrapped() |
643 |
|
{ |
644 |
|
|
645 |
|
|
646 |
|
|
647 |
1 |
AlignmentI al2 = gen.generate(110, 15, 1, 5, 5); |
648 |
|
|
649 |
1 |
ViewportRanges vr = new ViewportRanges(al2); |
650 |
1 |
vr.setWrappedMode(true); |
651 |
|
|
652 |
|
|
653 |
1 |
vr.setViewportStartAndWidth(0, 40); |
654 |
1 |
int width = vr.getViewportWidth(); |
655 |
1 |
assertEquals(width, 40); |
656 |
1 |
assertEquals(vr.getStartRes(), 0); |
657 |
1 |
assertEquals(vr.getEndRes(), 39); |
658 |
1 |
assertEquals(vr.getStartSeq(), 0); |
659 |
1 |
assertEquals(vr.getEndSeq(), 14); |
660 |
|
|
661 |
|
|
662 |
1 |
vr.pageDown(); |
663 |
1 |
assertEquals(vr.getStartRes(), 40); |
664 |
1 |
assertEquals(vr.getEndRes(), 79); |
665 |
1 |
assertEquals(vr.getStartSeq(), 0); |
666 |
1 |
assertEquals(vr.getEndSeq(), 14); |
667 |
|
|
668 |
|
|
669 |
|
|
670 |
1 |
vr.pageDown(); |
671 |
1 |
assertEquals(vr.getStartRes(), 80); |
672 |
1 |
assertEquals(vr.getEndRes(), 119); |
673 |
1 |
assertEquals(vr.getStartSeq(), 0); |
674 |
1 |
assertEquals(vr.getEndSeq(), 14); |
675 |
|
|
676 |
|
|
677 |
1 |
vr.pageDown(); |
678 |
1 |
assertEquals(vr.getStartRes(), 80); |
679 |
1 |
assertEquals(vr.getEndRes(), 119); |
680 |
1 |
assertEquals(vr.getStartSeq(), 0); |
681 |
1 |
assertEquals(vr.getEndSeq(), 14); |
682 |
|
|
683 |
|
|
684 |
1 |
vr.pageUp(); |
685 |
1 |
assertEquals(vr.getStartRes(), 40); |
686 |
1 |
assertEquals(vr.getEndRes(), 79); |
687 |
1 |
assertEquals(vr.getStartSeq(), 0); |
688 |
1 |
assertEquals(vr.getEndSeq(), 14); |
689 |
|
|
690 |
|
|
691 |
1 |
vr.pageUp(); |
692 |
1 |
assertEquals(vr.getStartRes(), 0); |
693 |
1 |
assertEquals(vr.getEndRes(), 39); |
694 |
1 |
assertEquals(vr.getStartSeq(), 0); |
695 |
1 |
assertEquals(vr.getEndSeq(), 14); |
696 |
|
|
697 |
|
|
698 |
1 |
vr.pageUp(); |
699 |
1 |
assertEquals(vr.getStartRes(), 0); |
700 |
1 |
assertEquals(vr.getEndRes(), 39); |
701 |
1 |
assertEquals(vr.getStartSeq(), 0); |
702 |
1 |
assertEquals(vr.getEndSeq(), 14); |
703 |
|
|
704 |
|
|
705 |
|
|
706 |
|
|
707 |
1 |
vr.setStartRes(5); |
708 |
1 |
assertEquals(vr.getStartRes(), 5); |
709 |
1 |
assertEquals(vr.getEndRes(), 5 + width - 1); |
710 |
|
|
711 |
1 |
vr.pageDown(); |
712 |
1 |
assertEquals(vr.getStartRes(), 45); |
713 |
1 |
assertEquals(vr.getEndRes(), 84); |
714 |
|
|
715 |
1 |
vr.pageDown(); |
716 |
1 |
assertEquals(vr.getStartRes(), 85); |
717 |
1 |
assertEquals(vr.getEndRes(), 124); |
718 |
|
|
719 |
1 |
vr.pageDown(); |
720 |
1 |
assertEquals(vr.getStartRes(), 85); |
721 |
1 |
assertEquals(vr.getEndRes(), 124); |
722 |
|
|
723 |
1 |
vr.pageUp(); |
724 |
1 |
assertEquals(vr.getStartRes(), 45); |
725 |
1 |
assertEquals(vr.getEndRes(), 84); |
726 |
|
|
727 |
1 |
vr.pageUp(); |
728 |
1 |
assertEquals(vr.getStartRes(), 5); |
729 |
1 |
assertEquals(vr.getEndRes(), 44); |
730 |
|
|
731 |
1 |
vr.pageUp(); |
732 |
1 |
assertEquals(vr.getStartRes(), 0); |
733 |
1 |
assertEquals(vr.getEndRes(), 39); |
734 |
|
} |
735 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
736 |
1 |
@Test(groups = { "Functional" })... |
737 |
|
public void testSetStartEndResWrapped() |
738 |
|
{ |
739 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
740 |
1 |
vr.setWrappedMode(true); |
741 |
1 |
vr.setStartEndRes(-1, -1); |
742 |
1 |
assertEquals(vr.getStartRes(), 0); |
743 |
1 |
assertEquals(vr.getEndRes(), 0); |
744 |
|
|
745 |
1 |
vr.setStartEndRes(5, 19); |
746 |
1 |
assertEquals(vr.getStartRes(), 5); |
747 |
1 |
assertEquals(vr.getEndRes(), 19); |
748 |
|
|
749 |
|
|
750 |
|
|
751 |
1 |
vr.setStartEndRes(88, 888); |
752 |
1 |
assertEquals(vr.getStartRes(), 88); |
753 |
1 |
assertEquals(vr.getEndRes(), 888); |
754 |
|
|
755 |
1 |
ViewportRanges vrsmall = new ViewportRanges(smallAl); |
756 |
1 |
vrsmall.setWrappedMode(true); |
757 |
1 |
vrsmall.setStartEndRes(88, 888); |
758 |
1 |
assertEquals(vrsmall.getStartRes(), 88); |
759 |
1 |
assertEquals(vrsmall.getEndRes(), 888); |
760 |
|
|
761 |
|
|
762 |
1 |
smallAl.getHiddenColumns().hideColumns(0, 6); |
763 |
1 |
vrsmall.setStartEndRes(0, 4); |
764 |
1 |
assertEquals(vrsmall.getStartRes(), 0); |
765 |
1 |
assertEquals(vrsmall.getEndRes(), 4); |
766 |
|
} |
767 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
768 |
1 |
@Test(groups = { "Functional" })... |
769 |
|
public void testSetViewportStartAndWidthWrapped() |
770 |
|
{ |
771 |
1 |
ViewportRanges vr = new ViewportRanges(al); |
772 |
1 |
vr.setWrappedMode(true); |
773 |
1 |
vr.setViewportStartAndWidth(2, 6); |
774 |
1 |
assertEquals(vr.getViewportWidth(), 6); |
775 |
1 |
assertEquals(vr.getStartRes(), 2); |
776 |
|
|
777 |
|
|
778 |
1 |
vr.setViewportStartAndWidth(-1, 7); |
779 |
1 |
assertEquals(vr.getViewportWidth(), 7); |
780 |
1 |
assertEquals(vr.getStartRes(), 0); |
781 |
|
|
782 |
|
|
783 |
1 |
vr.setViewportStartAndWidth(35, 5); |
784 |
1 |
assertEquals(vr.getViewportWidth(), 5); |
785 |
1 |
assertEquals(vr.getStartRes(), 35); |
786 |
|
|
787 |
|
|
788 |
1 |
ViewportRanges vrsmall = new ViewportRanges(smallAl); |
789 |
1 |
vrsmall.setViewportStartAndWidth(0, 63); |
790 |
1 |
assertEquals(vrsmall.getViewportWidth(), 7); |
791 |
1 |
assertEquals(vrsmall.getStartRes(), 0); |
792 |
|
} |
793 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 4 |
Complexity Density: 0.36 |
1PASS
|
|
794 |
1 |
@Test(groups = { "Functional" })... |
795 |
|
public void testGetWrappedMaxScroll() |
796 |
|
{ |
797 |
|
|
798 |
1 |
int alignmentWidth = 140; |
799 |
1 |
AlignmentI al2 = gen.generate(alignmentWidth, 15, 1, 0, 5); |
800 |
1 |
ViewportRanges vr = new ViewportRanges(al2); |
801 |
1 |
vr.setStartEndRes(0, 39); |
802 |
1 |
int width = vr.getViewportWidth(); |
803 |
1 |
int partWidth = alignmentWidth % width; |
804 |
|
|
805 |
|
|
806 |
|
|
807 |
|
|
808 |
|
|
809 |
|
|
810 |
|
|
811 |
141 |
for (int col = 0; col < alignmentWidth; col++) |
812 |
|
{ |
813 |
140 |
int offset = col % width; |
814 |
140 |
if (offset > 0 && offset < partWidth) |
815 |
|
{ |
816 |
76 |
assertEquals(vr.getWrappedMaxScroll(col), 4, "col " + col); |
817 |
|
} |
818 |
|
else |
819 |
|
{ |
820 |
64 |
assertEquals(vr.getWrappedMaxScroll(col), 3, "col " + col); |
821 |
|
} |
822 |
|
} |
823 |
|
} |
824 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (28) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
825 |
1 |
@Test(groups = { "Functional" })... |
826 |
|
public void testScrollUp_wrapped() |
827 |
|
{ |
828 |
|
|
829 |
|
|
830 |
|
|
831 |
1 |
AlignmentI al2 = gen.generate(45, 30, 1, 0, 5); |
832 |
|
|
833 |
|
|
834 |
|
|
835 |
|
|
836 |
1 |
ViewportRanges vr = new ViewportRanges(al2); |
837 |
1 |
vr.setWrappedMode(true); |
838 |
1 |
vr.setViewportStartAndHeight(1, 5); |
839 |
|
|
840 |
|
|
841 |
|
|
842 |
|
|
843 |
1 |
vr.setStartEndRes(3, 22); |
844 |
|
|
845 |
1 |
int startRes = vr.getStartRes(); |
846 |
1 |
int width = vr.getViewportWidth(); |
847 |
1 |
assertEquals(startRes, 3); |
848 |
1 |
assertEquals(width, 20); |
849 |
|
|
850 |
|
|
851 |
|
|
852 |
1 |
vr.scrollUp(false); |
853 |
1 |
assertEquals(vr.getStartSeq(), 1); |
854 |
1 |
assertEquals(vr.getStartRes(), 23); |
855 |
|
|
856 |
|
|
857 |
1 |
vr.scrollUp(true); |
858 |
1 |
assertEquals(vr.getStartSeq(), 1); |
859 |
1 |
assertEquals(vr.getStartRes(), 3); |
860 |
|
|
861 |
|
|
862 |
1 |
vr.scrollUp(true); |
863 |
1 |
assertEquals(vr.getStartSeq(), 1); |
864 |
1 |
assertEquals(vr.getStartRes(), 0); |
865 |
|
|
866 |
|
|
867 |
|
|
868 |
|
|
869 |
1 |
vr.setStartEndRes(3, 22); |
870 |
1 |
vr.scrollUp(false); |
871 |
1 |
assertEquals(vr.getStartSeq(), 1); |
872 |
1 |
assertEquals(vr.getStartRes(), 23); |
873 |
1 |
vr.scrollUp(false); |
874 |
1 |
assertEquals(vr.getStartSeq(), 1); |
875 |
1 |
assertEquals(vr.getStartRes(), 43); |
876 |
|
|
877 |
|
|
878 |
|
|
879 |
|
|
880 |
1 |
vr.scrollUp(false); |
881 |
1 |
assertEquals(vr.getStartSeq(), 1); |
882 |
1 |
assertEquals(vr.getStartRes(), 43); |
883 |
|
} |
884 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (47) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
885 |
1 |
@Test(groups = { "Functional" })... |
886 |
|
public void testSetViewportLocation() |
887 |
|
{ |
888 |
1 |
AlignmentI al2 = gen.generate(60, 80, 1, 0, 0); |
889 |
|
|
890 |
1 |
ViewportRanges vr = new ViewportRanges(al2); |
891 |
|
|
892 |
|
|
893 |
1 |
vr.setViewportStartAndWidth(5, 10); |
894 |
1 |
assertEquals(vr.getStartRes(), 5); |
895 |
1 |
assertEquals(vr.getEndRes(), 14); |
896 |
|
|
897 |
1 |
vr.setViewportStartAndHeight(3, 13); |
898 |
1 |
assertEquals(vr.getStartSeq(), 3); |
899 |
1 |
assertEquals(vr.getEndSeq(), 15); |
900 |
|
|
901 |
|
|
902 |
1 |
vr.setViewportLocation(8, 5); |
903 |
1 |
assertEquals(vr.getStartRes(), 5); |
904 |
1 |
assertEquals(vr.getEndRes(), 14); |
905 |
1 |
assertEquals(vr.getStartSeq(), 3); |
906 |
1 |
assertEquals(vr.getEndSeq(), 15); |
907 |
|
|
908 |
|
|
909 |
1 |
vr.setViewportLocation(40, 50); |
910 |
1 |
assertEquals(vr.getStartRes(), 40); |
911 |
1 |
assertEquals(vr.getEndRes(), 49); |
912 |
1 |
assertEquals(vr.getStartSeq(), 50); |
913 |
1 |
assertEquals(vr.getEndSeq(), 62); |
914 |
|
|
915 |
|
|
916 |
1 |
vr.setViewportLocation(63, 85); |
917 |
1 |
assertEquals(vr.getStartRes(), 50); |
918 |
1 |
assertEquals(vr.getEndRes(), 59); |
919 |
1 |
assertEquals(vr.getStartSeq(), 67); |
920 |
1 |
assertEquals(vr.getEndSeq(), 79); |
921 |
|
|
922 |
|
|
923 |
1 |
al2.getHiddenColumns().hideColumns(20, 50); |
924 |
1 |
vr.setViewportLocation(55, 4); |
925 |
1 |
assertEquals(vr.getStartRes(), 19); |
926 |
1 |
assertEquals(vr.getEndRes(), 28); |
927 |
1 |
assertEquals(vr.getStartSeq(), 4); |
928 |
1 |
assertEquals(vr.getEndSeq(), 16); |
929 |
|
|
930 |
|
|
931 |
1 |
al2.getHiddenSequences().hideSequence(al2.getSequenceAt(3)); |
932 |
1 |
al2.getHiddenSequences().hideSequence(al2.getSequenceAt(4)); |
933 |
1 |
vr.setViewportLocation(17, 5); |
934 |
1 |
assertEquals(vr.getStartRes(), 17); |
935 |
1 |
assertEquals(vr.getEndRes(), 26); |
936 |
1 |
assertEquals(vr.getStartSeq(), 3); |
937 |
1 |
assertEquals(vr.getEndSeq(), 15); |
938 |
|
|
939 |
|
|
940 |
1 |
vr.setWrappedMode(true); |
941 |
1 |
vr.setViewportLocation(1, 8); |
942 |
1 |
assertEquals(vr.getStartRes(), 0); |
943 |
1 |
assertEquals(vr.getEndRes(), 9); |
944 |
1 |
assertEquals(vr.getStartSeq(), 3); |
945 |
1 |
assertEquals(vr.getEndSeq(), 15); |
946 |
|
|
947 |
|
|
948 |
1 |
vr.setViewportLocation(57, 5); |
949 |
1 |
assertEquals(vr.getStartRes(), 20); |
950 |
1 |
assertEquals(vr.getEndRes(), 29); |
951 |
1 |
assertEquals(vr.getStartSeq(), 3); |
952 |
1 |
assertEquals(vr.getEndSeq(), 15); |
953 |
|
} |
954 |
|
} |
955 |
|
|
956 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 6 |
Complexity Density: 0.5 |
|
957 |
|
class MockPropChangeListener implements ViewportListenerI |
958 |
|
{ |
959 |
|
private int firecount = 0; |
960 |
|
|
961 |
|
private List<String> events = new ArrayList<>(); |
962 |
|
|
963 |
|
private List<Integer> newvalues = new ArrayList<>(); |
964 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
965 |
1 |
public MockPropChangeListener(ViewportRanges vr)... |
966 |
|
{ |
967 |
1 |
vr.addPropertyChangeListener(this); |
968 |
|
} |
969 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
970 |
29 |
@Override... |
971 |
|
public void propertyChange(PropertyChangeEvent evt) |
972 |
|
{ |
973 |
29 |
firecount++; |
974 |
29 |
events.add(evt.getPropertyName()); |
975 |
29 |
if (evt.getPropertyName().equals(ViewportRanges.STARTRESANDSEQ)) |
976 |
|
{ |
977 |
1 |
newvalues.add(((int[]) evt.getNewValue())[0]); |
978 |
1 |
newvalues.add(((int[]) evt.getNewValue())[1]); |
979 |
|
} |
980 |
|
else |
981 |
|
{ |
982 |
28 |
newvalues.add((Integer) evt.getNewValue()); |
983 |
|
} |
984 |
|
} |
985 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
986 |
5 |
public boolean verify(int count, List<String> eventslist,... |
987 |
|
List<Integer> valueslist) |
988 |
|
{ |
989 |
5 |
return (count == firecount) && events.equals(eventslist) |
990 |
|
&& newvalues.equals(valueslist); |
991 |
|
} |
992 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
993 |
23 |
public boolean verify(int count, List<String> eventslist)... |
994 |
|
{ |
995 |
23 |
return (count == firecount) && events.equals(eventslist); |
996 |
|
} |
997 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
998 |
31 |
public void reset()... |
999 |
|
{ |
1000 |
31 |
firecount = 0; |
1001 |
31 |
events.clear(); |
1002 |
31 |
newvalues.clear(); |
1003 |
|
} |
1004 |
|
} |