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.Alignment; |
29 |
|
import jalview.datamodel.AlignmentI; |
30 |
|
import jalview.datamodel.ColumnSelection; |
31 |
|
import jalview.datamodel.HiddenColumns; |
32 |
|
import jalview.datamodel.Sequence; |
33 |
|
import jalview.datamodel.SequenceCollectionI; |
34 |
|
import jalview.datamodel.SequenceGroup; |
35 |
|
import jalview.datamodel.SequenceI; |
36 |
|
|
37 |
|
import java.util.Hashtable; |
38 |
|
|
39 |
|
import org.testng.annotations.AfterClass; |
40 |
|
import org.testng.annotations.BeforeClass; |
41 |
|
import org.testng.annotations.BeforeMethod; |
42 |
|
import org.testng.annotations.Test; |
43 |
|
|
44 |
|
@Test(singleThreaded = true) |
|
|
| 100% |
Uncovered Elements: 0 (569) |
Complexity: 29 |
Complexity Density: 0.05 |
|
45 |
|
public class OverviewDimensionsShowHiddenTest |
46 |
|
{ |
47 |
|
AlignmentI al; |
48 |
|
OverviewDimensionsShowHidden od; |
49 |
|
|
50 |
|
|
51 |
|
int boxWidth; |
52 |
|
int boxHeight; |
53 |
|
int viewHeight; |
54 |
|
int viewWidth; |
55 |
|
int alheight; |
56 |
|
int alwidth; |
57 |
|
|
58 |
|
ViewportRanges vpranges; |
59 |
|
|
60 |
|
Hashtable<SequenceI, SequenceCollectionI> hiddenRepSequences = new Hashtable<>(); |
61 |
|
|
62 |
|
HiddenColumns hiddenCols = new HiddenColumns(); |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
64 |
1 |
@BeforeClass(alwaysRun = true)... |
65 |
|
public void setUpAlignment() |
66 |
|
{ |
67 |
|
|
68 |
1 |
AlignmentGenerator gen = new AlignmentGenerator(false); |
69 |
1 |
al = gen.generate(157, 525, 123, 5, 5); |
70 |
|
} |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 2 |
Complexity Density: 0.11 |
|
72 |
18 |
@BeforeMethod(alwaysRun = true)... |
73 |
|
public void setUp() |
74 |
|
{ |
75 |
18 |
if (!hiddenRepSequences.isEmpty()) |
76 |
|
{ |
77 |
16 |
al.getHiddenSequences().showAll(hiddenRepSequences); |
78 |
|
} |
79 |
18 |
ColumnSelection colsel = new ColumnSelection(); |
80 |
18 |
hiddenCols.revealAllHiddenColumns(colsel); |
81 |
|
|
82 |
18 |
vpranges = new ViewportRanges(al); |
83 |
18 |
vpranges.setViewportStartAndHeight(0, 18); |
84 |
18 |
vpranges.setViewportStartAndWidth(0, 63); |
85 |
|
|
86 |
18 |
viewHeight = vpranges.getEndSeq() - vpranges.getStartSeq() + 1; |
87 |
18 |
viewWidth = vpranges.getEndRes() - vpranges.getStartRes() + 1; |
88 |
|
|
89 |
18 |
HiddenColumns hiddenCols = new HiddenColumns(); |
90 |
|
|
91 |
18 |
od = new OverviewDimensionsShowHidden(vpranges, true); |
92 |
|
|
93 |
18 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
94 |
|
|
95 |
18 |
mouseClick(od, 0, 0); |
96 |
18 |
moveViewport(0, 0); |
97 |
|
|
98 |
|
|
99 |
18 |
alheight = vpranges.getAbsoluteAlignmentHeight(); |
100 |
18 |
alwidth = vpranges.getAbsoluteAlignmentWidth(); |
101 |
|
|
102 |
18 |
boxWidth = Math.round((float) (vpranges.getEndRes() |
103 |
|
- vpranges.getStartRes() + 1) |
104 |
|
* od.getWidth() / alwidth); |
105 |
18 |
boxHeight = Math.round((float) (vpranges.getEndSeq() |
106 |
|
- vpranges.getStartSeq() + 1) |
107 |
|
* od.getSequencesHeight() / alheight); |
108 |
|
} |
109 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
110 |
1 |
@AfterClass(alwaysRun = true)... |
111 |
|
public void cleanUp() |
112 |
|
{ |
113 |
1 |
al = null; |
114 |
|
} |
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (51) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
120 |
1 |
@Test(groups = { "Functional" })... |
121 |
|
public void testConstructor() |
122 |
|
{ |
123 |
1 |
SequenceI seqa = new Sequence("Seq1", "ABC"); |
124 |
1 |
SequenceI seqb = new Sequence("Seq2", "ABC"); |
125 |
1 |
SequenceI seqc = new Sequence("Seq3", "ABC"); |
126 |
1 |
SequenceI seqd = new Sequence("Seq4", "ABC"); |
127 |
1 |
SequenceI seqe = new Sequence("Seq5", |
128 |
|
"ABCABCABCABCABCABCABCABCBACBACBACBAC"); |
129 |
|
|
130 |
1 |
int defaultGraphHeight = 20; |
131 |
1 |
int maxWidth = 400; |
132 |
1 |
int minWidth = 120; |
133 |
1 |
int maxSeqHeight = 300; |
134 |
1 |
int minSeqHeight = 40; |
135 |
|
|
136 |
|
|
137 |
1 |
SequenceI[] seqs1 = new SequenceI[] { seqa, seqb }; |
138 |
1 |
Alignment al1 = new Alignment(seqs1); |
139 |
1 |
ViewportRanges props = new ViewportRanges(al1); |
140 |
|
|
141 |
1 |
OverviewDimensions od = new OverviewDimensionsShowHidden(props, true); |
142 |
1 |
int scaledHeight = 267; |
143 |
1 |
assertEquals(od.getGraphHeight(), defaultGraphHeight); |
144 |
1 |
assertEquals(od.getSequencesHeight(), scaledHeight); |
145 |
1 |
assertEquals(od.getWidth(), maxWidth); |
146 |
1 |
assertEquals(od.getHeight(), scaledHeight + defaultGraphHeight); |
147 |
|
|
148 |
|
|
149 |
1 |
SequenceI[] seqs2 = new SequenceI[] { seqa, seqb, seqc, seqd }; |
150 |
1 |
Alignment al2 = new Alignment(seqs2); |
151 |
1 |
props = new ViewportRanges(al2); |
152 |
|
|
153 |
1 |
od = new OverviewDimensionsShowHidden(props, true); |
154 |
1 |
int scaledWidth = 300; |
155 |
1 |
assertEquals(od.getGraphHeight(), defaultGraphHeight); |
156 |
1 |
assertEquals(od.getSequencesHeight(), maxSeqHeight); |
157 |
1 |
assertEquals(od.getWidth(), scaledWidth); |
158 |
1 |
assertEquals(od.getHeight(), scaledWidth + defaultGraphHeight); |
159 |
|
|
160 |
|
|
161 |
|
|
162 |
1 |
SequenceI[] seqs3 = new SequenceI[] { seqe }; |
163 |
1 |
Alignment al3 = new Alignment(seqs3); |
164 |
1 |
props = new ViewportRanges(al3); |
165 |
|
|
166 |
1 |
od = new OverviewDimensionsShowHidden(props, true); |
167 |
1 |
assertEquals(od.getGraphHeight(), defaultGraphHeight); |
168 |
1 |
assertEquals(od.getSequencesHeight(), minSeqHeight); |
169 |
1 |
assertEquals(od.getWidth(), maxWidth); |
170 |
1 |
assertEquals(od.getHeight(), minSeqHeight + defaultGraphHeight); |
171 |
|
|
172 |
|
|
173 |
1 |
SequenceI[] seqs4 = new SequenceI[] { seqa, seqb, seqc, seqd, seqa, |
174 |
|
seqb, seqc, seqd, seqa, seqb, seqc, seqd, seqa, seqb, seqc, seqd }; |
175 |
1 |
Alignment al4 = new Alignment(seqs4); |
176 |
1 |
props = new ViewportRanges(al4); |
177 |
|
|
178 |
1 |
od = new OverviewDimensionsShowHidden(props, true); |
179 |
1 |
assertEquals(od.getGraphHeight(), defaultGraphHeight); |
180 |
1 |
assertEquals(od.getSequencesHeight(), maxSeqHeight); |
181 |
1 |
assertEquals(od.getWidth(), minWidth); |
182 |
1 |
assertEquals(od.getHeight(), maxSeqHeight + defaultGraphHeight); |
183 |
|
|
184 |
1 |
Alignment al5 = new Alignment(seqs4); |
185 |
1 |
props = new ViewportRanges(al5); |
186 |
|
|
187 |
1 |
od = new OverviewDimensionsShowHidden(props, false); |
188 |
1 |
assertEquals(od.getGraphHeight(), 0); |
189 |
1 |
assertEquals(od.getSequencesHeight(), maxSeqHeight); |
190 |
1 |
assertEquals(od.getWidth(), minWidth); |
191 |
1 |
assertEquals(od.getHeight(), maxSeqHeight); |
192 |
|
} |
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (55) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
199 |
1 |
@Test(groups = { "Functional" })... |
200 |
|
public void testSetBoxFromMouseClick() |
201 |
|
{ |
202 |
1 |
od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); |
203 |
1 |
assertEquals(od.getBoxX(), 0); |
204 |
1 |
assertEquals(od.getBoxY(), 0); |
205 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
206 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
207 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
208 |
|
|
209 |
|
|
210 |
1 |
mouseClick(od, -5, 10); |
211 |
1 |
assertEquals(od.getBoxX(), 0); |
212 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
213 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
214 |
1 |
assertEquals(vpranges.getStartSeq() + vpranges.getViewportHeight() / 2, |
215 |
|
Math.round((float) 10 * alheight / od.getSequencesHeight())); |
216 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
217 |
|
|
218 |
|
|
219 |
1 |
mouseClick(od, 6, -2); |
220 |
1 |
assertEquals(od.getBoxY(), 0); |
221 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
222 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
223 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
224 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
225 |
|
|
226 |
|
|
227 |
1 |
mouseClick(od, 101, 6); |
228 |
1 |
assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth()); |
229 |
1 |
assertEquals(od.getBoxY(), 1); |
230 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
231 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
232 |
1 |
assertEquals(vpranges.getStartRes(), |
233 |
|
Math.round((float) od.getBoxX() * alwidth / od.getWidth())); |
234 |
1 |
assertEquals( |
235 |
|
vpranges.getStartSeq(), |
236 |
|
Math.round((float) od.getBoxY() * alheight |
237 |
|
/ od.getSequencesHeight())); |
238 |
|
|
239 |
|
|
240 |
1 |
mouseClick(od, 10, 520); |
241 |
1 |
assertEquals(od.getBoxX(), 0); |
242 |
1 |
assertEquals(od.getBoxY(), od.getSequencesHeight() - od.getBoxHeight()); |
243 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
244 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
245 |
1 |
assertEquals(0, |
246 |
|
Math.round((float) od.getBoxX() * alwidth / od.getWidth())); |
247 |
|
|
248 |
|
|
249 |
|
|
250 |
|
|
251 |
1 |
assertEquals( |
252 |
|
vpranges.getStartSeq(), |
253 |
|
Math.round((float) od.getBoxY() * alheight |
254 |
|
/ od.getSequencesHeight()) - 1); |
255 |
|
|
256 |
|
|
257 |
1 |
mouseClick(od, 3000, 5); |
258 |
1 |
assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth()); |
259 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
260 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
261 |
1 |
assertEquals(vpranges.getStartRes(), |
262 |
|
Math.round((float) od.getBoxX() * alwidth / od.getWidth())); |
263 |
1 |
assertEquals( |
264 |
|
vpranges.getStartSeq(), |
265 |
|
Math.round((float) od.getBoxY() * alheight |
266 |
|
/ od.getSequencesHeight())); |
267 |
|
|
268 |
|
|
269 |
1 |
moveViewportH(20); |
270 |
|
|
271 |
|
|
272 |
1 |
int oldboxx = od.getBoxX(); |
273 |
1 |
int oldboxy = od.getBoxY(); |
274 |
1 |
mouseClick(od, od.getBoxX() + od.getBoxWidth() / 2 + 6, |
275 |
|
od.getBoxY() + od.getBoxHeight() / 2 + 3); |
276 |
1 |
assertEquals(od.getBoxX(), oldboxx + 6); |
277 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
278 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
279 |
1 |
assertEquals(vpranges.getStartRes(), |
280 |
|
Math.round((float) od.getBoxX() * alwidth / od.getWidth())); |
281 |
1 |
assertEquals(od.getBoxY(), oldboxy + 3); |
282 |
1 |
assertEquals( |
283 |
|
vpranges.getStartSeq(), |
284 |
|
Math.round((float) od.getBoxY() * alheight |
285 |
|
/ od.getSequencesHeight())); |
286 |
|
|
287 |
|
|
288 |
1 |
mouseClick(od, 0, 0); |
289 |
1 |
assertEquals(od.getBoxX(), 0); |
290 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
291 |
1 |
assertEquals(od.getBoxY(), 0); |
292 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
293 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
294 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
295 |
|
} |
296 |
|
|
297 |
|
|
298 |
|
|
299 |
|
|
300 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (35) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
301 |
1 |
@Test(groups = { "Functional" })... |
302 |
|
public void testFromMouseWithHiddenColsAtStart() |
303 |
|
{ |
304 |
1 |
od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); |
305 |
1 |
assertEquals(od.getBoxX(), 0); |
306 |
1 |
assertEquals(od.getBoxY(), 0); |
307 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
308 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
309 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
310 |
|
|
311 |
|
|
312 |
|
|
313 |
1 |
int lastHiddenCol = 30; |
314 |
1 |
hiddenCols.hideColumns(0, lastHiddenCol); |
315 |
|
|
316 |
1 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
317 |
1 |
assertEquals(od.getBoxX(), |
318 |
|
Math.round((float) (lastHiddenCol + 1) * od.getWidth() |
319 |
|
/ alwidth)); |
320 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
321 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
322 |
|
|
323 |
|
|
324 |
1 |
int xpos = 10; |
325 |
1 |
mouseClick(od, xpos, 0); |
326 |
1 |
assertEquals( |
327 |
|
od.getBoxX(), |
328 |
|
Math.round((float) (lastHiddenCol + 1) * od.getWidth() |
329 |
|
/ alwidth)); |
330 |
1 |
assertEquals(od.getBoxY(), 0); |
331 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
332 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
333 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
334 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
335 |
|
|
336 |
|
|
337 |
1 |
mouseClick(od, 60 + boxWidth / 2, boxHeight / 2); |
338 |
1 |
assertEquals(od.getBoxX(), 60); |
339 |
1 |
assertEquals(od.getBoxY(), 0); |
340 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
341 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
342 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
343 |
1 |
assertEquals(vpranges.getStartRes(), |
344 |
|
Math.round( |
345 |
|
(float) 60 * alwidth / od.getWidth()) |
346 |
|
- (lastHiddenCol + 1)); |
347 |
|
|
348 |
|
|
349 |
|
|
350 |
|
|
351 |
|
|
352 |
1 |
xpos = 100; |
353 |
1 |
mouseClick(od, xpos + boxWidth / 2, 5 + boxHeight / 2); |
354 |
1 |
assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth()); |
355 |
1 |
assertEquals(od.getBoxY(), 5); |
356 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
357 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
358 |
1 |
assertEquals(vpranges.getStartRes(), |
359 |
|
Math.round((float) od.getBoxX() * alwidth / od.getWidth()) |
360 |
|
- (lastHiddenCol + 1)); |
361 |
1 |
assertEquals( |
362 |
|
vpranges.getStartSeq(), |
363 |
|
Math.round((float) od.getBoxY() * alheight |
364 |
|
/ od.getSequencesHeight())); |
365 |
|
} |
366 |
|
|
367 |
|
|
368 |
|
|
369 |
|
|
370 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (47) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
371 |
1 |
@Test(groups = { "Functional" })... |
372 |
|
public void testFromMouseWithHiddenColsInMiddle() |
373 |
|
{ |
374 |
1 |
od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); |
375 |
1 |
assertEquals(od.getBoxX(), 0); |
376 |
1 |
assertEquals(od.getBoxY(), 0); |
377 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
378 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
379 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
380 |
|
|
381 |
|
|
382 |
1 |
int firstHidden = 63; |
383 |
1 |
int lastHidden = 73; |
384 |
1 |
hiddenCols.hideColumns(firstHidden, lastHidden); |
385 |
|
|
386 |
1 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
387 |
1 |
assertEquals(od.getBoxX(), 0); |
388 |
1 |
assertEquals(od.getBoxY(), 0); |
389 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
390 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
391 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
392 |
|
|
393 |
|
|
394 |
|
|
395 |
1 |
int xpos = 54 - boxWidth / 2; |
396 |
|
|
397 |
1 |
mouseClick(od, xpos, boxHeight / 2); |
398 |
1 |
assertEquals(od.getBoxX(), xpos - boxWidth / 2); |
399 |
1 |
assertEquals(od.getBoxY(), 0); |
400 |
1 |
assertEquals( |
401 |
|
od.getBoxWidth(), |
402 |
|
Math.round(boxWidth + (float) (lastHidden - firstHidden + 1) |
403 |
|
* od.getWidth() / alwidth)); |
404 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
405 |
1 |
assertEquals(vpranges.getStartRes(), |
406 |
|
Math.round((xpos - boxWidth / 2) * alwidth / od.getWidth()) |
407 |
|
+ 1); |
408 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
409 |
|
|
410 |
|
|
411 |
|
|
412 |
1 |
xpos = 24 + boxWidth / 2; |
413 |
1 |
mouseClick(od, xpos, 0); |
414 |
1 |
assertEquals(od.getBoxX(), 24); |
415 |
1 |
assertEquals(od.getBoxY(), 0); |
416 |
1 |
assertEquals( |
417 |
|
od.getBoxWidth(), |
418 |
|
Math.round(boxWidth + (float) (lastHidden - firstHidden + 1) |
419 |
|
* od.getWidth() / alwidth)); |
420 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
421 |
1 |
assertEquals(vpranges.getStartRes(), |
422 |
|
Math.round((float) 24 * alwidth / od.getWidth())); |
423 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
424 |
|
|
425 |
|
|
426 |
|
|
427 |
|
|
428 |
1 |
xpos = Math.round((float) 75 * od.getWidth() / alwidth) + boxWidth / 2; |
429 |
1 |
mouseClick(od, xpos, boxHeight / 2); |
430 |
1 |
assertEquals(od.getBoxX(), xpos - boxWidth / 2); |
431 |
1 |
assertEquals(od.getBoxY(), 0); |
432 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
433 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
434 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
435 |
1 |
assertEquals(vpranges.getStartRes(), |
436 |
|
75 - (lastHidden - firstHidden + 1)); |
437 |
|
|
438 |
|
|
439 |
|
|
440 |
1 |
xpos = 3000; |
441 |
1 |
mouseClick(od, xpos, 5); |
442 |
1 |
assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth()); |
443 |
1 |
assertEquals(od.getBoxY(), 0); |
444 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
445 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
446 |
1 |
assertEquals( |
447 |
|
vpranges.getStartRes(), |
448 |
|
Math.round(((float) od.getBoxX() * alwidth / od.getWidth()) |
449 |
|
- (lastHidden - firstHidden + 1))); |
450 |
1 |
assertEquals( |
451 |
|
vpranges.getStartSeq(), |
452 |
|
Math.round((float) od.getBoxY() * alheight |
453 |
|
/ od.getSequencesHeight())); |
454 |
|
|
455 |
|
} |
456 |
|
|
457 |
|
|
458 |
|
|
459 |
|
|
460 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (42) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
461 |
1 |
@Test(groups = { "Functional" })... |
462 |
|
public void testFromMouseWithHiddenColsAtEnd() |
463 |
|
{ |
464 |
1 |
od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); |
465 |
1 |
assertEquals(od.getBoxX(), 0); |
466 |
1 |
assertEquals(od.getBoxY(), 0); |
467 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
468 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
469 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
470 |
|
|
471 |
|
|
472 |
1 |
int firstHidden = 140; |
473 |
1 |
int lastHidden = 164; |
474 |
1 |
hiddenCols.hideColumns(firstHidden, lastHidden); |
475 |
1 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
476 |
1 |
assertEquals(od.getBoxX(), 0); |
477 |
1 |
assertEquals(od.getBoxY(), 0); |
478 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
479 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
480 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
481 |
|
|
482 |
|
|
483 |
|
|
484 |
1 |
int xpos = 30; |
485 |
1 |
int ypos = 6; |
486 |
1 |
testBoxIsAtClickPoint(xpos, ypos); |
487 |
1 |
assertEquals(vpranges.getStartSeq(), Math |
488 |
|
.round((float) (ypos - boxHeight / 2) * alheight |
489 |
|
/ od.getHeight())); |
490 |
1 |
assertEquals(vpranges.getStartRes(), Math.round( |
491 |
|
(float) (xpos - boxWidth / 2) * alwidth / od.getWidth())); |
492 |
|
|
493 |
|
|
494 |
|
|
495 |
1 |
xpos = Math.round((float) 145 * od.getWidth() / alwidth) - boxWidth; |
496 |
1 |
mouseClick(od, xpos + boxWidth / 2, boxHeight / 2); |
497 |
1 |
assertEquals(od.getBoxX(), |
498 |
|
Math.round((float) (firstHidden - 1) |
499 |
|
* od.getWidth() / alwidth) |
500 |
|
- boxWidth + 1); |
501 |
1 |
assertEquals(od.getBoxY(), 0); |
502 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
503 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
504 |
1 |
assertEquals(vpranges.getStartRes(), |
505 |
|
Math.round((float) (od.getBoxX()) * alwidth |
506 |
|
/ od.getWidth())); |
507 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
508 |
|
|
509 |
|
|
510 |
|
|
511 |
1 |
xpos = 115; |
512 |
1 |
assertEquals(od.getBoxX(), |
513 |
|
Math.round((float) (firstHidden - 1) * od.getWidth() / alwidth) |
514 |
|
- boxWidth + 1); |
515 |
1 |
assertEquals(od.getBoxY(), 0); |
516 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
517 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
518 |
1 |
assertEquals(vpranges.getStartRes(), |
519 |
|
Math.round((float) od.getBoxX() * alwidth / od.getWidth())); |
520 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
521 |
|
|
522 |
|
|
523 |
|
|
524 |
1 |
xpos = 3000; |
525 |
1 |
assertEquals(od.getBoxX(), |
526 |
|
Math.round((float) (firstHidden - 1) * od.getWidth() / alwidth) |
527 |
|
- boxWidth + 1); |
528 |
1 |
assertEquals(od.getBoxY(), 0); |
529 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
530 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
531 |
1 |
assertEquals(vpranges.getStartRes(), |
532 |
|
Math.round((float) od.getBoxX() * alwidth / od.getWidth())); |
533 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
534 |
|
} |
535 |
|
|
536 |
|
|
537 |
|
|
538 |
|
|
539 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
540 |
1 |
@Test(groups = { "Functional" })... |
541 |
|
public void testSetBoxFromViewport() |
542 |
|
{ |
543 |
|
|
544 |
1 |
moveViewport(0, 0); |
545 |
1 |
assertEquals(od.getBoxX(), 0); |
546 |
1 |
assertEquals(od.getBoxY(), 0); |
547 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
548 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
549 |
|
|
550 |
|
|
551 |
1 |
moveViewportH(70); |
552 |
1 |
assertEquals(od.getBoxX(), |
553 |
|
Math.round((float) 70 * od.getWidth() / alwidth)); |
554 |
1 |
assertEquals(od.getBoxY(), 0); |
555 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
556 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
557 |
|
|
558 |
|
|
559 |
1 |
moveViewportV(100); |
560 |
1 |
assertEquals(od.getBoxX(), |
561 |
|
Math.round((float) 70 * od.getWidth() / alwidth)); |
562 |
1 |
assertEquals(od.getBoxY(), |
563 |
|
Math.round(100 * od.getSequencesHeight() / alheight)); |
564 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
565 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
566 |
|
|
567 |
|
|
568 |
1 |
moveViewport(98, 508); |
569 |
1 |
assertEquals(od.getBoxX(), |
570 |
|
Math.round((float) 98 * od.getWidth() / alwidth)); |
571 |
1 |
assertEquals(od.getBoxY(), |
572 |
|
Math.round((float) 508 * od.getSequencesHeight() / alheight)); |
573 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
574 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
575 |
|
} |
576 |
|
|
577 |
|
|
578 |
|
|
579 |
|
|
580 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
581 |
1 |
@Test(groups = { "Functional" })... |
582 |
|
public void testSetBoxFromViewportHiddenColsAtStart() |
583 |
|
{ |
584 |
1 |
int firstHidden = 0; |
585 |
1 |
int lastHidden = 20; |
586 |
1 |
hiddenCols.hideColumns(firstHidden, lastHidden); |
587 |
|
|
588 |
|
|
589 |
1 |
moveViewport(0, 0); |
590 |
1 |
assertEquals(od.getBoxX(), |
591 |
|
Math.round((float) (lastHidden + 1) * od.getWidth() / alwidth)); |
592 |
1 |
assertEquals(od.getBoxY(), 0); |
593 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
594 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
595 |
|
|
596 |
|
|
597 |
|
|
598 |
1 |
moveViewport(98 - lastHidden - 1, 0); |
599 |
1 |
assertEquals(od.getBoxX(), |
600 |
|
Math.round((float) 98 * od.getWidth() / alwidth)); |
601 |
1 |
assertEquals(od.getBoxY(), 0); |
602 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
603 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
604 |
|
} |
605 |
|
|
606 |
|
|
607 |
|
|
608 |
|
|
609 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (23) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
610 |
1 |
@Test(groups = { "Functional" })... |
611 |
|
public void testSetBoxFromViewportHiddenColsInMiddle() |
612 |
|
{ |
613 |
1 |
int firstHidden = 68; |
614 |
1 |
int lastHidden = 78; |
615 |
1 |
hiddenCols.hideColumns(firstHidden, lastHidden); |
616 |
|
|
617 |
|
|
618 |
1 |
moveViewport(3, 0); |
619 |
|
|
620 |
1 |
assertEquals(od.getBoxX(), |
621 |
|
Math.round((float) 3 * od.getWidth() / alwidth)); |
622 |
1 |
assertEquals(od.getBoxY(), 0); |
623 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
624 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
625 |
|
|
626 |
|
|
627 |
1 |
moveViewport(10, 0); |
628 |
1 |
assertEquals(od.getBoxX(), |
629 |
|
Math.round((float) 10 * od.getWidth() / alwidth)); |
630 |
1 |
assertEquals(od.getBoxY(), 0); |
631 |
1 |
assertEquals( |
632 |
|
od.getBoxWidth(), |
633 |
|
boxWidth |
634 |
|
+ Math.round((float) (lastHidden - firstHidden + 1) |
635 |
|
* od.getWidth() / alwidth)); |
636 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
637 |
|
|
638 |
|
|
639 |
1 |
moveViewport(63, 0); |
640 |
1 |
assertEquals(od.getBoxX(), |
641 |
|
Math.round((float) 63 * od.getWidth() / alwidth)); |
642 |
1 |
assertEquals(od.getBoxY(), 0); |
643 |
1 |
assertEquals( |
644 |
|
od.getBoxWidth(), |
645 |
|
boxWidth |
646 |
|
+ Math.round((lastHidden - firstHidden + 1) |
647 |
|
* od.getWidth() / alwidth)); |
648 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
649 |
|
|
650 |
|
|
651 |
1 |
moveViewport(80 - (lastHidden - firstHidden + 1), 0); |
652 |
1 |
assertEquals(od.getBoxX(), |
653 |
|
Math.round((float) 80 * od.getWidth() / alwidth)); |
654 |
1 |
assertEquals(od.getBoxY(), 0); |
655 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
656 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
657 |
|
|
658 |
|
} |
659 |
|
|
660 |
|
|
661 |
|
|
662 |
|
|
663 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
664 |
1 |
@Test(groups = { "Functional" })... |
665 |
|
public void testSetBoxFromViewportHiddenColsAtEnd() |
666 |
|
{ |
667 |
1 |
int firstHidden = 152; |
668 |
1 |
int lastHidden = 164; |
669 |
1 |
hiddenCols.hideColumns(firstHidden, lastHidden); |
670 |
|
|
671 |
|
|
672 |
1 |
moveViewport(3, 0); |
673 |
1 |
assertEquals(od.getBoxX(), |
674 |
|
Math.round((float) 3 * od.getWidth() / alwidth)); |
675 |
1 |
assertEquals(od.getBoxY(), 0); |
676 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
677 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
678 |
|
|
679 |
|
|
680 |
|
|
681 |
|
|
682 |
1 |
moveViewport(firstHidden - viewWidth, 0); |
683 |
1 |
assertEquals(od.getBoxX(), |
684 |
|
Math.round((float) (firstHidden - viewWidth) |
685 |
|
* od.getWidth() / alwidth)); |
686 |
1 |
assertEquals(od.getBoxY(), 0); |
687 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
688 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
689 |
|
} |
690 |
|
|
691 |
|
|
692 |
|
|
693 |
|
|
694 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
695 |
1 |
@Test(groups = { "Functional" })... |
696 |
|
public void testSetBoxFromViewportHiddenRowsAtStart() |
697 |
|
{ |
698 |
1 |
int firstHidden = 0; |
699 |
1 |
int lastHidden = 20; |
700 |
1 |
hideSequences(firstHidden, lastHidden); |
701 |
|
|
702 |
|
|
703 |
|
|
704 |
1 |
moveViewport(0, 0); |
705 |
1 |
assertEquals(od.getBoxX(), 0); |
706 |
1 |
assertEquals(od.getBoxY(), |
707 |
|
Math.round((float) (lastHidden + 1) * od.getSequencesHeight() |
708 |
|
/ alheight)); |
709 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
710 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
711 |
|
|
712 |
|
|
713 |
1 |
moveViewport(0, 525 - viewHeight - lastHidden - 1); |
714 |
1 |
assertEquals(od.getBoxX(), 0); |
715 |
1 |
assertEquals( |
716 |
|
od.getBoxY(), |
717 |
|
Math.round((float) (525 - viewHeight) * od.getSequencesHeight() |
718 |
|
/ alheight)); |
719 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
720 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
721 |
|
} |
722 |
|
|
723 |
|
|
724 |
|
|
725 |
|
|
726 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
727 |
1 |
@Test(groups = { "Functional" })... |
728 |
|
public void testSetBoxFromViewportHiddenRowsInMiddle() |
729 |
|
{ |
730 |
1 |
int firstHidden = 200; |
731 |
1 |
int lastHidden = 210; |
732 |
1 |
hideSequences(firstHidden, lastHidden); |
733 |
|
|
734 |
|
|
735 |
|
|
736 |
1 |
moveViewport(0, 0); |
737 |
1 |
assertEquals(od.getBoxX(), 0); |
738 |
1 |
assertEquals(od.getBoxY(), 0); |
739 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
740 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
741 |
|
|
742 |
|
|
743 |
1 |
moveViewport(0, 198); |
744 |
1 |
assertEquals(od.getBoxX(), 0); |
745 |
1 |
assertEquals(od.getBoxY(), Math.round ((float)198 * od.getSequencesHeight() |
746 |
|
/ alheight)); |
747 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
748 |
1 |
assertEquals( |
749 |
|
od.getBoxHeight(), |
750 |
|
Math.round((float) (viewHeight + lastHidden - firstHidden + 1) |
751 |
|
* od.getSequencesHeight() / alheight)); |
752 |
|
} |
753 |
|
|
754 |
|
|
755 |
|
|
756 |
|
|
757 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
758 |
1 |
@Test(groups = { "Functional" })... |
759 |
|
public void testSetBoxFromViewportHiddenRowsAtEnd() |
760 |
|
{ |
761 |
1 |
int firstHidden = 500; |
762 |
1 |
int lastHidden = 524; |
763 |
1 |
hideSequences(firstHidden, lastHidden); |
764 |
|
|
765 |
|
|
766 |
|
|
767 |
1 |
moveViewport(0, 0); |
768 |
1 |
assertEquals(od.getBoxX(), 0); |
769 |
1 |
assertEquals(od.getBoxY(), 0); |
770 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
771 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
772 |
|
|
773 |
|
|
774 |
|
|
775 |
1 |
moveViewport(0, firstHidden - viewHeight - 1); |
776 |
1 |
assertEquals(od.getBoxX(), 0); |
777 |
1 |
assertEquals( |
778 |
|
od.getBoxY(), |
779 |
|
Math.round((float) (firstHidden - viewHeight - 1) |
780 |
|
* od.getSequencesHeight() / alheight)); |
781 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
782 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
783 |
|
|
784 |
|
} |
785 |
|
|
786 |
|
|
787 |
|
|
788 |
|
|
789 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (24) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
790 |
1 |
@Test(groups = { "Functional" })... |
791 |
|
public void testFromMouseWithHiddenRowsAtStart() |
792 |
|
{ |
793 |
1 |
od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); |
794 |
1 |
assertEquals(od.getBoxX(), 0); |
795 |
1 |
assertEquals(od.getBoxY(), 0); |
796 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
797 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
798 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
799 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
800 |
|
|
801 |
|
|
802 |
|
|
803 |
1 |
int lastHiddenRow = 30; |
804 |
1 |
hideSequences(0, lastHiddenRow); |
805 |
|
|
806 |
1 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
807 |
1 |
assertEquals(od.getBoxX(), 0); |
808 |
1 |
assertEquals(od.getBoxY(), |
809 |
|
Math.round((float) (lastHiddenRow + 1) |
810 |
|
* od.getSequencesHeight() / alheight)); |
811 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
812 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
813 |
|
|
814 |
|
|
815 |
1 |
mouseClick(od, 0, 0); |
816 |
1 |
assertEquals(od.getBoxX(), 0); |
817 |
1 |
assertEquals( |
818 |
|
od.getBoxY(), |
819 |
|
Math.round((float) (lastHiddenRow + 1) |
820 |
|
* od.getSequencesHeight() / alheight)); |
821 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
822 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
823 |
|
|
824 |
|
|
825 |
1 |
mouseClick(od, 0, 150 + boxHeight/2); |
826 |
1 |
assertEquals(od.getBoxX(), 0); |
827 |
1 |
assertEquals(od.getBoxY(), 150); |
828 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
829 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
830 |
|
} |
831 |
|
|
832 |
|
|
833 |
|
|
834 |
|
|
835 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (22) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
836 |
1 |
@Test(groups = { "Functional" })... |
837 |
|
public void testFromMouseWithHiddenRowsInMiddle() |
838 |
|
{ |
839 |
1 |
od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); |
840 |
|
|
841 |
1 |
assertEquals(od.getBoxX(), 0); |
842 |
1 |
assertEquals(od.getBoxY(), 0); |
843 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
844 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
845 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
846 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
847 |
|
|
848 |
|
|
849 |
|
|
850 |
1 |
int firstHiddenRow = 50; |
851 |
1 |
int lastHiddenRow = 54; |
852 |
1 |
hideSequences(firstHiddenRow, lastHiddenRow); |
853 |
|
|
854 |
1 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
855 |
|
|
856 |
1 |
assertEquals(od.getBoxX(), 0); |
857 |
1 |
assertEquals(od.getBoxY(), 0); |
858 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
859 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
860 |
|
|
861 |
|
|
862 |
1 |
int rowpos = 35; |
863 |
1 |
int centrepos = 43; |
864 |
1 |
mouseClick(od, 0, |
865 |
|
Math.round((float) centrepos * od.getSequencesHeight() |
866 |
|
/ alheight)); |
867 |
1 |
assertEquals(od.getBoxX(), 0); |
868 |
1 |
assertEquals(od.getBoxY(), |
869 |
|
Math.round( |
870 |
|
(float) rowpos * od.getSequencesHeight() / alheight)); |
871 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
872 |
1 |
assertEquals( |
873 |
|
od.getBoxHeight(), |
874 |
|
boxHeight |
875 |
|
+ Math.round((float) (lastHiddenRow - firstHiddenRow + 1) |
876 |
|
* od.getSequencesHeight() / alheight)); |
877 |
|
} |
878 |
|
|
879 |
|
|
880 |
|
|
881 |
|
|
882 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (33) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
883 |
1 |
@Test(groups = { "Functional" })... |
884 |
|
public void testFromMouseWithHiddenRowsAtEnd() |
885 |
|
{ |
886 |
1 |
od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); |
887 |
1 |
assertEquals(od.getBoxX(), 0); |
888 |
1 |
assertEquals(od.getBoxY(), 0); |
889 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
890 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
891 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
892 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
893 |
|
|
894 |
|
|
895 |
|
|
896 |
1 |
int firstHidden = 500; |
897 |
1 |
int lastHidden = 524; |
898 |
1 |
hideSequences(firstHidden, lastHidden); |
899 |
|
|
900 |
1 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
901 |
1 |
assertEquals(od.getBoxX(), 0); |
902 |
1 |
assertEquals(od.getBoxY(), 0); |
903 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
904 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
905 |
|
|
906 |
|
|
907 |
1 |
int ypos = 40 + viewHeight / 2; |
908 |
1 |
mouseClick(od, 0, |
909 |
|
Math.round((float) ypos * od.getSequencesHeight() / alheight)); |
910 |
1 |
assertEquals(od.getBoxX(), 0); |
911 |
1 |
assertEquals(od.getBoxY(), |
912 |
|
Math.round((float) 40 * od.getSequencesHeight() / alheight)); |
913 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
914 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
915 |
|
|
916 |
|
|
917 |
|
|
918 |
1 |
ypos = 497 + viewHeight / 2; |
919 |
1 |
mouseClick(od, 0, |
920 |
|
Math.round((float) ypos * od.getSequencesHeight() / alheight)); |
921 |
1 |
assertEquals(od.getBoxX(), 0); |
922 |
1 |
assertEquals( |
923 |
|
od.getBoxY(), |
924 |
|
Math.round((float) (firstHidden - viewHeight) |
925 |
|
* od.getSequencesHeight() / alheight)); |
926 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
927 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
928 |
|
|
929 |
|
|
930 |
1 |
ypos = 505 + boxHeight / 2; |
931 |
1 |
mouseClick(od, 0, |
932 |
|
Math.round((float) ypos * od.getSequencesHeight() / alheight)); |
933 |
1 |
assertEquals(od.getBoxX(), 0); |
934 |
1 |
assertEquals( |
935 |
|
od.getBoxY(), |
936 |
|
Math.round((firstHidden - viewHeight) * od.getSequencesHeight() |
937 |
|
/ alheight)); |
938 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
939 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
940 |
|
} |
941 |
|
|
942 |
|
|
943 |
|
|
944 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (34) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
945 |
1 |
@Test(groups = { "Functional" })... |
946 |
|
public void testPositionInBox() |
947 |
|
{ |
948 |
1 |
od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); |
949 |
|
|
950 |
1 |
assertFalse(od.isPositionInBox(0, 0)); |
951 |
1 |
assertTrue(od.isPositionInBox(10, 9)); |
952 |
1 |
assertFalse(od.isPositionInBox(0, 9)); |
953 |
1 |
assertFalse(od.isPositionInBox(9, 0)); |
954 |
1 |
assertFalse(od.isPositionInBox(75, 20)); |
955 |
|
|
956 |
1 |
assertTrue(od.isPositionInBox(47, 6)); |
957 |
1 |
assertFalse(od.isPositionInBox(48, 6)); |
958 |
1 |
assertTrue(od.isPositionInBox(47, 9)); |
959 |
1 |
assertFalse(od.isPositionInBox(47, 10)); |
960 |
|
|
961 |
|
|
962 |
|
|
963 |
1 |
hiddenCols.hideColumns(1, 4); |
964 |
1 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
965 |
1 |
assertFalse(od.isPositionInBox(0, 0)); |
966 |
1 |
assertTrue(od.isPositionInBox(10, 9)); |
967 |
1 |
assertFalse(od.isPositionInBox(0, 9)); |
968 |
1 |
assertFalse(od.isPositionInBox(9, 0)); |
969 |
1 |
assertFalse(od.isPositionInBox(75, 20)); |
970 |
|
|
971 |
1 |
assertTrue(od.isPositionInBox(47, 6)); |
972 |
1 |
assertTrue(od.isPositionInBox(48, 6)); |
973 |
1 |
assertTrue(od.isPositionInBox(47, 9)); |
974 |
1 |
assertFalse(od.isPositionInBox(47, 10)); |
975 |
|
|
976 |
|
|
977 |
|
|
978 |
1 |
hideSequences(1, 3); |
979 |
1 |
ColumnSelection cs = new ColumnSelection(); |
980 |
1 |
hiddenCols.revealAllHiddenColumns(cs); |
981 |
1 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
982 |
1 |
assertFalse(od.isPositionInBox(0, 0)); |
983 |
1 |
assertTrue(od.isPositionInBox(10, 9)); |
984 |
1 |
assertFalse(od.isPositionInBox(0, 9)); |
985 |
1 |
assertFalse(od.isPositionInBox(9, 0)); |
986 |
1 |
assertFalse(od.isPositionInBox(75, 20)); |
987 |
|
|
988 |
1 |
assertTrue(od.isPositionInBox(47, 6)); |
989 |
1 |
assertFalse(od.isPositionInBox(48, 6)); |
990 |
1 |
assertTrue(od.isPositionInBox(47, 9)); |
991 |
1 |
assertTrue(od.isPositionInBox(47, 10)); |
992 |
|
} |
993 |
|
|
994 |
|
|
995 |
|
|
996 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
997 |
1 |
@Test(groups = { "Functional" })... |
998 |
|
public void testDragging() |
999 |
|
{ |
1000 |
1 |
od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); |
1001 |
1 |
od.setDragPoint(4, 16, al.getHiddenSequences(), hiddenCols); |
1002 |
1 |
od.adjustViewportFromMouse(20, 22, al.getHiddenSequences(), hiddenCols); |
1003 |
|
|
1004 |
|
|
1005 |
|
|
1006 |
|
|
1007 |
1 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
1008 |
|
|
1009 |
|
|
1010 |
1 |
assertEquals(od.getBoxX(), 16); |
1011 |
1 |
assertEquals(od.getBoxY(), 6); |
1012 |
|
|
1013 |
|
|
1014 |
|
|
1015 |
1 |
hiddenCols.hideColumns(1, 4); |
1016 |
1 |
od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); |
1017 |
1 |
od.setDragPoint(4, 16, al.getHiddenSequences(), hiddenCols); |
1018 |
1 |
od.adjustViewportFromMouse(20, 22, al.getHiddenSequences(), hiddenCols); |
1019 |
1 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
1020 |
|
|
1021 |
|
|
1022 |
1 |
assertEquals(od.getBoxX(), |
1023 |
|
16 + Math.round((float) 4 * od.getWidth() / alwidth)); |
1024 |
1 |
assertEquals(od.getBoxY(), 6); |
1025 |
|
|
1026 |
|
|
1027 |
|
|
1028 |
1 |
hideSequences(1, 3); |
1029 |
1 |
od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); |
1030 |
1 |
od.setDragPoint(4, 16, al.getHiddenSequences(), hiddenCols); |
1031 |
1 |
od.adjustViewportFromMouse(20, 22, al.getHiddenSequences(), hiddenCols); |
1032 |
1 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
1033 |
|
|
1034 |
|
|
1035 |
1 |
assertEquals(od.getBoxX(), |
1036 |
|
16 + Math.round((float) 4 * od.getWidth() / alwidth)); |
1037 |
1 |
assertEquals(od.getBoxY(), |
1038 |
|
6 + Math.round((float) 3 * od.getHeight() / alheight)); |
1039 |
|
} |
1040 |
|
|
1041 |
|
|
1042 |
|
|
1043 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1044 |
2 |
private void moveViewportH(int startRes)... |
1045 |
|
{ |
1046 |
2 |
vpranges.setViewportStartAndWidth(startRes, viewWidth); |
1047 |
2 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
1048 |
|
} |
1049 |
|
|
1050 |
|
|
1051 |
|
|
1052 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1053 |
1 |
private void moveViewportV(int startSeq)... |
1054 |
|
{ |
1055 |
1 |
vpranges.setViewportStartAndHeight(startSeq, viewHeight); |
1056 |
1 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
1057 |
|
} |
1058 |
|
|
1059 |
|
|
1060 |
|
|
1061 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
1062 |
34 |
private void moveViewport(int startRes, int startSeq)... |
1063 |
|
{ |
1064 |
34 |
vpranges.setViewportStartAndWidth(startRes, viewWidth); |
1065 |
34 |
vpranges.setViewportStartAndHeight(startSeq, viewHeight); |
1066 |
34 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
1067 |
|
} |
1068 |
|
|
1069 |
|
|
1070 |
|
|
1071 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1072 |
42 |
private void mouseClick(OverviewDimensions od, int x, int y)... |
1073 |
|
{ |
1074 |
42 |
od.updateViewportFromMouse(x, y, al.getHiddenSequences(), hiddenCols); |
1075 |
|
|
1076 |
|
|
1077 |
|
|
1078 |
|
|
1079 |
42 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
1080 |
|
} |
1081 |
|
|
1082 |
|
|
1083 |
|
|
1084 |
|
|
1085 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
1086 |
1 |
private void testBoxIsAtClickPoint(int xpos, int ypos)... |
1087 |
|
{ |
1088 |
1 |
mouseClick(od, xpos, ypos); |
1089 |
1 |
assertEquals(od.getBoxX() + od.getBoxWidth() / 2, xpos); |
1090 |
1 |
assertEquals(od.getBoxY() + od.getBoxHeight() / 2, ypos); |
1091 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
1092 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
1093 |
|
|
1094 |
|
} |
1095 |
|
|
1096 |
|
|
1097 |
|
|
1098 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
1099 |
9 |
private void hideSequences(int start, int end)... |
1100 |
|
{ |
1101 |
9 |
SequenceI[] allseqs = al.getSequencesArray(); |
1102 |
9 |
SequenceGroup theseSeqs = new SequenceGroup(); |
1103 |
|
|
1104 |
164 |
for (int i = start; i <= end; i++) |
1105 |
|
{ |
1106 |
155 |
theseSeqs.addSequence(allseqs[i], false); |
1107 |
155 |
al.getHiddenSequences().hideSequence(allseqs[i]); |
1108 |
|
} |
1109 |
|
|
1110 |
9 |
hiddenRepSequences.put(allseqs[start], theseSeqs); |
1111 |
|
} |
1112 |
|
|
1113 |
|
|
1114 |
|
|
1115 |
|
|
1116 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (26) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
1117 |
1 |
@Test(groups = { "Functional" })... |
1118 |
|
public void testFromMouseWithHiddenRowsAtStartWrapped() |
1119 |
|
{ |
1120 |
1 |
vpranges.setWrappedMode(true); |
1121 |
1 |
od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); |
1122 |
1 |
assertEquals(od.getBoxX(), 0); |
1123 |
1 |
assertEquals(od.getBoxY(), 0); |
1124 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
1125 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
1126 |
1 |
assertEquals(vpranges.getStartRes(), 0); |
1127 |
1 |
assertEquals(vpranges.getStartSeq(), 0); |
1128 |
|
|
1129 |
|
|
1130 |
|
|
1131 |
1 |
int lastHiddenRow = 30; |
1132 |
1 |
hideSequences(0, lastHiddenRow); |
1133 |
|
|
1134 |
1 |
od.setBoxPosition(al.getHiddenSequences(), hiddenCols); |
1135 |
1 |
assertEquals(od.getBoxX(), 0); |
1136 |
1 |
assertEquals(od.getBoxY(), |
1137 |
|
Math.round((float) (lastHiddenRow + 1) |
1138 |
|
* od.getSequencesHeight() / alheight)); |
1139 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
1140 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
1141 |
|
|
1142 |
|
|
1143 |
1 |
mouseClick(od, 0, 0); |
1144 |
1 |
assertEquals(od.getBoxX(), 0); |
1145 |
1 |
int boxY = od.getBoxY(); |
1146 |
1 |
assertEquals( |
1147 |
|
boxY, |
1148 |
|
Math.round((float) (lastHiddenRow + 1) |
1149 |
|
* od.getSequencesHeight() / alheight)); |
1150 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
1151 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
1152 |
|
|
1153 |
|
|
1154 |
|
|
1155 |
1 |
mouseClick(od, 0, 150); |
1156 |
1 |
assertEquals(od.getBoxX(), 0); |
1157 |
1 |
assertEquals(od.getBoxY(), boxY); |
1158 |
1 |
assertEquals(od.getBoxWidth(), boxWidth); |
1159 |
1 |
assertEquals(od.getBoxHeight(), boxHeight); |
1160 |
|
} |
1161 |
|
} |