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