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