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