ViewportPositionProps props = new ViewportPositionProps(al1);
OverviewDimensions od = new OverviewDimensions(props, true);
- int scaledHeight = 266;
+ int scaledHeight = 267;
assertEquals(od.getGraphHeight(), defaultGraphHeight);
assertEquals(od.getSequencesHeight(), scaledHeight);
assertEquals(od.getWidth(), maxWidth);
// overly large boxX value reset to width-boxWidth
mouseClick(od, 100, 6);
- assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth() + 1);
+ assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth());
assertEquals(od.getBoxY(), 6);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
+
+ // here (float) od.getBoxY() * alheight / od.getSequencesHeight() = 507.5
+ // and round rounds to 508; however we get 507 working with row values
+ // hence the subtraction of 1
assertEquals(od.getScrollRow(),
Math.round((float) od.getBoxY() * alheight
- / od.getSequencesHeight()));
+ / od.getSequencesHeight()) - 1);
// click past end of alignment, as above
mouseClick(od, 3000, 5);
- assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth() + 1);
+ assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth());
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
assertEquals(od.getBoxHeight(), boxHeight);
// try to click in hidden cols, check box does not move
- // this test currently fails as the overview box does not behave like this!
int xpos = 10;
mouseClick(od, xpos, 0);
assertEquals(
// overly large boxX value reset to width-boxWidth
xpos = 100;
mouseClick(od, xpos, 5);
- assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth() + 1);
+ assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth());
assertEquals(od.getBoxY(), 5);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
// boxX, scrollCol adjusted back, box width normal
xpos = 3000;
mouseClick(od, xpos, 5);
- assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth() + 1);
+ assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth());
assertEquals(od.getBoxY(), 5);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
xpos = Math.round((float) 145 * od.getWidth() / alwidth) - boxWidth;
mouseClick(od, xpos, 0);
assertEquals(od.getBoxX(),
- Math.round((firstHidden - 1) * od.getWidth() / alwidth)
- - boxWidth);
+ Math.round((float) (firstHidden - 1) * od.getWidth() / alwidth)
+ - boxWidth + 1);
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- Math.round(od.getBoxX() * alwidth / od.getWidth()));
+ Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
assertEquals(od.getScrollRow(), 0);
// click in hidden cols
// boxX and scrollCol adjusted for hidden cols, width normal
- // TODO breaks as above test
- /*xpos = 115;
- assertEquals(
- od.getBoxX(),
- Math.round((firstHidden - 1) * scalew * av.getCharWidth())
- - od.getBoxWidth());
+ xpos = 115;
+ assertEquals(od.getBoxX(),
+ Math.round((float) (firstHidden - 1) * od.getWidth() / alwidth)
+ - boxWidth + 1);
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- Math.round(od.getBoxX() * alwidth / od.getWidth()));
- assertEquals(od.getScrollRow(), 0);*/
+ Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
+ assertEquals(od.getScrollRow(), 0);
// click off end of alignment
// boxX and scrollCol adjusted for hidden cols, width normal
- // TODO breaks as above test
- /* xpos = 3000;
- assertEquals(
- od.getBoxX(),
- Math.round((firstHidden - 1) * scalew * av.getCharWidth())
- - od.getBoxWidth());
- assertEquals(od.getBoxY(), 0);
- assertEquals(od.getBoxWidth(), boxWidth);
- assertEquals(od.getBoxHeight(), boxHeight);
- assertEquals(od.getScrollCol(),
- Math.round(od.getBoxX() * alwidth / od.getWidth()));
- assertEquals(od.getScrollRow(), 0);*/
+ xpos = 3000;
+ assertEquals(od.getBoxX(),
+ Math.round((float) (firstHidden - 1) * od.getWidth() / alwidth)
+ - boxWidth + 1);
+ assertEquals(od.getBoxY(), 0);
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(od.getBoxHeight(), boxHeight);
+ assertEquals(od.getScrollCol(),
+ Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
+ assertEquals(od.getScrollRow(), 0);
}
/**
Math.round((float) 102 * od.getWidth() / alwidth));
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth
- + Math.round((float) (lastHidden - firstHidden)
+ + Math.round((float) (lastHidden - firstHidden + 1)
* od.getWidth() / alwidth));
assertEquals(od.getBoxHeight(), boxHeight);
}
// hide rows in middle and check updated box position is correct
// no changes
int firstHiddenRow = 50;
- int lastHiddenRow = 60;
+ int lastHiddenRow = 54;
hideSequences(firstHiddenRow, lastHiddenRow);
od.setBoxPosition(al.getHiddenSequences(), hiddenCols, posProps);
assertEquals(od.getBoxHeight(), boxHeight);
// click above hidden rows, so that box overlaps
- int ypos = 40;
- // TODO test fails because box does not change height - dealt with by scroll
- // values
- /* mouseClick(od, 0, Math.round (ypos * alheight / od.getSequencesHeight()));
- assertEquals(od.getBoxX(), 0);
- assertEquals(od.getBoxY(), Math.round (ypos * alheight / od.getSequencesHeight()),
- 1.5);
- assertEquals(od.getBoxWidth(), boxWidth);
- assertEquals(
- od.getBoxHeight(),
- boxHeight
- + Math.round ((lastHiddenRow - firstHiddenRow + 1) / scaleh / av
- .getCharHeight()));
- */
+ int ypos = 35; // column value in residues
+ mouseClick(od, 0,
+ Math.round((float) ypos * od.getSequencesHeight() / alheight));
+ assertEquals(od.getBoxX(), 0);
+ assertEquals(od.getBoxY(),
+ Math.round((float) ypos * od.getSequencesHeight() / alheight));
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(
+ od.getBoxHeight(),
+ boxHeight
+ + Math.round((float) (lastHiddenRow - firstHiddenRow + 1)
+ * od.getSequencesHeight() / alheight));
+
// click so that box straddles hidden rows
- ypos = 48;
- // TODO test fails because box does not change height - dealt with by scroll
- // values
- /*mouseClick(od, 0, Math.round (ypos * alheight / od.getSequencesHeight()));
+ ypos = 44; // column value in residues
+ mouseClick(od, 0,
+ Math.round((float) ypos * od.getSequencesHeight() / alheight));
assertEquals(od.getBoxX(), 0);
- assertEquals(od.getBoxY(), Math.round (ypos * alheight / od.getSequencesHeight()),
- 1.5);
+ assertEquals(od.getBoxY(),
+ Math.round((float) ypos * od.getSequencesHeight() / alheight));
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(
od.getBoxHeight(),
boxHeight
- + Math.round ((lastHiddenRow - firstHiddenRow + 1) / scaleh / av
- .getCharHeight()));*/
+ + Math.round((float) (lastHiddenRow - firstHiddenRow + 1)
+ * od.getSequencesHeight() / alheight));
}
/**
// click above hidden rows so box overlaps
// boxY moved upwards, boxHeight remains same
- // TODO fails with boxY located at row 497 - correction done by
- // setScrollValues
- /* ypos = 497; // row 497
- mouseClick(od, 0, Math.round (ypos * scaleh * av.getCharHeight()));
- assertEquals(od.getBoxX(), 0);
- assertEquals(
- od.getBoxY(),
- Math.round ((firstHidden - viewHeight) * scaleh * av.getCharHeight()),
- 1.5);
- assertEquals(od.getBoxWidth(), boxWidth);
- assertEquals(od.getBoxHeight(), boxHeight);*/
+ ypos = 497; // row 497
+ mouseClick(od, 0,
+ Math.round((float) ypos * od.getSequencesHeight() / alheight));
+ assertEquals(od.getBoxX(), 0);
+ assertEquals(
+ od.getBoxY(),
+ Math.round((float) (firstHidden - viewHeight)
+ * od.getSequencesHeight() / alheight));
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(od.getBoxHeight(), boxHeight);
// click within hidden rows
ypos = 505;
- // TODO: fails with wrong boxHeight - correction done by setScrollValues(?)
- /*mouseClick(od, 0, Math.round (ypos * scaleh * av.getCharHeight()));
+ mouseClick(od, 0,
+ Math.round((float) ypos * od.getSequencesHeight() / alheight));
assertEquals(od.getBoxX(), 0);
assertEquals(
od.getBoxY(),
- Math.round ((firstHidden - viewHeight) * scaleh * av.getCharHeight()),
- 1.5);
+ Math.round((firstHidden - viewHeight) * od.getSequencesHeight()
+ / alheight));
assertEquals(od.getBoxWidth(), boxWidth);
- assertEquals(od.getBoxHeight(), boxHeight);*/
+ assertEquals(od.getBoxHeight(), boxHeight);
}
/*