{
AlignmentI al = new Alignment(seqs);
HiddenSequences hs = al.getHiddenSequences();
- for (int i = 0; i < SEQ_COUNT; i++)
+ int height = al.getHeight();
+ for (int i = 0; i < height; i++)
{
assertEquals(i, hs.findIndexWithoutHiddenSeqs(i));
}
/*
* alignment is now seq0/2/3/4/7/8/9
*/
- assertEquals(SEQ_COUNT - 3, al.getHeight());
+ assertEquals(height - 3, al.getHeight());
assertEquals(0, hs.findIndexWithoutHiddenSeqs(0));
assertEquals(0, hs.findIndexWithoutHiddenSeqs(1));
assertEquals(1, hs.findIndexWithoutHiddenSeqs(2));
assertEquals(4, hs.findIndexWithoutHiddenSeqs(7));
assertEquals(5, hs.findIndexWithoutHiddenSeqs(8));
assertEquals(6, hs.findIndexWithoutHiddenSeqs(9));
+
+ /*
+ * hide first two sequences
+ */
+ hs.showAll(null);
+ hs.hideSequence(seqs[0]);
+ hs.hideSequence(seqs[1]);
+ assertEquals(-1, hs.findIndexWithoutHiddenSeqs(0));
+ assertEquals(-1, hs.findIndexWithoutHiddenSeqs(1));
+ for (int i = 2; i < height; i++)
+ {
+ assertEquals(i - 2, hs.findIndexWithoutHiddenSeqs(i));
+ }
}
/**
// test that without hidden rows, findIndexNFromRow returns
// position n above provided position
- int pos = hs.findIndexNAboveRow(3, 10);
+ int pos = hs.subtractVisibleRows(3, 10);
assertEquals(7, pos);
// 0 returns same position
- pos = hs.findIndexNAboveRow(0, 10);
+ pos = hs.subtractVisibleRows(0, 10);
assertEquals(10, pos);
// overflow to top returns negative number
- pos = hs.findIndexNAboveRow(3, 0);
+ pos = hs.subtractVisibleRows(3, 0);
assertEquals(-3, pos);
// test that with hidden rows above result row
hs.hideSequence(seqs[3]);
// position n above provided position
- pos = hs.findIndexNAboveRow(3, 10);
+ pos = hs.subtractVisibleRows(3, 10);
assertEquals(7, pos);
// 0 returns same position
- pos = hs.findIndexNAboveRow(0, 10);
+ pos = hs.subtractVisibleRows(0, 10);
assertEquals(10, pos);
// test with one set of hidden rows between start and required position
hs.hideSequence(seqs[13]);
hs.hideSequence(seqs[14]);
hs.hideSequence(seqs[15]);
- pos = hs.findIndexNAboveRow(8, 17);
+ pos = hs.subtractVisibleRows(8, 17);
assertEquals(5, pos);
// test with two sets of hidden rows between start and required position
hs.hideSequence(seqs[20]);
hs.hideSequence(seqs[21]);
- pos = hs.findIndexNAboveRow(8, 23);
+ pos = hs.subtractVisibleRows(8, 23);
assertEquals(9, pos);
// repeat last 2 tests with no hidden columns to left of required position
hs.hideSequence(seqs[13]);
hs.hideSequence(seqs[14]);
hs.hideSequence(seqs[15]);
- pos = hs.findIndexNAboveRow(8, 17);
+ pos = hs.subtractVisibleRows(8, 17);
assertEquals(5, pos);
// test with two sets of hidden rows between start and required position
hs.hideSequence(seqs[20]);
hs.hideSequence(seqs[21]);
- pos = hs.findIndexNAboveRow(8, 23);
+ pos = hs.subtractVisibleRows(8, 23);
assertEquals(9, pos);
}