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