git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-4134 efficiency improvement
[jalview.git]
/
test
/
jalview
/
gui
/
SeqPanelTest.java
diff --git
a/test/jalview/gui/SeqPanelTest.java
b/test/jalview/gui/SeqPanelTest.java
index
b0fc116
..
701431b
100644
(file)
--- a/
test/jalview/gui/SeqPanelTest.java
+++ b/
test/jalview/gui/SeqPanelTest.java
@@
-65,6
+65,7
@@
public class SeqPanelTest
JvOptionPane.setInteractiveMode(false);
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
}
JvOptionPane.setInteractiveMode(false);
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
}
+
@Test(groups = "Functional")
public void testSetStatusReturnsNearestResiduePosition()
{
@Test(groups = "Functional")
public void testSetStatusReturnsNearestResiduePosition()
{
@@
-76,25
+77,21
@@
public class SeqPanelTest
AlignmentI visAl = alignFrame.getViewport().getAlignment();
// Test either side of gap
AlignmentI visAl = alignFrame.getViewport().getAlignment();
// Test either side of gap
- assertEquals(
- alignFrame.alignPanel.getSeqPanel().setStatusMessage(
- visAl.getSequenceAt(1), 1, 1), 2);
+ assertEquals(alignFrame.alignPanel.getSeqPanel()
+ .setStatusMessage(visAl.getSequenceAt(1), 1, 1), 2);
assertEquals(((JLabel) PA.getValue(alignFrame, "statusBar")).getText(),
"Sequence 2 ID: Seq2 Residue: ALA (2)");
assertEquals(((JLabel) PA.getValue(alignFrame, "statusBar")).getText(),
"Sequence 2 ID: Seq2 Residue: ALA (2)");
- assertEquals(
- alignFrame.alignPanel.getSeqPanel().setStatusMessage(
- visAl.getSequenceAt(1), 4, 1), 3);
+ assertEquals(alignFrame.alignPanel.getSeqPanel()
+ .setStatusMessage(visAl.getSequenceAt(1), 4, 1), 3);
assertEquals(((JLabel) PA.getValue(alignFrame, "statusBar")).getText(),
"Sequence 2 ID: Seq2 Residue: GLU (3)");
// no status message at a gap, returns next residue position to the right
assertEquals(((JLabel) PA.getValue(alignFrame, "statusBar")).getText(),
"Sequence 2 ID: Seq2 Residue: GLU (3)");
// no status message at a gap, returns next residue position to the right
- assertEquals(
- alignFrame.alignPanel.getSeqPanel().setStatusMessage(
- visAl.getSequenceAt(1), 2, 1), 3);
+ assertEquals(alignFrame.alignPanel.getSeqPanel()
+ .setStatusMessage(visAl.getSequenceAt(1), 2, 1), 3);
assertEquals(((JLabel) PA.getValue(alignFrame, "statusBar")).getText(),
"Sequence 2 ID: Seq2");
assertEquals(((JLabel) PA.getValue(alignFrame, "statusBar")).getText(),
"Sequence 2 ID: Seq2");
- assertEquals(
- alignFrame.alignPanel.getSeqPanel().setStatusMessage(
- visAl.getSequenceAt(1), 3, 1), 3);
+ assertEquals(alignFrame.alignPanel.getSeqPanel()
+ .setStatusMessage(visAl.getSequenceAt(1), 3, 1), 3);
assertEquals(((JLabel) PA.getValue(alignFrame, "statusBar")).getText(),
"Sequence 2 ID: Seq2");
}
assertEquals(((JLabel) PA.getValue(alignFrame, "statusBar")).getText(),
"Sequence 2 ID: Seq2");
}
@@
-109,9
+106,8
@@
public class SeqPanelTest
al.getHeight());
AlignmentI visAl = alignFrame.getViewport().getAlignment();
al.getHeight());
AlignmentI visAl = alignFrame.getViewport().getAlignment();
- assertEquals(
- alignFrame.alignPanel.getSeqPanel().setStatusMessage(
- visAl.getSequenceAt(1), 1, 1), 2);
+ assertEquals(alignFrame.alignPanel.getSeqPanel()
+ .setStatusMessage(visAl.getSequenceAt(1), 1, 1), 2);
assertEquals(((JLabel) PA.getValue(alignFrame, "statusBar")).getText(),
"Sequence 2 ID: Seq2 Residue: B (2)");
}
assertEquals(((JLabel) PA.getValue(alignFrame, "statusBar")).getText(),
"Sequence 2 ID: Seq2 Residue: B (2)");
}
@@
-125,7
+121,7
@@
public class SeqPanelTest
assertNull(SeqPanel.getEditStatusMessage(edit));
SequenceI[] seqs = new SequenceI[] { new Sequence("a", "b") };
assertNull(SeqPanel.getEditStatusMessage(edit));
SequenceI[] seqs = new SequenceI[] { new Sequence("a", "b") };
-
+
// 1 gap
edit.addEdit(edit.new Edit(Action.INSERT_GAP, seqs, 1, 1, '-'));
String expected = MessageManager.formatMessage("label.insert_gap", "1");
// 1 gap
edit.addEdit(edit.new Edit(Action.INSERT_GAP, seqs, 1, 1, '-'));
String expected = MessageManager.formatMessage("label.insert_gap", "1");
@@
-165,7
+161,7
@@
public class SeqPanelTest
{
EditCommand edit = new EditCommand(); // empty
SequenceI[] seqs = new SequenceI[] { new Sequence("a", "b") };
{
EditCommand edit = new EditCommand(); // empty
SequenceI[] seqs = new SequenceI[] { new Sequence("a", "b") };
-
+
// 1 gap inserted, balanced by 1 delete
Edit e1 = edit.new Edit(Action.INSERT_GAP, seqs, 1, 1, '-');
edit.addEdit(e1);
// 1 gap inserted, balanced by 1 delete
Edit e1 = edit.new Edit(Action.INSERT_GAP, seqs, 1, 1, '-');
edit.addEdit(e1);
@@
-174,7
+170,7
@@
public class SeqPanelTest
edit.addEdit(e2);
String expected = MessageManager.formatMessage("label.insert_gap", "1");
assertEquals(SeqPanel.getEditStatusMessage(edit), expected);
edit.addEdit(e2);
String expected = MessageManager.formatMessage("label.insert_gap", "1");
assertEquals(SeqPanel.getEditStatusMessage(edit), expected);
-
+
// 2 more gaps makes +3
Edit e3 = edit.new Edit(Action.INSERT_GAP, seqs, 1, 2, '-');
edit.addEdit(e3);
// 2 more gaps makes +3
Edit e3 = edit.new Edit(Action.INSERT_GAP, seqs, 1, 2, '-');
edit.addEdit(e3);
@@
-183,7
+179,7
@@
public class SeqPanelTest
edit.addEdit(e4);
expected = MessageManager.formatMessage("label.insert_gaps", "3");
assertEquals(SeqPanel.getEditStatusMessage(edit), expected);
edit.addEdit(e4);
expected = MessageManager.formatMessage("label.insert_gaps", "3");
assertEquals(SeqPanel.getEditStatusMessage(edit), expected);
-
+
// 2 deletes makes + 1
Edit e5 = edit.new Edit(Action.DELETE_GAP, seqs, 1, 2, '-');
edit.addEdit(e5);
// 2 deletes makes + 1
Edit e5 = edit.new Edit(Action.DELETE_GAP, seqs, 1, 2, '-');
edit.addEdit(e5);
@@
-192,7
+188,7
@@
public class SeqPanelTest
edit.addEdit(e6);
expected = MessageManager.formatMessage("label.insert_gap", "1");
assertEquals(SeqPanel.getEditStatusMessage(edit), expected);
edit.addEdit(e6);
expected = MessageManager.formatMessage("label.insert_gap", "1");
assertEquals(SeqPanel.getEditStatusMessage(edit), expected);
-
+
// 1 more delete makes 0 - no text
Edit e7 = edit.new Edit(Action.DELETE_GAP, seqs, 1, 1, '-');
edit.addEdit(e7);
// 1 more delete makes 0 - no text
Edit e7 = edit.new Edit(Action.DELETE_GAP, seqs, 1, 1, '-');
edit.addEdit(e7);
@@
-201,7
+197,7
@@
public class SeqPanelTest
edit.addEdit(e8);
expected = MessageManager.formatMessage("label.insert_gaps", "2");
assertNull(SeqPanel.getEditStatusMessage(edit));
edit.addEdit(e8);
expected = MessageManager.formatMessage("label.insert_gaps", "2");
assertNull(SeqPanel.getEditStatusMessage(edit));
-
+
// 1 more delete makes 1 delete
Edit e9 = edit.new Edit(Action.DELETE_GAP, seqs, 1, 1, '-');
edit.addEdit(e9);
// 1 more delete makes 1 delete
Edit e9 = edit.new Edit(Action.DELETE_GAP, seqs, 1, 1, '-');
edit.addEdit(e9);
@@
-210,7
+206,7
@@
public class SeqPanelTest
edit.addEdit(e10);
expected = MessageManager.formatMessage("label.delete_gap", "1");
assertEquals(SeqPanel.getEditStatusMessage(edit), expected);
edit.addEdit(e10);
expected = MessageManager.formatMessage("label.delete_gap", "1");
assertEquals(SeqPanel.getEditStatusMessage(edit), expected);
-
+
// 2 more deletes makes 3 deletes
Edit e11 = edit.new Edit(Action.DELETE_GAP, seqs, 1, 2, '-');
edit.addEdit(e11);
// 2 more deletes makes 3 deletes
Edit e11 = edit.new Edit(Action.DELETE_GAP, seqs, 1, 2, '-');
edit.addEdit(e11);
@@
-243,8
+239,8
@@
public class SeqPanelTest
/*
* mouse at top left of unwrapped panel
*/
/*
* mouse at top left of unwrapped panel
*/
- MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y,
- 0, 0, 0, false, 0);
+ MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0,
+ x, y, 0, 0, 0, false, 0);
MousePos pos = testee.findMousePosition(evt);
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, 0);
MousePos pos = testee.findMousePosition(evt);
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, 0);
@@
-254,7
+250,8
@@
public class SeqPanelTest
@AfterMethod(alwaysRun = true)
public void tearDown()
{
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
}
@Test(groups = "Functional")
}
@Test(groups = "Functional")
@@
-274,22
+271,22
@@
public class SeqPanelTest
final int charHeight = av.getCharHeight();
final int charWidth = av.getCharWidth();
final int alignmentHeight = av.getAlignment().getHeight();
final int charHeight = av.getCharHeight();
final int charWidth = av.getCharWidth();
final int alignmentHeight = av.getAlignment().getHeight();
-
+
// sanity checks:
assertTrue(charHeight > 0);
assertTrue(charWidth > 0);
assertTrue(alignFrame.alignPanel.getSeqPanel().getWidth() > 0);
// sanity checks:
assertTrue(charHeight > 0);
assertTrue(charWidth > 0);
assertTrue(alignFrame.alignPanel.getSeqPanel().getWidth() > 0);
-
+
SeqPanel testee = alignFrame.alignPanel.getSeqPanel();
int x = 0;
int y = 0;
SeqPanel testee = alignFrame.alignPanel.getSeqPanel();
int x = 0;
int y = 0;
-
+
/*
* mouse at top left of wrapped panel; there is a gap of charHeight
* above the alignment
*/
/*
* mouse at top left of wrapped panel; there is a gap of charHeight
* above the alignment
*/
- MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y,
- 0, 0, 0, false, 0);
+ MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0,
+ x, y, 0, 0, 0, false, 0);
MousePos pos = testee.findMousePosition(evt);
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, -1); // above sequences
MousePos pos = testee.findMousePosition(evt);
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, -1); // above sequences
@@
-299,8
+296,8
@@
public class SeqPanelTest
* cursor at bottom of gap above
*/
y = charHeight - 1;
* cursor at bottom of gap above
*/
y = charHeight - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
@@
-309,8
+306,8
@@
public class SeqPanelTest
* cursor over top of first sequence
*/
y = charHeight;
* cursor over top of first sequence
*/
y = charHeight;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
@@
-319,8
+316,8
@@
public class SeqPanelTest
* cursor at bottom of first sequence
*/
y = 2 * charHeight - 1;
* cursor at bottom of first sequence
*/
y = 2 * charHeight - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
@@
-329,8
+326,8
@@
public class SeqPanelTest
* cursor at top of second sequence
*/
y = 2 * charHeight;
* cursor at top of second sequence
*/
y = 2 * charHeight;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 1);
assertEquals(pos.annotationIndex, -1);
@@
-339,8
+336,8
@@
public class SeqPanelTest
* cursor at bottom of second sequence
*/
y = 3 * charHeight - 1;
* cursor at bottom of second sequence
*/
y = 3 * charHeight - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 1);
assertEquals(pos.annotationIndex, -1);
@@
-349,8
+346,8
@@
public class SeqPanelTest
* cursor at bottom of last sequence
*/
y = charHeight * (1 + alignmentHeight) - 1;
* cursor at bottom of last sequence
*/
y = charHeight * (1 + alignmentHeight) - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
@@
-360,8
+357,8
@@
public class SeqPanelTest
* method reports index of nearest sequence above
*/
y += 1;
* method reports index of nearest sequence above
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
@@
-370,8
+367,8
@@
public class SeqPanelTest
* cursor still in the gap above annotations, now at the bottom of it
*/
y += SeqCanvas.SEQS_ANNOTATION_GAP - 1; // 3-1 = 2
* cursor still in the gap above annotations, now at the bottom of it
*/
y += SeqCanvas.SEQS_ANNOTATION_GAP - 1; // 3-1 = 2
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
@@
-384,8
+381,8
@@
public class SeqPanelTest
* cursor at the top of the n'th annotation
*/
y += 1;
* cursor at the top of the n'th annotation
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0,
+ 0, 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, n); // over n'th annotation
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, n); // over n'th annotation
@@
-394,8
+391,8
@@
public class SeqPanelTest
* cursor at the bottom of the n'th annotation
*/
y += annotationRows[n].height - 1;
* cursor at the bottom of the n'th annotation
*/
y += annotationRows[n].height - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0,
+ 0, 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, n);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, n);
@@
-405,8
+402,8
@@
public class SeqPanelTest
* cursor in gap between wrapped widths
*/
y += 1;
* cursor in gap between wrapped widths
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
@@
-415,8
+412,8
@@
public class SeqPanelTest
* cursor at bottom of gap between wrapped widths
*/
y += charHeight - 1;
* cursor at bottom of gap between wrapped widths
*/
y += charHeight - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
@@
-425,8
+422,8
@@
public class SeqPanelTest
* cursor at top of first sequence, second wrapped width
*/
y += 1;
* cursor at top of first sequence, second wrapped width
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
@@
-448,119
+445,120
@@
public class SeqPanelTest
final int charHeight = av.getCharHeight();
final int charWidth = av.getCharWidth();
final int alignmentHeight = av.getAlignment().getHeight();
final int charHeight = av.getCharHeight();
final int charWidth = av.getCharWidth();
final int alignmentHeight = av.getAlignment().getHeight();
-
+
// sanity checks:
assertTrue(charHeight > 0);
assertTrue(charWidth > 0);
assertTrue(alignFrame.alignPanel.getSeqPanel().getWidth() > 0);
// sanity checks:
assertTrue(charHeight > 0);
assertTrue(charWidth > 0);
assertTrue(alignFrame.alignPanel.getSeqPanel().getWidth() > 0);
-
+
SeqPanel testee = alignFrame.alignPanel.getSeqPanel();
int x = 0;
int y = 0;
SeqPanel testee = alignFrame.alignPanel.getSeqPanel();
int x = 0;
int y = 0;
-
+
/*
* mouse at top left of wrapped panel; there is a gap of charHeight
* above the alignment
*/
/*
* mouse at top left of wrapped panel; there is a gap of charHeight
* above the alignment
*/
- MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y,
- 0, 0, 0, false, 0);
+ MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0,
+ x, y, 0, 0, 0, false, 0);
MousePos pos = testee.findMousePosition(evt);
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, -1); // above sequences
assertEquals(pos.annotationIndex, -1);
MousePos pos = testee.findMousePosition(evt);
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, -1); // above sequences
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor at bottom of gap above
* two charHeights including scale panel
*/
y = 2 * charHeight - 1;
/*
* cursor at bottom of gap above
* two charHeights including scale panel
*/
y = 2 * charHeight - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor over top of first sequence
*/
y += 1;
/*
* cursor over top of first sequence
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor at bottom of first sequence
*/
y += charHeight - 1;
/*
* cursor at bottom of first sequence
*/
y += charHeight - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor at top of second sequence
*/
y += 1;
/*
* cursor at top of second sequence
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 1);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor at bottom of second sequence
*/
y += charHeight - 1;
/*
* cursor at bottom of second sequence
*/
y += charHeight - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 1);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor at bottom of last sequence
* (scale + gap + sequences)
*/
y = charHeight * (2 + alignmentHeight) - 1;
/*
* cursor at bottom of last sequence
* (scale + gap + sequences)
*/
y = charHeight * (2 + alignmentHeight) - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor below sequences, in 3-pixel gap above annotations
*/
y += 1;
/*
* cursor below sequences, in 3-pixel gap above annotations
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor still in the gap above annotations, now at the bottom of it
* method reports index of nearest sequence above
*/
y += SeqCanvas.SEQS_ANNOTATION_GAP - 1; // 3-1 = 2
/*
* cursor still in the gap above annotations, now at the bottom of it
* method reports index of nearest sequence above
*/
y += SeqCanvas.SEQS_ANNOTATION_GAP - 1; // 3-1 = 2
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
-
- AlignmentAnnotation[] annotationRows = av.getAlignment().getAlignmentAnnotation();
+
+ AlignmentAnnotation[] annotationRows = av.getAlignment()
+ .getAlignmentAnnotation();
for (int n = 0; n < annotationRows.length; n++)
{
/*
* cursor at the top of the n'th annotation
*/
y += 1;
for (int n = 0; n < annotationRows.length; n++)
{
/*
* cursor at the top of the n'th annotation
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0,
+ 0, 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, n); // over n'th annotation
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, n); // over n'th annotation
@@
-569,8
+567,8
@@
public class SeqPanelTest
* cursor at the bottom of the n'th annotation
*/
y += annotationRows[n].height - 1;
* cursor at the bottom of the n'th annotation
*/
y += annotationRows[n].height - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0,
+ 0, 0, false, 0);
pos = testee.findMousePosition(evt);
SeqCanvas sc = testee.seqCanvas;
assertEquals(pos.seqIndex, alignmentHeight - 1,
pos = testee.findMousePosition(evt);
SeqCanvas sc = testee.seqCanvas;
assertEquals(pos.seqIndex, alignmentHeight - 1,
@@
-580,33
+578,33
@@
public class SeqPanelTest
sc.wrappedSpaceAboveAlignment));
assertEquals(pos.annotationIndex, n);
}
sc.wrappedSpaceAboveAlignment));
assertEquals(pos.annotationIndex, n);
}
-
+
/*
* cursor in gap between wrapped widths
*/
y += 1;
/*
* cursor in gap between wrapped widths
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor at bottom of gap between wrapped widths
*/
y += charHeight - 1;
/*
* cursor at bottom of gap between wrapped widths
*/
y += charHeight - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor at top of scale, second wrapped width
*/
y += 1;
/*
* cursor at top of scale, second wrapped width
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
@@
-615,8
+613,8
@@
public class SeqPanelTest
* cursor at bottom of scale, second wrapped width
*/
y += charHeight - 1;
* cursor at bottom of scale, second wrapped width
*/
y += charHeight - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
@@
-625,8
+623,8
@@
public class SeqPanelTest
* cursor at top of first sequence, second wrapped width
*/
y += 1;
* cursor at top of first sequence, second wrapped width
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
@@
-649,33
+647,33
@@
public class SeqPanelTest
final int charHeight = av.getCharHeight();
final int charWidth = av.getCharWidth();
final int alignmentHeight = av.getAlignment().getHeight();
final int charHeight = av.getCharHeight();
final int charWidth = av.getCharWidth();
final int alignmentHeight = av.getAlignment().getHeight();
-
+
// sanity checks:
assertTrue(charHeight > 0);
assertTrue(charWidth > 0);
assertTrue(alignFrame.alignPanel.getSeqPanel().getWidth() > 0);
// sanity checks:
assertTrue(charHeight > 0);
assertTrue(charWidth > 0);
assertTrue(alignFrame.alignPanel.getSeqPanel().getWidth() > 0);
-
+
SeqPanel testee = alignFrame.alignPanel.getSeqPanel();
int x = 0;
int y = 0;
SeqPanel testee = alignFrame.alignPanel.getSeqPanel();
int x = 0;
int y = 0;
-
+
/*
* mouse at top left of wrapped panel; there is a gap of charHeight
* above the alignment
*/
/*
* mouse at top left of wrapped panel; there is a gap of charHeight
* above the alignment
*/
- MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y,
- 0, 0, 0, false, 0);
+ MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0,
+ x, y, 0, 0, 0, false, 0);
MousePos pos = testee.findMousePosition(evt);
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, -1); // above sequences
assertEquals(pos.annotationIndex, -1);
MousePos pos = testee.findMousePosition(evt);
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, -1); // above sequences
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor over top of first sequence
*/
y = charHeight;
/*
* cursor over top of first sequence
*/
y = charHeight;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
@@
-684,38
+682,38
@@
public class SeqPanelTest
* cursor at bottom of last sequence
*/
y = charHeight * (1 + alignmentHeight) - 1;
* cursor at bottom of last sequence
*/
y = charHeight * (1 + alignmentHeight) - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, alignmentHeight - 1);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor below sequences, at top of charHeight gap between widths
*/
y += 1;
/*
* cursor below sequences, at top of charHeight gap between widths
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor below sequences, at top of charHeight gap between widths
*/
y += charHeight - 1;
/*
* cursor below sequences, at top of charHeight gap between widths
*/
y += charHeight - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor at the top of the first sequence, second width
*/
y += 1;
/*
* cursor at the top of the first sequence, second width
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.annotationIndex, -1);
@@
-737,40
+735,40
@@
public class SeqPanelTest
/*
* mouse at top left of unwrapped panel
*/
/*
* mouse at top left of unwrapped panel
*/
- MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0,
- 0, 0, 0, false, 0);
+ MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0,
+ x, 0, 0, 0, 0, false, 0);
assertEquals(testee.findColumn(evt), 0);
assertEquals(testee.findColumn(evt), 0);
-
+
/*
* not quite one charWidth across
*/
/*
* not quite one charWidth across
*/
- x = charWidth-1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0,
- 0, 0, 0, false, 0);
+ x = charWidth - 1;
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
+ 0, false, 0);
assertEquals(testee.findColumn(evt), 0);
/*
* one charWidth across
*/
x = charWidth;
assertEquals(testee.findColumn(evt), 0);
/*
* one charWidth across
*/
x = charWidth;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
+ 0, false, 0);
assertEquals(testee.findColumn(evt), 1);
/*
* two charWidths across
*/
x = 2 * charWidth;
assertEquals(testee.findColumn(evt), 1);
/*
* two charWidths across
*/
x = 2 * charWidth;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
+ 0, false, 0);
assertEquals(testee.findColumn(evt), 2);
/*
* limited to last column of seqcanvas
*/
x = 20000;
assertEquals(testee.findColumn(evt), 2);
/*
* limited to last column of seqcanvas
*/
x = 20000;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
+ 0, false, 0);
SeqCanvas seqCanvas = alignFrame.alignPanel.getSeqPanel().seqCanvas;
int w = seqCanvas.getWidth();
// limited to number of whole columns, base 0,
SeqCanvas seqCanvas = alignFrame.alignPanel.getSeqPanel().seqCanvas;
int w = seqCanvas.getWidth();
// limited to number of whole columns, base 0,
@@
-785,8
+783,8
@@
public class SeqPanelTest
alignFrame.getViewport().hideColumns(4, 9);
x = 5 * charWidth + 2;
// x is in 6th visible column, absolute column 12, or 11 base 0
alignFrame.getViewport().hideColumns(4, 9);
x = 5 * charWidth + 2;
// x is in 6th visible column, absolute column 12, or 11 base 0
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
+ 0, false, 0);
assertEquals(testee.findColumn(evt), 11);
}
assertEquals(testee.findColumn(evt), 11);
}
@@
-806,28
+804,28
@@
public class SeqPanelTest
final int charWidth = av.getCharWidth();
assertTrue(charWidth > 0); // sanity check
assertEquals(av.getRanges().getStartRes(), 0);
final int charWidth = av.getCharWidth();
assertTrue(charWidth > 0); // sanity check
assertEquals(av.getRanges().getStartRes(), 0);
-
+
/*
* mouse at top left of wrapped panel, no West (left) scale
*/
/*
* mouse at top left of wrapped panel, no West (left) scale
*/
- MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0,
- 0, 0, 0, false, 0);
+ MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0,
+ x, 0, 0, 0, 0, false, 0);
assertEquals(testee.findColumn(evt), 0);
assertEquals(testee.findColumn(evt), 0);
-
+
/*
* not quite one charWidth across
*/
/*
* not quite one charWidth across
*/
- x = charWidth-1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0,
- 0, 0, 0, false, 0);
+ x = charWidth - 1;
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
+ 0, false, 0);
assertEquals(testee.findColumn(evt), 0);
assertEquals(testee.findColumn(evt), 0);
-
+
/*
* one charWidth across
*/
x = charWidth;
/*
* one charWidth across
*/
x = charWidth;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
+ 0, false, 0);
assertEquals(testee.findColumn(evt), 1);
/*
assertEquals(testee.findColumn(evt), 1);
/*
@@
-839,13
+837,13
@@
public class SeqPanelTest
int labelWidth = (int) PA.getValue(seqCanvas, "labelWidthWest");
assertTrue(labelWidth > 0);
x = labelWidth - 1;
int labelWidth = (int) PA.getValue(seqCanvas, "labelWidthWest");
assertTrue(labelWidth > 0);
x = labelWidth - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
+ 0, false, 0);
assertEquals(testee.findColumn(evt), -1);
x = labelWidth;
assertEquals(testee.findColumn(evt), -1);
x = labelWidth;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
+ 0, false, 0);
assertEquals(testee.findColumn(evt), 0);
/*
assertEquals(testee.findColumn(evt), 0);
/*
@@
-854,8
+852,8
@@
public class SeqPanelTest
int residuesWide = av.getRanges().getViewportWidth();
assertTrue(residuesWide > 0);
x = labelWidth + charWidth * residuesWide - 1;
int residuesWide = av.getRanges().getViewportWidth();
assertTrue(residuesWide > 0);
x = labelWidth + charWidth * residuesWide - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
+ 0, false, 0);
assertEquals(testee.findColumn(evt), residuesWide - 1);
/*
assertEquals(testee.findColumn(evt), residuesWide - 1);
/*
@@
-869,13
+867,14
@@
public class SeqPanelTest
assertTrue(residuesWide2 > 0);
assertTrue(residuesWide2 < residuesWide); // available width reduced
x += 1; // just over left edge of scale right
assertTrue(residuesWide2 > 0);
assertTrue(residuesWide2 < residuesWide); // available width reduced
x += 1; // just over left edge of scale right
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
+ 0, false, 0);
assertEquals(testee.findColumn(evt), -1);
assertEquals(testee.findColumn(evt), -1);
-
+
// todo add startRes offset, hidden columns
}
// todo add startRes offset, hidden columns
}
+
@BeforeClass(alwaysRun = true)
public static void setUpBeforeClass() throws Exception
{
@BeforeClass(alwaysRun = true)
public static void setUpBeforeClass() throws Exception
{
@@
-905,6
+904,7
@@
public class SeqPanelTest
e.printStackTrace();
}
}
e.printStackTrace();
}
}
+
@Test(groups = "Functional")
public void testFindMousePosition_wrapped_scales_longSequence()
{
@Test(groups = "Functional")
public void testFindMousePosition_wrapped_scales_longSequence()
{
@@
-915,13
+915,13
@@
public class SeqPanelTest
Cache.applicationProperties.setProperty("FONT_STYLE", "0");
// sequence of 50 bases, doubled 10 times, = 51200 bases
String dna = "ATGGCCATTGGGCCCAAATTTCCCAAAGGGTTTCCCTGAGGTCAGTCAGA";
Cache.applicationProperties.setProperty("FONT_STYLE", "0");
// sequence of 50 bases, doubled 10 times, = 51200 bases
String dna = "ATGGCCATTGGGCCCAAATTTCCCAAAGGGTTTCCCTGAGGTCAGTCAGA";
- for (int i = 0 ; i < 10 ; i++)
+ for (int i = 0; i < 10; i++)
{
dna += dna;
}
assertEquals(dna.length(), 51200);
AlignFrame alignFrame = new FileLoader()
{
dna += dna;
}
assertEquals(dna.length(), 51200);
AlignFrame alignFrame = new FileLoader()
- .LoadFileWaitTillLoaded(dna, DataSourceType.PASTE);
+ .LoadFileWaitTillLoaded("dna " + dna, DataSourceType.PASTE);
SeqPanel testee = alignFrame.alignPanel.getSeqPanel();
AlignViewport av = alignFrame.getViewport();
av.setScaleAboveWrapped(true);
SeqPanel testee = alignFrame.alignPanel.getSeqPanel();
AlignViewport av = alignFrame.getViewport();
av.setScaleAboveWrapped(true);
@@
-935,12
+935,12
@@
public class SeqPanelTest
} catch (InterruptedException e)
{
}
} catch (InterruptedException e)
{
}
-
+
final int charHeight = av.getCharHeight();
final int charWidth = av.getCharWidth();
assertEquals(charHeight, 17);
assertEquals(charWidth, 12);
final int charHeight = av.getCharHeight();
final int charWidth = av.getCharWidth();
assertEquals(charHeight, 17);
assertEquals(charWidth, 12);
-
+
FontMetrics fm = testee.getFontMetrics(av.getFont());
int labelWidth = fm.stringWidth("00000") + charWidth;
assertEquals(labelWidth, 57); // 5 x 9 + charWidth
FontMetrics fm = testee.getFontMetrics(av.getFont());
int labelWidth = fm.stringWidth("00000") + charWidth;
assertEquals(labelWidth, 57); // 5 x 9 + charWidth
@@
-948,13
+948,13
@@
public class SeqPanelTest
int x = 0;
int y = 0;
int x = 0;
int y = 0;
-
+
/*
* mouse at top left of wrapped panel; there is a gap of 2 * charHeight
* above the alignment
*/
/*
* mouse at top left of wrapped panel; there is a gap of 2 * charHeight
* above the alignment
*/
- MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y,
- 0, 0, 0, false, 0);
+ MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0,
+ x, y, 0, 0, 0, false, 0);
MousePos pos = testee.findMousePosition(evt);
assertEquals(pos.column, -1); // over scale left, not an alignment column
assertEquals(pos.seqIndex, -1); // above sequences
MousePos pos = testee.findMousePosition(evt);
assertEquals(pos.column, -1); // over scale left, not an alignment column
assertEquals(pos.seqIndex, -1); // above sequences
@@
-965,94
+965,94
@@
public class SeqPanelTest
*/
y += charHeight;
x = labelWidth;
*/
y += charHeight;
x = labelWidth;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.column, 0);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.column, 0);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor over scale left of first sequence
*/
y += charHeight;
x = 0;
/*
* cursor over scale left of first sequence
*/
y += charHeight;
x = 0;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.column, -1);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.column, -1);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* cursor over start of first sequence
*/
x = labelWidth;
/*
* cursor over start of first sequence
*/
x = labelWidth;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.column, 0);
assertEquals(pos.annotationIndex, -1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.column, 0);
assertEquals(pos.annotationIndex, -1);
-
+
/*
* move one character right, to bottom pixel of same row
*/
x += charWidth;
y += charHeight - 1;
/*
* move one character right, to bottom pixel of same row
*/
x += charWidth;
y += charHeight - 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.column, 1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.column, 1);
-
+
/*
* move down one pixel - now in the no man's land between rows
*/
y += 1;
/*
* move down one pixel - now in the no man's land between rows
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.column, 1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.column, 1);
-
+
/*
* move down two char heights less one pixel - still in the no man's land
* (scale above + spacer line)
*/
y += (2 * charHeight - 1);
/*
* move down two char heights less one pixel - still in the no man's land
* (scale above + spacer line)
*/
y += (2 * charHeight - 1);
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.column, 1);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, -1);
assertEquals(pos.column, 1);
-
+
/*
* move down one more pixel - now on the next row of the sequence
*/
y += 1;
/*
* move down one more pixel - now on the next row of the sequence
*/
y += 1;
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.column, 1 + av.getWrappedWidth());
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
assertEquals(pos.column, 1 + av.getWrappedWidth());
-
+
/*
* scroll to near the end of the sequence
*/
SearchResultsI sr = new SearchResults();
int scrollTo = dna.length() - 1000;
/*
* scroll to near the end of the sequence
*/
SearchResultsI sr = new SearchResults();
int scrollTo = dna.length() - 1000;
- sr.addResult(av.getAlignment().getSequenceAt(0), scrollTo, scrollTo);
+ sr.addResult(av.getAlignment().getSequenceAt(0), scrollTo, scrollTo);
alignFrame.alignPanel.scrollToPosition(sr);
alignFrame.alignPanel.scrollToPosition(sr);
-
+
/*
* place the mouse on the first column of the 6th sequence, and
* verify that (computed) findMousePosition matches (actual) ViewportRanges
*/
x = labelWidth;
y = 17 * charHeight; // 17 = 6 times two header rows and 5 sequence rows
/*
* place the mouse on the first column of the 6th sequence, and
* verify that (computed) findMousePosition matches (actual) ViewportRanges
*/
x = labelWidth;
y = 17 * charHeight; // 17 = 6 times two header rows and 5 sequence rows
- evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0, 0,
- false, 0);
+ evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, y, 0, 0,
+ 0, false, 0);
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
int expected = av.getRanges().getStartRes() + 5 * av.getWrappedWidth();
pos = testee.findMousePosition(evt);
assertEquals(pos.seqIndex, 0);
int expected = av.getRanges().getStartRes() + 5 * av.getWrappedWidth();