int viewHeight;
+ int viewWidth;
+
+ int alheight;
+
+ int alwidth;
+
@BeforeClass(alwaysRun = true)
public void setUpJvOptionPane()
{
av = af.getViewport();
- if (av.isCalcInProgress())
- {
-
- }
-
od = new OverviewDimensions(av);
while (av.isCalcInProgress())
Thread.sleep(50);
} catch (InterruptedException e)
{
- System.out.println("Hiding cols interruption");
+
}
}
// Initial box sizing - default path through code
od.setBoxPosition();
- scalew = (float) od.getWidth()
- / (av.getAlignment().getWidth() * av.getCharWidth());
- scaleh = (float) od.getSequencesHeight()
- / (av.getAlignment().getHeight() * av.getCharHeight());
- boxWidth = Math.round((av.getEndRes() - av.getStartRes() + 1)
- * av.getCharWidth() * scalew);
- boxHeight = Math.round((av.getEndSeq() - av.getStartSeq())
- * av.getCharHeight() * scaleh);
-
- viewHeight = av.getEndSeq() - av.getStartSeq();
-
init();
}
mouseClick(od, 0, 0);
moveViewport(0, 0);
+
+ viewHeight = av.getEndSeq() - av.getStartSeq();
+ viewWidth = av.getEndRes() - av.getStartRes();
+
+ // wait for gui to get set up
+ while (viewHeight != 17 || viewWidth != 59)
+ {
+ try
+ {
+ Thread.sleep(50);
+ viewHeight = av.getEndSeq() - av.getStartSeq();
+ viewWidth = av.getEndRes() - av.getStartRes();
+ } catch (InterruptedException e)
+ {
+
+ }
+ }
+
+ // calculate before hidden columns so we get absolute values
+ alheight = av.getAlignment().getHeight();
+ alwidth = av.getAlignment().getWidth();
+
+ boxWidth = Math.round((float) (av.getEndRes() - av.getStartRes() + 1)
+ / alwidth * od.getWidth());
+ boxHeight = Math.round((float) (av.getEndSeq() - av.getStartSeq())
+ / alheight * od.getHeight());
+ System.out.println(boxHeight);
+
}
@AfterMethod(alwaysRun = true)
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollRow(),
- Math.round(10 / scaleh / av.getCharHeight()));
+ Math.round((float) 10 * alheight / od.getSequencesHeight()));
assertEquals(od.getScrollCol(), 0);
// negative boxY value reset to 0
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- Math.round(6 / scalew / av.getCharWidth()));
+ Math.round((float) 6 * alwidth / od.getWidth()));
assertEquals(od.getScrollRow(), 0);
// overly large boxX value reset to width-boxWidth
mouseClick(od, 100, 6);
- assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth(), 1.5);
- assertEquals(od.getBoxY(), 6, 1.5);
+ assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth());
+ assertEquals(od.getBoxY(), 6);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- (od.getBoxX() / scalew / av.getCharWidth()), 1.5);
+ Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
assertEquals(od.getScrollRow(),
- (od.getBoxY() / scaleh / av.getCharHeight()), 1.5);
+ Math.round((float) od.getBoxY() * alheight
+ / od.getSequencesHeight()));
// overly large boxY value reset to sequenceHeight - boxHeight
mouseClick(od, 10, 520);
- assertEquals(od.getBoxX(), 10, 1.5);
- assertEquals(od.getBoxY(), od.getSequencesHeight() - od.getBoxHeight(),
- 1.5);
+ assertEquals(od.getBoxX(), 10);
+ assertEquals(od.getBoxY(), od.getSequencesHeight() - od.getBoxHeight());
assertEquals(od.getBoxWidth(), boxWidth);
- assertEquals(od.getBoxHeight(), boxHeight, 1.5);
+ assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- (od.getBoxX() / scalew / av.getCharWidth()), 1.5);
+ Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
assertEquals(od.getScrollRow(),
- (od.getBoxY() / scaleh / av.getCharHeight()), 1.5);
+ Math.round((float) od.getBoxY() * alheight
+ / od.getSequencesHeight()));
// click past end of alignment, as above
mouseClick(od, 3000, 5);
- assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth(), 1.5);
+ assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth());
assertEquals(od.getBoxWidth(), boxWidth);
- assertEquals(od.getBoxHeight(), boxHeight, 1.5);
+ assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- (od.getBoxX() / scalew / av.getCharWidth()), 1.5);
+ Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
assertEquals(od.getScrollRow(),
- (od.getBoxY() / scaleh / av.getCharHeight()), 1.5);
+ Math.round((float) od.getBoxY() * alheight
+ / od.getSequencesHeight()));
// move viewport so startRes non-zero and then mouseclick
moveViewportH(50);
int oldboxx = od.getBoxX();
int oldboxy = od.getBoxY();
mouseClick(od, od.getBoxX() + 5, od.getBoxY() + 2);
- assertEquals(od.getBoxX(), oldboxx + 5, 1.5);
+ assertEquals(od.getBoxX(), oldboxx + 5);
assertEquals(od.getBoxWidth(), boxWidth);
- assertEquals(od.getBoxHeight(), boxHeight, 1.5);
+ assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- (od.getBoxX() / scalew / av.getCharWidth()), 1.5);
- assertEquals(od.getBoxY(), oldboxy + 2, 1.5);
+ Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
+ assertEquals(od.getBoxY(), oldboxy + 2);
assertEquals(od.getScrollRow(),
- (od.getBoxY() / scaleh / av.getCharHeight()), 1.5);
+ Math.round((float) od.getBoxY() * alheight
+ / od.getSequencesHeight()));
// click at top corner
mouseClick(od, 0, 0);
assertEquals(od.getBoxY(), 0);
assertEquals(od.getScrollRow(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
- assertEquals(od.getBoxHeight(), boxHeight, 1.5);
+ assertEquals(od.getBoxHeight(), boxHeight);
}
/**
od.setBoxPosition();
assertEquals(od.getBoxX(),
- Math.round((lastHiddenCol + 1) * scalew * av.getCharWidth()));
+ Math.round((float) (lastHiddenCol + 1) * od.getWidth()
+ / alwidth));
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
/* int xpos = 10;
mouseClick(od, xpos, 0);
assertEquals(od.getBoxX(),
- Math.round ((lastHiddenCol + 1) * scalew * av.getCharWidth()));
+ Math.round ((lastHiddenCol + 1) * od.getWidth() / alwidth));
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollRow(), 0);
assertEquals(od.getScrollCol(),
- Math.round (xpos / scalew / av.getCharWidth()));
+ Math.round (xpos * alwidth / od.getWidth()));
*/
// click to right of hidden columns, box moves to click point
testBoxIsAtClickPoint(40, 0);
assertEquals(od.getScrollRow(), 0);
assertEquals(od.getScrollCol(),
- Math.round(40 / scalew / av.getCharWidth())
- - lastHiddenCol,
- 1.5);
+ Math.round((float) 40 * alwidth / od.getWidth())
+ - (lastHiddenCol + 1));
// click to right of hidden columns such that box runs over right hand side
// of alignment
// overly large boxX value reset to width-boxWidth
int xpos = 100;
mouseClick(od, xpos, 5);
- assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth(), 1.5);
+ assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth());
assertEquals(od.getBoxY(), 5);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- Math.round(od.getBoxX() / scalew / av.getCharWidth())
- - lastHiddenCol, 1.5);
+ Math.round((float) od.getBoxX() * alwidth / od.getWidth())
+ - (lastHiddenCol + 1));
assertEquals(od.getScrollRow(),
- Math.round(od.getBoxY() / scaleh / av.getCharHeight()));
-
+ Math.round((float) od.getBoxY() * alheight
+ / od.getSequencesHeight()));
}
/**
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getScrollCol(), 0);
assertEquals(od.getScrollRow(), 0);
-
+
// move box so that it overlaps with hidden cols on one side
// box width changes, boxX and scrollCol as for unhidden case
int xpos = 50 - boxWidth; // 50 is position in overview halfway between cols
assertEquals(od.getBoxY(), 0);
assertEquals(
od.getBoxWidth(),
- Math.round(boxWidth + (lastHidden - firstHidden + 1) * scalew
- * av.getCharWidth()));
+ Math.round(boxWidth + (float) (lastHidden - firstHidden + 1)
+ * od.getWidth() / alwidth));
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- Math.round(xpos / scalew / av.getCharWidth()));
+ Math.round(xpos * alwidth / od.getWidth()));
assertEquals(od.getScrollRow(), 0);
// move box so that it completely covers hidden cols
assertEquals(od.getBoxY(), 0);
assertEquals(
od.getBoxWidth(),
- Math.round(boxWidth + (lastHidden - firstHidden + 1) * scalew
- * av.getCharWidth()));
+ Math.round(boxWidth + (float) (lastHidden - firstHidden + 1)
+ * od.getWidth() / alwidth));
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- Math.round(xpos / scalew / av.getCharWidth()), 1.5);
+ Math.round(xpos * alwidth / od.getWidth()));
assertEquals(od.getScrollRow(), 0);
// move box so boxX is in hidden cols, box overhangs at right
/* xpos = 50;
mouseClick(od, xpos, 0);
assertEquals(od.getBoxX(),
- (lastHidden + 1) * scalew * av.getCharWidth(), 1.5);
+ (lastHidden + 1) * scalew * av.getCharWidth());
assertEquals(od.getBoxY(), 0);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
+ assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- Math.round(xpos / scalew / av.getCharWidth()), 1.5);
+ Math.round(xpos * alwidth / od.getWidth()));
assertEquals(od.getScrollRow(), 0);*/
// move box so boxX is to right of hidden cols, but does not go beyond full
testBoxIsAtClickPoint(xpos, 0);
assertEquals(od.getScrollRow(), 0);
assertEquals(od.getScrollCol(),
- Math.round(xpos / scalew / av.getCharWidth())
- - lastHidden, 1.5);*/
+ Math.round(xpos * alwidth / od.getWidth())
+ - lastHidden);*/
// move box so it goes beyond full width of alignment
// boxX, scrollCol adjusted back, box width normal
xpos = 3000;
mouseClick(od, xpos, 5);
- assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth(), 1.5);
+ assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth());
assertEquals(od.getBoxY(), 5);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- Math.round((od.getBoxX() / scalew / av.getCharWidth())
+ Math.round(((float) od.getBoxX() * alwidth / od.getWidth())
- (lastHidden - firstHidden + 1)));
assertEquals(od.getScrollRow(),
- Math.round(od.getBoxY() / scaleh / av.getCharHeight()));
+ Math.round((float) od.getBoxY() * alheight
+ / od.getSequencesHeight()));
}
testBoxIsAtClickPoint(xpos, 0);
assertEquals(od.getScrollRow(), 0);
assertEquals(od.getScrollCol(),
- Math.round(xpos / scalew / av.getCharWidth()), 1.5);
+ Math.round((float) xpos * alwidth / od.getWidth()));
// click to left of hidden cols, with overlap
// boxX and scrollCol adjusted for hidden cols, width normal
assertEquals(
od.getBoxX(),
Math.round((firstHidden - 1) * scalew * av.getCharWidth())
- - od.getBoxWidth(), 1.5);
+ - od.getBoxWidth());
assertEquals(od.getBoxY(), 0);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
+ assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- Math.round(od.getBoxX() / scalew / av.getCharWidth()), 1.5);
+ Math.round(od.getBoxX() * alwidth / od.getWidth()));
assertEquals(od.getScrollRow(), 0);*/
// click in hidden cols
assertEquals(
od.getBoxX(),
Math.round((firstHidden - 1) * scalew * av.getCharWidth())
- - od.getBoxWidth(), 1.5);
+ - od.getBoxWidth());
assertEquals(od.getBoxY(), 0);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
+ assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- Math.round(od.getBoxX() / scalew / av.getCharWidth()), 1.5);
+ Math.round(od.getBoxX() * alwidth / od.getWidth()));
assertEquals(od.getScrollRow(), 0);*/
// click off end of alignment
assertEquals(
od.getBoxX(),
Math.round((firstHidden - 1) * scalew * av.getCharWidth())
- - od.getBoxWidth(), 1.5);
+ - od.getBoxWidth());
assertEquals(od.getBoxY(), 0);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
+ assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getScrollCol(),
- Math.round(od.getBoxX() / scalew / av.getCharWidth()), 1.5);
+ Math.round(od.getBoxX() * alwidth / od.getWidth()));
assertEquals(od.getScrollRow(), 0);*/
}
// move viewport to right
moveViewportH(70);
- assertEquals(od.getBoxX(), Math.round(70 * scalew * av.getCharWidth()));
+ assertEquals(od.getBoxX(),
+ Math.round((float) 70 * od.getWidth() / alwidth));
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
// move viewport down
moveViewportV(100);
- assertEquals(od.getBoxX(), Math.round(70 * scalew * av.getCharWidth()));
+ assertEquals(od.getBoxX(),
+ Math.round((float) 70 * od.getWidth() / alwidth));
assertEquals(od.getBoxY(),
- Math.round(100 * scaleh * av.getCharHeight()));
+ Math.round(100 * od.getSequencesHeight() / alheight));
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
// move viewport to bottom right
moveViewport(98, 508);
- assertEquals(od.getBoxX(), Math.round(98 * scalew * av.getCharWidth()));
+ assertEquals(od.getBoxX(),
+ Math.round((float) 98 * od.getWidth() / alwidth));
assertEquals(od.getBoxY(),
- Math.round(508 * scaleh * av.getCharHeight()));
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
+ Math.round((float) 508 * od.getSequencesHeight() / alheight));
+ assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
}
// move viewport to start of alignment
moveViewport(0, 0);
assertEquals(od.getBoxX(),
- Math.round((lastHidden + 1) * scalew * av.getCharWidth()));
+ Math.round((float) (lastHidden + 1) * od.getWidth() / alwidth));
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
// move viewport to end of alignment - need to make startRes by removing
// hidden cols because of how viewport/overview are implemented
moveViewport(98 - lastHidden - 1, 0);
- assertEquals(od.getBoxX(), Math.round(98 * scalew * av.getCharWidth()));
+ assertEquals(od.getBoxX(),
+ Math.round((float) 98 * od.getWidth() / alwidth));
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
// move viewport before hidden columns
moveViewport(3, 0);
- assertEquals(od.getBoxX(), Math.round(3 * scalew * av.getCharWidth()));
+ assertEquals(od.getBoxX(),
+ Math.round((float) 3 * od.getWidth() / alwidth));
assertEquals(od.getBoxY(), 0);
System.out.println(od.getBoxWidth());
assertEquals(od.getBoxWidth(), boxWidth);
// move viewport to left of hidden columns with overlap
moveViewport(10, 0);
- assertEquals(od.getBoxX(), Math.round(10 * scalew * av.getCharWidth()));
+ assertEquals(od.getBoxX(),
+ Math.round((float) 10 * od.getWidth() / alwidth));
assertEquals(od.getBoxY(), 0);
assertEquals(
od.getBoxWidth(),
boxWidth
- + Math.round((lastHidden - firstHidden + 1) * scalew
- * av.getCharWidth()));
+ + Math.round((float) (lastHidden - firstHidden + 1)
+ * od.getWidth() / alwidth));
assertEquals(od.getBoxHeight(), boxHeight);
// move viewport to straddle hidden columns
moveViewport(60, 0);
- assertEquals(od.getBoxX(), Math.round(60 * scalew * av.getCharWidth()));
+ assertEquals(od.getBoxX(),
+ Math.round((float) 60 * od.getWidth() / alwidth));
assertEquals(od.getBoxY(), 0);
assertEquals(
od.getBoxWidth(),
boxWidth
- + Math.round((lastHidden - firstHidden + 1) * scalew
- * av
-.getCharWidth()));
+ + Math.round((lastHidden - firstHidden + 1)
+ * od.getWidth() / alwidth));
assertEquals(od.getBoxHeight(), boxHeight);
// move viewport to right of hidden columns, no overlap
moveViewport(80 - (lastHidden - firstHidden + 1), 0);
- assertEquals(od.getBoxX(), Math.round(80 * scalew * av.getCharWidth()));
+ assertEquals(od.getBoxX(),
+ Math.round((float) 80 * od.getWidth() / alwidth));
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
// move viewport before hidden columns
moveViewport(3, 0);
- assertEquals(od.getBoxX(), Math.round(3 * scalew * av.getCharWidth()),
- 1.5);
+ assertEquals(od.getBoxX(),
+ Math.round((float) 3 * od.getWidth() / alwidth));
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
// move viewport to hidden columns
// TODO boxwidth includes hidden in overview panel (why?)
moveViewport(98, 0);
- assertEquals(od.getBoxX(), Math.round(98 * scalew * av.getCharWidth()),
- 1.5);
+ assertEquals(od.getBoxX(),
+ Math.round((float) 98 * od.getWidth() / alwidth));
assertEquals(od.getBoxY(), 0);
assertEquals(
od.getBoxWidth(),
boxWidth
- + Math.round((lastHidden - firstHidden + 1) * scalew
- * av.getCharWidth()), 1.5);
+ + Math.round((float) (lastHidden - firstHidden + 1)
+ * od.getWidth() / alwidth));
assertEquals(od.getBoxHeight(), boxHeight);
}
moveViewport(0, 0);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(),
- Math.round((lastHidden + 1) * scaleh * av.getCharHeight()));
+ Math.round((float) (lastHidden + 1) * od.getSequencesHeight()
+ / alheight));
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(),
(525 - viewHeight) * scaleh
- * av.getCharHeight(), 1.5);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
- assertEquals(od.getBoxHeight(), boxHeight, 1.5);*/
+ * av.getCharHeight());
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(od.getBoxHeight(), boxHeight);*/
}
/**
/*moveViewport(0, 0);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
- assertEquals(od.getBoxHeight(), boxHeight, 1.5);*/
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(od.getBoxHeight(), boxHeight);*/
// move viewport to straddle hidden rows
// TODO also fails with boxY out by 12
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), Math.round (198 * scaleh * av.getCharHeight()),
1.5);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
+ assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight
+ ((lastHidden - firstHidden) * scaleh * av.getCharHeight()),
1.5);*/
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(),
Math.round ((firstHidden - viewHeight - 1)
- * scaleh * av.getCharHeight()), 1.5);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
+ * scaleh * av.getCharHeight()));
+ assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(
od.getBoxHeight(),
boxHeight
+ Math.round ((lastHidden - firstHidden + 1) * scaleh * av
- .getCharHeight()), 1.5);*/
+ .getCharHeight()));*/
}
od.setBoxPosition();
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(),
- Math.round((lastHiddenRow + 1) * scaleh * av.getCharHeight()));
+ Math.round((float) (lastHiddenRow + 1)
+ * od.getSequencesHeight() / alheight));
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
/* mouseClick(od, 0, 0);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
+ assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight
+ Math.round ((lastHiddenRow + 1) * scaleh * av.getCharHeight()),
1.5);*/
// click below hidden rows
mouseClick(od, 0, 150);
assertEquals(od.getBoxX(), 0);
- assertEquals(od.getBoxY(), 150, 1.5);
+ assertEquals(od.getBoxY(), 150);
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
}
@Test(groups = { "Functional" })
public void testFromMouseWithHiddenRowsInMiddle()
{
- assertEquals(od.getBoxHeight(), 10);
-
od.setBoxPositionByMouse(0, 0);
- assertEquals(od.getBoxHeight(), 10);
-
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
// no changes
int firstHiddenRow = 50;
int lastHiddenRow = 60;
- assertEquals(od.getBoxHeight(), 10);
hideSequences(firstHiddenRow, lastHiddenRow + 1, lastHiddenRow + 1);
- assertEquals(od.getBoxHeight(), 10);
od.setBoxPosition();
- assertEquals(od.getBoxHeight(), 10);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
int ypos = 40;
// TODO test fails because box does not change height - dealt with by scroll
// values
- /* mouseClick(od, 0, Math.round (ypos / scaleh / av.getCharHeight()));
+ /* mouseClick(od, 0, Math.round (ypos * alheight / od.getSequencesHeight()));
assertEquals(od.getBoxX(), 0);
- assertEquals(od.getBoxY(), Math.round (ypos / scaleh / av.getCharHeight()),
+ assertEquals(od.getBoxY(), Math.round (ypos * alheight / od.getSequencesHeight()),
1.5);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
+ assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(
od.getBoxHeight(),
boxHeight
+ Math.round ((lastHiddenRow - firstHiddenRow + 1) / scaleh / av
- .getCharHeight()), 1.5);
+ .getCharHeight()));
*/
// 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 / scaleh / av.getCharHeight()));
+ /*mouseClick(od, 0, Math.round (ypos * alheight / od.getSequencesHeight()));
assertEquals(od.getBoxX(), 0);
- assertEquals(od.getBoxY(), Math.round (ypos / scaleh / av.getCharHeight()),
+ assertEquals(od.getBoxY(), Math.round (ypos * alheight / od.getSequencesHeight()),
1.5);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
+ assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(
od.getBoxHeight(),
boxHeight
+ Math.round ((lastHiddenRow - firstHiddenRow + 1) / scaleh / av
- .getCharHeight()), 1.5);*/
+ .getCharHeight()));*/
}
/**
// click above hidden rows
int ypos = 40; // row 40
- 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(ypos * scaleh * av.getCharHeight()));
+ Math.round((float) ypos * od.getSequencesHeight() / alheight));
assertEquals(od.getBoxWidth(), boxWidth);
assertEquals(od.getBoxHeight(), boxHeight);
od.getBoxY(),
Math.round ((firstHidden - viewHeight) * scaleh * av.getCharHeight()),
1.5);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
- assertEquals(od.getBoxHeight(), boxHeight, 1.5);*/
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(od.getBoxHeight(), boxHeight);*/
// click within hidden rows
ypos = 505;
od.getBoxY(),
Math.round ((firstHidden - viewHeight) * scaleh * av.getCharHeight()),
1.5);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
- assertEquals(od.getBoxHeight(), boxHeight, 1.5);*/
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(od.getBoxHeight(), boxHeight);*/
}
/*
*/
private void moveViewportH(int startRes)
{
- int width = av.getEndRes() - av.getStartRes();
av.setStartRes(startRes);
- av.setEndRes(startRes + width);
+ av.setEndRes(startRes + viewWidth);
od.setBoxPosition();
}
*/
private void moveViewport(int startRes, int startSeq)
{
- int width = av.getEndRes() - av.getStartRes();
-
av.setStartRes(startRes);
- av.setEndRes(startRes + width);
+ av.setEndRes(startRes + viewWidth);
av.setStartSeq(startSeq);
av.setEndSeq(startSeq + viewHeight);
od.setBoxPosition();
// updates require an OverviewPanel to exist which it doesn't here
// so call setBoxPosition() as it would be called by the AlignmentPanel
// normally
- int width = av.getEndRes() - av.getStartRes();
- int height = av.getEndSeq() - av.getStartSeq();
+ // int width = av.getEndRes() - av.getStartRes();
+ // int height = av.getEndSeq() - av.getStartSeq();
av.setStartRes(od.getScrollCol());
- av.setEndRes(od.getScrollCol() + width);
+ av.setEndRes(od.getScrollCol() + viewWidth);
av.setStartSeq(od.getScrollRow());
- av.setEndSeq(od.getScrollRow() + height);
+ av.setEndSeq(od.getScrollRow() + viewHeight);
od.setBoxPosition();
}
private void testBoxIsAtClickPoint(int xpos, int ypos)
{
mouseClick(od, xpos, ypos);
- assertEquals(od.getBoxX(), xpos, 1.5);
- assertEquals(od.getBoxY(), ypos, 1.5);
- assertEquals(od.getBoxWidth(), boxWidth, 1.5);
- assertEquals(od.getBoxHeight(), boxHeight, 1.5);
+ assertEquals(od.getBoxX(), xpos);
+ assertEquals(od.getBoxY(), ypos);
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(od.getBoxHeight(), boxHeight);
}