- /*
- * cursor at the top of the first annotation
- */
- y += 1;
- evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0,
- false, 0);
- pos = testee.findMousePosition(evt);
- assertEquals(pos.seqIndex, alignmentHeight - 1);
- assertEquals(pos.annotationIndex, 0); // over first annotation
-
- /*
- * cursor at the bottom of the first annotation
- */
- y += av.getAlignment().getAlignmentAnnotation()[0].height - 1;
- evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0,
- false, 0);
- pos = testee.findMousePosition(evt);
- assertEquals(pos.seqIndex, alignmentHeight - 1);
- assertEquals(pos.annotationIndex, 0);
-
- /*
- * cursor at the top of the second annotation
- */
- y += 1;
- evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0,
- false, 0);
- pos = testee.findMousePosition(evt);
- assertEquals(pos.seqIndex, alignmentHeight - 1);
- assertEquals(pos.annotationIndex, 1);
-
- /*
- * cursor at the bottom of the second annotation
- */
- y += av.getAlignment().getAlignmentAnnotation()[1].height - 1;
- evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0,
- false, 0);
- pos = testee.findMousePosition(evt);
- assertEquals(pos.seqIndex, alignmentHeight - 1);
- assertEquals(pos.annotationIndex, 1);
-
- /*
- * cursor at the top of the third annotation
- */
- y += 1;
- evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0,
- false, 0);
- pos = testee.findMousePosition(evt);
- assertEquals(pos.seqIndex, alignmentHeight - 1);
- assertEquals(pos.annotationIndex, 2);
-
- /*
- * cursor at the bottom of the third annotation
- */
- y += av.getAlignment().getAlignmentAnnotation()[2].height - 1;
- evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y, 0, 0, 0,
- false, 0);
- pos = testee.findMousePosition(evt);
- assertEquals(pos.seqIndex, alignmentHeight - 1);
- assertEquals(pos.annotationIndex, 2);
+ AlignmentAnnotation[] annotationRows = av.getAlignment()
+ .getAlignmentAnnotation();
+ 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);
+ pos = testee.findMousePosition(evt);
+ assertEquals(pos.seqIndex, alignmentHeight - 1);
+ assertEquals(pos.annotationIndex, n); // over n'th annotation
+
+ /*
+ * 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);
+ pos = testee.findMousePosition(evt);
+ assertEquals(pos.seqIndex, alignmentHeight - 1);
+ assertEquals(pos.annotationIndex, n);
+ }