Clover icon

jalviewX

  1. Project Clover database Wed Oct 31 2018 15:13:58 GMT
  2. Package jalview.viewmodel

File OverviewDimensionsHideHiddenTest.java

 

Code metrics

4
496
26
1
1,073
726
28
0.06
19.08
26
1.08

Classes

Class Line # Actions
OverviewDimensionsHideHiddenTest 45 496 28 0
1.0100%
 

Contributing tests

This file is covered by 17 tests. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package jalview.viewmodel;
22   
23    import static org.testng.Assert.assertEquals;
24    import static org.testng.Assert.assertFalse;
25    import static org.testng.Assert.assertTrue;
26   
27    import jalview.analysis.AlignmentGenerator;
28    import jalview.datamodel.Alignment;
29    import jalview.datamodel.AlignmentI;
30    import jalview.datamodel.ColumnSelection;
31    import jalview.datamodel.HiddenColumns;
32    import jalview.datamodel.Sequence;
33    import jalview.datamodel.SequenceCollectionI;
34    import jalview.datamodel.SequenceGroup;
35    import jalview.datamodel.SequenceI;
36   
37    import java.util.Hashtable;
38   
39    import org.testng.annotations.AfterClass;
40    import org.testng.annotations.BeforeClass;
41    import org.testng.annotations.BeforeMethod;
42    import org.testng.annotations.Test;
43   
44    @Test(singleThreaded = true)
 
45    public class OverviewDimensionsHideHiddenTest
46    {
47    AlignmentI al;
48   
49    OverviewDimensionsHideHidden od;
50   
51    // cached widths and heights
52    int boxWidth;
53    int boxHeight;
54    int viewHeight;
55    int viewWidth;
56    int alheight;
57    int alwidth;
58   
59    ViewportRanges vpranges;
60   
61    Hashtable<SequenceI, SequenceCollectionI> hiddenRepSequences = new Hashtable<>();
62   
63    HiddenColumns hiddenCols = new HiddenColumns();
64   
 
65  1 toggle @BeforeClass(alwaysRun = true)
66    public void setUpAlignment()
67    {
68    // create random alignment
69  1 AlignmentGenerator gen = new AlignmentGenerator(false);
70  1 al = gen.generate(157, 525, 123, 5, 5);
71    }
72   
 
73  17 toggle @BeforeMethod(alwaysRun = true)
74    public void setUp()
75    {
76  17 if (!hiddenRepSequences.isEmpty())
77    {
78  15 al.getHiddenSequences().showAll(hiddenRepSequences);
79    }
80  17 ColumnSelection colsel = new ColumnSelection();
81  17 hiddenCols.revealAllHiddenColumns(colsel);
82   
83  17 vpranges = new ViewportRanges(al);
84  17 vpranges.setViewportStartAndHeight(0, 18);
85  17 vpranges.setViewportStartAndWidth(0, 63);
86   
87  17 viewHeight = vpranges.getEndSeq() - vpranges.getStartSeq() + 1;
88  17 viewWidth = vpranges.getEndRes() - vpranges.getStartRes() + 1;
89   
90  17 HiddenColumns hiddenCols = new HiddenColumns();
91   
92  17 od = new OverviewDimensionsHideHidden(vpranges, true);
93    // Initial box sizing - default path through code
94  17 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
95   
96  17 mouseClick(od, 0, 0);
97  17 moveViewport(0, 0);
98   
99    // calculate with visible values
100  17 alheight = vpranges.getVisibleAlignmentHeight();
101  17 alwidth = vpranges.getVisibleAlignmentWidth();
102   
103  17 boxWidth = Math.round((float) (vpranges.getEndRes()
104    - vpranges.getStartRes() + 1)
105    * od.getWidth() / alwidth);
106  17 boxHeight = Math.round((float) (vpranges.getEndSeq()
107    - vpranges.getStartSeq() + 1)
108    * od.getSequencesHeight() / alheight);
109    }
110   
 
111  1 toggle @AfterClass(alwaysRun = true)
112    public void cleanUp()
113    {
114  1 al = null;
115    }
116   
117    /**
118    * Test that the OverviewDimensions constructor sets width and height
119    * correctly
120    */
 
121  1 toggle @Test(groups = { "Functional" })
122    public void testConstructor()
123    {
124  1 SequenceI seqa = new Sequence("Seq1", "ABC");
125  1 SequenceI seqb = new Sequence("Seq2", "ABC");
126  1 SequenceI seqc = new Sequence("Seq3", "ABC");
127  1 SequenceI seqd = new Sequence("Seq4", "ABC");
128  1 SequenceI seqe = new Sequence("Seq5",
129    "ABCABCABCABCABCABCABCABCBACBACBACBAC");
130   
131  1 int defaultGraphHeight = 20;
132  1 int maxWidth = 400;
133  1 int minWidth = 120;
134  1 int maxSeqHeight = 300;
135  1 int minSeqHeight = 40;
136   
137    // test for alignment with width > height
138  1 SequenceI[] seqs1 = new SequenceI[] { seqa, seqb };
139  1 Alignment al1 = new Alignment(seqs1);
140  1 ViewportRanges props = new ViewportRanges(al1);
141   
142  1 OverviewDimensions od = new OverviewDimensionsHideHidden(props, true);
143  1 int scaledHeight = 267;
144  1 assertEquals(od.getGraphHeight(), defaultGraphHeight);
145  1 assertEquals(od.getSequencesHeight(), scaledHeight);
146  1 assertEquals(od.getWidth(), maxWidth);
147  1 assertEquals(od.getHeight(), scaledHeight + defaultGraphHeight);
148   
149    // test for alignment with width < height
150  1 SequenceI[] seqs2 = new SequenceI[] { seqa, seqb, seqc, seqd };
151  1 Alignment al2 = new Alignment(seqs2);
152  1 props = new ViewportRanges(al2);
153   
154  1 od = new OverviewDimensionsHideHidden(props, true);
155  1 int scaledWidth = 300;
156  1 assertEquals(od.getGraphHeight(), defaultGraphHeight);
157  1 assertEquals(od.getSequencesHeight(), maxSeqHeight);
158  1 assertEquals(od.getWidth(), scaledWidth);
159  1 assertEquals(od.getHeight(), scaledWidth + defaultGraphHeight);
160   
161    // test for alignment with width > height and sequence height scaled below
162    // min value
163  1 SequenceI[] seqs3 = new SequenceI[] { seqe };
164  1 Alignment al3 = new Alignment(seqs3);
165  1 props = new ViewportRanges(al3);
166   
167  1 od = new OverviewDimensionsHideHidden(props, true);
168  1 assertEquals(od.getGraphHeight(), defaultGraphHeight);
169  1 assertEquals(od.getSequencesHeight(), minSeqHeight);
170  1 assertEquals(od.getWidth(), maxWidth);
171  1 assertEquals(od.getHeight(), minSeqHeight + defaultGraphHeight);
172   
173    // test for alignment with width < height and width scaled below min value
174  1 SequenceI[] seqs4 = new SequenceI[] { seqa, seqb, seqc, seqd, seqa,
175    seqb, seqc, seqd, seqa, seqb, seqc, seqd, seqa, seqb, seqc, seqd };
176  1 Alignment al4 = new Alignment(seqs4);
177  1 props = new ViewportRanges(al4);
178   
179  1 od = new OverviewDimensionsHideHidden(props, true);
180  1 assertEquals(od.getGraphHeight(), defaultGraphHeight);
181  1 assertEquals(od.getSequencesHeight(), maxSeqHeight);
182  1 assertEquals(od.getWidth(), minWidth);
183  1 assertEquals(od.getHeight(), maxSeqHeight + defaultGraphHeight);
184   
185  1 Alignment al5 = new Alignment(seqs4);
186  1 props = new ViewportRanges(al5);
187   
188  1 od = new OverviewDimensionsHideHidden(props, false);
189  1 assertEquals(od.getGraphHeight(), 0);
190  1 assertEquals(od.getSequencesHeight(), maxSeqHeight);
191  1 assertEquals(od.getWidth(), minWidth);
192  1 assertEquals(od.getHeight(), maxSeqHeight);
193    }
194   
195    /**
196    * Test that validation after mouse adjustments to boxX and boxY sets box
197    * dimensions and scroll values correctly, when there are no hidden rows or
198    * columns.
199    */
 
200  1 toggle @Test(groups = { "Functional" })
201    public void testSetBoxFromMouseClick()
202    {
203  1 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
204  1 assertEquals(od.getBoxX(), 0);
205  1 assertEquals(od.getBoxY(), 0);
206  1 assertEquals(od.getBoxWidth(), boxWidth);
207  1 assertEquals(vpranges.getStartRes(), 0);
208  1 assertEquals(vpranges.getStartSeq(), 0);
209   
210    // negative boxX value reset to 0
211  1 mouseClick(od, -5, 10);
212  1 assertEquals(od.getBoxX(), 0);
213  1 assertEquals(od.getBoxWidth(), boxWidth);
214  1 assertEquals(od.getBoxHeight(), boxHeight);
215  1 assertEquals(vpranges.getStartSeq() + vpranges.getViewportHeight() / 2,
216    Math.round((float) 10 * alheight / od.getSequencesHeight()));
217  1 assertEquals(vpranges.getStartRes(), 0);
218   
219    // negative boxY value reset to 0
220  1 mouseClick(od, 6, -2);
221  1 assertEquals(od.getBoxY(), 0);
222  1 assertEquals(od.getBoxWidth(), boxWidth);
223  1 assertEquals(od.getBoxHeight(), boxHeight);
224  1 assertEquals(vpranges.getStartRes(), 0);
225  1 assertEquals(vpranges.getStartSeq(), 0);
226   
227    // overly large boxX value reset to width-boxWidth
228  1 mouseClick(od, 101, 6);
229  1 assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth());
230  1 assertEquals(od.getBoxY(), 1);
231  1 assertEquals(od.getBoxWidth(), boxWidth);
232  1 assertEquals(od.getBoxHeight(), boxHeight);
233  1 assertEquals(vpranges.getStartRes(),
234    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
235  1 assertEquals(
236    vpranges.getStartSeq(),
237    Math.round((float) od.getBoxY() * alheight
238    / od.getSequencesHeight()));
239   
240    // overly large boxY value reset to sequenceHeight - boxHeight
241  1 mouseClick(od, 10, 520);
242  1 assertEquals(od.getBoxX(), 0);
243  1 assertEquals(od.getBoxY(), od.getSequencesHeight() - od.getBoxHeight());
244  1 assertEquals(od.getBoxWidth(), boxWidth);
245  1 assertEquals(od.getBoxHeight(), boxHeight);
246  1 assertEquals(vpranges.getStartRes(),
247    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
248   
249    // here (float) od.getBoxY() * alheight / od.getSequencesHeight() = 507.5
250    // and round rounds to 508; however we get 507 working with row values
251    // hence the subtraction of 1
252  1 assertEquals(
253    vpranges.getStartSeq(),
254    Math.round((float) od.getBoxY() * alheight
255    / od.getSequencesHeight()) - 1);
256   
257    // click past end of alignment, as above
258  1 mouseClick(od, 3000, 5);
259  1 assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth());
260  1 assertEquals(od.getBoxWidth(), boxWidth);
261  1 assertEquals(od.getBoxHeight(), boxHeight);
262  1 assertEquals(vpranges.getStartRes(),
263    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
264  1 assertEquals(
265    vpranges.getStartSeq(),
266    Math.round((float) od.getBoxY() * alheight
267    / od.getSequencesHeight()));
268   
269    // move viewport so startRes non-zero and then mouseclick
270  1 moveViewportH(20);
271   
272    // click at viewport position
273  1 int oldboxx = od.getBoxX();
274  1 int oldboxy = od.getBoxY();
275  1 mouseClick(od, od.getBoxX() + od.getBoxWidth() / 2 + 6,
276    od.getBoxY() + od.getBoxHeight() / 2 + 3);
277  1 assertEquals(od.getBoxX(), oldboxx + 6);
278  1 assertEquals(od.getBoxWidth(), boxWidth);
279  1 assertEquals(od.getBoxHeight(), boxHeight);
280  1 assertEquals(vpranges.getStartRes(),
281    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
282  1 assertEquals(od.getBoxY(), oldboxy + 3);
283  1 assertEquals(
284    vpranges.getStartSeq(),
285    Math.round((float) od.getBoxY() * alheight
286    / od.getSequencesHeight()));
287   
288    // click at top corner
289  1 mouseClick(od, 0, 0);
290  1 assertEquals(od.getBoxX(), 0);
291  1 assertEquals(vpranges.getStartRes(), 0);
292  1 assertEquals(od.getBoxY(), 0);
293  1 assertEquals(vpranges.getStartSeq(), 0);
294  1 assertEquals(od.getBoxWidth(), boxWidth);
295  1 assertEquals(od.getBoxHeight(), boxHeight);
296    }
297   
298    /**
299    * Test setting of the box position, when there are hidden cols at the start
300    * of the alignment
301    */
 
302  1 toggle @Test(groups = { "Functional" })
303    public void testFromMouseWithHiddenColsAtStart()
304    {
305  1 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
306  1 assertEquals(od.getBoxX(), 0);
307  1 assertEquals(od.getBoxY(), 0);
308  1 assertEquals(od.getBoxWidth(), boxWidth);
309  1 assertEquals(vpranges.getStartRes(), 0);
310  1 assertEquals(vpranges.getStartSeq(), 0);
311   
312    // hide cols at start and check updated box position is correct
313  1 int lastHiddenCol = 30;
314  1 hiddenCols.hideColumns(0, lastHiddenCol);
315   
316  1 testBoxIsAtClickPoint(boxWidth / 2, boxHeight / 2);
317   
318    // click to right of hidden columns, box moves to click point
319  1 testBoxIsAtClickPoint(41 + boxWidth / 2, boxHeight / 2);
320  1 assertEquals(vpranges.getStartSeq(), 0);
321  1 assertEquals(vpranges.getStartRes(),
322    Math.round((float) 41 * alwidth / od.getWidth()));
323   
324    // click to right of hidden columns such that box runs over right hand side
325    // of alignment
326    // box position is adjusted away from the edge
327    // overly large boxX value reset to width-boxWidth
328  1 int xpos = 100 + boxWidth / 2;
329  1 mouseClick(od, xpos, boxHeight / 2);
330  1 assertEquals(od.getBoxX(), Math.round(od.getWidth()) - boxWidth);
331  1 assertEquals(od.getBoxY(), 0);
332  1 assertEquals(od.getBoxWidth(), boxWidth);
333  1 assertEquals(od.getBoxHeight(), boxHeight);
334  1 assertEquals(vpranges.getStartRes(),
335    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
336  1 assertEquals(vpranges.getStartSeq(), 0);
337    }
338   
339    /**
340    * Test setting of the box position, when there are hidden cols in the middle
341    * of the alignment
342    */
 
343  1 toggle @Test(groups = { "Functional" })
344    public void testFromMouseWithHiddenColsInMiddle()
345    {
346  1 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
347  1 testBoxIsAtClickPoint(boxWidth / 2, boxHeight / 2);
348  1 assertEquals(od.getBoxX(), 0);
349  1 assertEquals(od.getBoxY(), 0);
350  1 assertEquals(od.getBoxWidth(), boxWidth);
351  1 assertEquals(vpranges.getStartRes(), 0);
352  1 assertEquals(vpranges.getStartSeq(), 0);
353   
354    // hide columns 63-73, no change to box position or dimensions
355  1 int firstHidden = 63;
356  1 int lastHidden = 73;
357  1 hiddenCols.hideColumns(firstHidden, lastHidden);
358   
359  1 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
360  1 testBoxIsAtClickPoint(boxWidth / 2, boxHeight / 2);
361  1 assertEquals(od.getBoxX(), 0);
362  1 assertEquals(od.getBoxY(), 0);
363  1 assertEquals(od.getBoxWidth(), boxWidth);
364  1 assertEquals(vpranges.getStartRes(), 0);
365  1 assertEquals(vpranges.getStartSeq(), 0);
366   
367    // move box so that it overlaps with hidden cols on one side
368    // box width, boxX and scrollCol as for unhidden case
369  1 int xpos = 54 - boxWidth / 2; // 54 is position in overview approx halfway
370    // between cols 60 and 70
371  1 mouseClick(od, xpos, boxHeight / 2);
372  1 testBoxIsAtClickPoint(xpos, boxHeight / 2);
373  1 assertEquals(vpranges.getStartRes(), 1 + // rounding
374    Math.round((xpos - boxWidth / 2) * alwidth / od.getWidth()));
375  1 assertEquals(vpranges.getStartSeq(), 0);
376   
377    // move box so that it completely covers hidden cols
378    // box width, boxX and scrollCol as for unhidden case
379  1 xpos = 33;
380  1 mouseClick(od, xpos, boxHeight / 2);
381  1 testBoxIsAtClickPoint(xpos, boxHeight / 2);
382  1 assertEquals(vpranges.getStartRes(),
383    Math.round((float) (xpos - boxWidth / 2) * alwidth
384    / od.getWidth()));
385  1 assertEquals(vpranges.getStartSeq(), 0);
386   
387    // move box so boxX is in hidden cols, box overhangs at right
388    // boxX and scrollCol at left of hidden area, box width unchanged
389  1 xpos = Math.round((float) 50 * od.getWidth() / alwidth) + boxWidth / 2;
390  1 mouseClick(od, xpos, boxHeight / 2);
391  1 assertEquals(od.getBoxX() + od.getBoxWidth() / 2, xpos);
392  1 assertEquals(od.getBoxY(), 0);
393  1 assertEquals(od.getBoxWidth(), boxWidth);
394  1 assertEquals(od.getBoxHeight(), boxHeight);
395  1 assertEquals(vpranges.getStartRes(), 50);
396  1 assertEquals(vpranges.getStartSeq(), 0);
397   
398    // move box so boxX is to right of hidden cols, but does not go beyond full
399    // width of alignment
400    // box width, boxX and scrollCol all as for non-hidden case
401  1 xpos = Math.round((float) 75 * od.getWidth() / alwidth) + boxWidth / 2;
402  1 mouseClick(od, xpos, boxHeight / 2);
403  1 assertEquals(od.getBoxX() + od.getBoxWidth() / 2, xpos);
404  1 assertEquals(od.getBoxY(), 0);
405  1 assertEquals(od.getBoxWidth(), boxWidth);
406  1 assertEquals(od.getBoxHeight(), boxHeight);
407  1 assertEquals(vpranges.getStartSeq(), 0);
408  1 assertEquals(vpranges.getStartRes(), 75);
409   
410    // move box so it goes beyond full width of alignment
411    // boxX, scrollCol adjusted back, box width normal
412  1 xpos = 3000;
413  1 mouseClick(od, xpos, boxHeight / 2);
414  1 assertEquals(od.getBoxX(), Math.round(od.getWidth()) - boxWidth);
415  1 assertEquals(od.getBoxY(), 0);
416  1 assertEquals(od.getBoxWidth(), boxWidth);
417  1 assertEquals(od.getBoxHeight(), boxHeight);
418  1 assertEquals(vpranges.getStartRes(),
419    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
420  1 assertEquals(vpranges.getStartSeq(), 0);
421   
422    }
423   
424    /**
425    * Test setting of the box position, when there are hidden cols at the end of
426    * the alignment
427    */
 
428  1 toggle @Test(groups = { "Functional" })
429    public void testFromMouseWithHiddenColsAtEnd()
430    {
431  1 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
432  1 assertEquals(od.getBoxX(), 0);
433  1 assertEquals(od.getBoxY(), 0);
434  1 assertEquals(od.getBoxWidth(), boxWidth);
435  1 assertEquals(vpranges.getStartRes(), 0);
436  1 assertEquals(vpranges.getStartSeq(), 0);
437   
438    // hide columns 140-164, no change to box position or dimensions
439  1 int firstHidden = 140;
440  1 int lastHidden = 164;
441  1 hiddenCols.hideColumns(firstHidden, lastHidden);
442  1 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
443  1 assertEquals(od.getBoxX(), 0);
444  1 assertEquals(od.getBoxY(), 0);
445  1 assertEquals(od.getBoxWidth(), boxWidth);
446  1 assertEquals(vpranges.getStartRes(), 0);
447  1 assertEquals(vpranges.getStartSeq(), 0);
448   
449    // click to left of hidden cols, without overlapping
450    // boxX, scrollCol and width as normal
451  1 int xpos = 30;
452  1 int ypos = 6;
453  1 testBoxIsAtClickPoint(xpos, ypos);
454  1 assertEquals(vpranges.getStartSeq(), Math.round(
455    (float) (ypos - boxHeight / 2) * alheight / od.getHeight()));
456  1 assertEquals(vpranges.getStartRes(), Math.round(
457    (float) (xpos - boxWidth / 2) * alwidth / od.getWidth()));
458   
459    // click to left of hidden cols, with overlap
460    // boxX and scrollCol adjusted for hidden cols, width normal
461  1 xpos = Math.round((float) 144 * od.getWidth() / alwidth) - boxWidth;
462  1 mouseClick(od, xpos, boxHeight / 2);
463  1 testBoxIsAtClickPoint(xpos, boxHeight / 2);
464  1 assertEquals(vpranges.getStartRes(),
465    Math.round((float) (xpos - boxWidth / 2) * alwidth
466    / od.getWidth()));
467  1 assertEquals(vpranges.getStartSeq(), 0);
468   
469    // click off end of alignment
470    // boxX and scrollCol adjusted backwards, width normal
471  1 xpos = 3000;
472  1 mouseClick(od, xpos, 0);
473  1 assertEquals(od.getBoxX(), Math.round(od.getWidth()) - boxWidth);
474  1 assertEquals(od.getBoxY(), 0);
475  1 assertEquals(od.getBoxWidth(), boxWidth);
476  1 assertEquals(od.getBoxHeight(), boxHeight);
477  1 assertEquals(vpranges.getStartRes(),
478    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
479  1 assertEquals(vpranges.getStartSeq(), 0);
480    }
481   
482    /**
483    * Test that the box position is set correctly when set from the viewport,
484    * with no hidden rows or columns
485    */
 
486  1 toggle @Test(groups = { "Functional" })
487    public void testSetBoxFromViewport()
488    {
489    // move viewport to start of alignment
490  1 moveViewport(0, 0);
491  1 assertEquals(od.getBoxX(), 0);
492  1 assertEquals(od.getBoxY(), 0);
493  1 assertEquals(od.getBoxWidth(), boxWidth);
494  1 assertEquals(od.getBoxHeight(), boxHeight);
495   
496    // move viewport to right
497  1 moveViewportH(70);
498  1 assertEquals(od.getBoxX(),
499    Math.round((float) 70 * od.getWidth() / alwidth));
500  1 assertEquals(od.getBoxY(), 0);
501  1 assertEquals(od.getBoxWidth(), boxWidth);
502  1 assertEquals(od.getBoxHeight(), boxHeight);
503   
504    // move viewport down
505  1 moveViewportV(100);
506  1 assertEquals(od.getBoxX(),
507    Math.round((float) 70 * od.getWidth() / alwidth));
508  1 assertEquals(od.getBoxY(),
509    Math.round(100 * od.getSequencesHeight() / alheight));
510  1 assertEquals(od.getBoxWidth(), boxWidth);
511  1 assertEquals(od.getBoxHeight(), boxHeight);
512   
513    // move viewport to bottom right
514  1 moveViewport(98, 508);
515  1 assertEquals(od.getBoxX(),
516    Math.round((float) 98 * od.getWidth() / alwidth));
517  1 assertEquals(od.getBoxY(),
518    Math.round((float) 508 * od.getSequencesHeight() / alheight));
519  1 assertEquals(od.getBoxWidth(), boxWidth);
520  1 assertEquals(od.getBoxHeight(), boxHeight);
521    }
522   
523    /**
524    * Test that the box position is set correctly when there are hidden columns
525    * at the start
526    */
 
527  1 toggle @Test(groups = { "Functional" })
528    public void testSetBoxFromViewportHiddenColsAtStart()
529    {
530  1 int firstHidden = 0;
531  1 int lastHidden = 20;
532  1 hiddenCols.hideColumns(firstHidden, lastHidden);
533   
534    // move viewport to start of alignment
535  1 moveViewport(0, 0);
536  1 assertEquals(od.getBoxX(), 0);
537  1 assertEquals(od.getBoxY(), 0);
538  1 assertEquals(od.getBoxWidth(), boxWidth);
539  1 assertEquals(od.getBoxHeight(), boxHeight);
540   
541    // move viewport to end of alignment - need to make startRes by removing
542    // hidden cols because of how viewport/overview are implemented
543  1 moveViewport(98 - lastHidden - 1, 0);
544  1 assertEquals(od.getBoxX(),
545    Math.round((float) (98 - lastHidden - 1) * od.getWidth()
546    / alwidth));
547  1 assertEquals(od.getBoxY(), 0);
548  1 assertEquals(od.getBoxWidth(), boxWidth);
549  1 assertEquals(od.getBoxHeight(), boxHeight);
550    }
551   
552    /**
553    * Test that the box position is set correctly when there are hidden columns
554    * in the middle
555    */
 
556  1 toggle @Test(groups = { "Functional" })
557    public void testSetBoxFromViewportHiddenColsInMiddle()
558    {
559  1 int firstHidden = 68;
560  1 int lastHidden = 78;
561  1 hiddenCols.hideColumns(firstHidden, lastHidden);
562   
563    // move viewport before hidden columns
564  1 moveViewport(3, 0);
565   
566  1 assertEquals(od.getBoxX(),
567    Math.round((float) 3 * od.getWidth() / alwidth));
568  1 assertEquals(od.getBoxY(), 0);
569  1 assertEquals(od.getBoxWidth(), boxWidth);
570  1 assertEquals(od.getBoxHeight(), boxHeight);
571   
572    // move viewport to left of hidden columns with overlap
573  1 moveViewport(10, 0);
574  1 assertEquals(od.getBoxX(),
575    Math.round((float) 10 * od.getWidth() / alwidth));
576  1 assertEquals(od.getBoxY(), 0);
577  1 assertEquals(od.getBoxWidth(), boxWidth);
578  1 assertEquals(od.getBoxHeight(), boxHeight);
579   
580    // move viewport to straddle hidden columns
581  1 moveViewport(63, 0);
582  1 assertEquals(od.getBoxX(),
583    Math.round((float) 63 * od.getWidth() / alwidth));
584  1 assertEquals(od.getBoxY(), 0);
585  1 assertEquals(od.getBoxWidth(), boxWidth);
586  1 assertEquals(od.getBoxHeight(), boxHeight);
587   
588    // move viewport to right of hidden columns, no overlap
589  1 moveViewport(80 - (lastHidden - firstHidden + 1), 0);
590  1 assertEquals(od.getBoxX(),
591    Math.round((float) (80 - (lastHidden - firstHidden + 1))
592    * od.getWidth() / alwidth));
593  1 assertEquals(od.getBoxY(), 0);
594  1 assertEquals(od.getBoxWidth(), boxWidth);
595  1 assertEquals(od.getBoxHeight(), boxHeight);
596   
597    }
598   
599    /**
600    * Test that the box position is set correctly when there are hidden columns
601    * at the end
602    */
 
603  1 toggle @Test(groups = { "Functional" })
604    public void testSetBoxFromViewportHiddenColsAtEnd()
605    {
606  1 int firstHidden = 152;
607  1 int lastHidden = 164;
608  1 hiddenCols.hideColumns(firstHidden, lastHidden);
609   
610    // move viewport before hidden columns
611  1 moveViewport(3, 0);
612  1 assertEquals(od.getBoxX(),
613    Math.round((float) 3 * od.getWidth() / alwidth));
614  1 assertEquals(od.getBoxY(), 0);
615  1 assertEquals(od.getBoxWidth(), boxWidth);
616  1 assertEquals(od.getBoxHeight(), boxHeight);
617   
618    // move viewport to hidden columns
619    // viewport can't actually extend into hidden cols,
620    // so move to the far right edge of the viewport
621  1 moveViewport(firstHidden - viewWidth, 0);
622  1 assertEquals(od.getBoxX(),
623    Math.round((float) (firstHidden - viewWidth)
624    * od.getWidth() / alwidth));
625  1 assertEquals(od.getBoxY(), 0);
626  1 assertEquals(od.getBoxWidth(), boxWidth);
627  1 assertEquals(od.getBoxHeight(), boxHeight);
628    }
629   
630    /**
631    * Test that the box position is set correctly when there are hidden rows at
632    * the start
633    */
 
634  1 toggle @Test(groups = { "Functional" })
635    public void testSetBoxFromViewportHiddenRowsAtStart()
636    {
637  1 int firstHidden = 0;
638  1 int lastHidden = 20;
639  1 hideSequences(firstHidden, lastHidden);
640   
641    // calculate with visible values
642  1 alheight = vpranges.getVisibleAlignmentHeight();
643  1 alwidth = vpranges.getVisibleAlignmentWidth();
644   
645  1 boxWidth = Math.round((float) (vpranges.getEndRes()
646    - vpranges.getStartRes() + 1)
647    * od.getWidth() / alwidth);
648  1 boxHeight = Math.round((float) (vpranges.getEndSeq()
649    - vpranges.getStartSeq() + 1)
650    * od.getSequencesHeight() / alheight);
651   
652    // move viewport to start of alignment:
653    // box moves to below hidden rows, height remains same
654  1 moveViewport(0, 0);
655  1 assertEquals(od.getBoxX(), 0);
656  1 assertEquals(od.getBoxY(), 0);
657  1 assertEquals(od.getBoxWidth(), boxWidth);
658  1 assertEquals(od.getBoxHeight(), boxHeight);
659   
660    // move viewport to end of alignment
661  1 moveViewport(0, 525 - viewHeight - lastHidden - 1);
662  1 assertEquals(od.getBoxX(), 0);
663  1 assertEquals(
664    od.getBoxY(),
665    Math.round((float) (525 - viewHeight - lastHidden - 1)
666    * od.getSequencesHeight()
667    / alheight));
668  1 assertEquals(od.getBoxWidth(), boxWidth);
669  1 assertEquals(od.getBoxHeight(), boxHeight);
670    }
671   
672    /**
673    * Test that the box position is set correctly when there are hidden rows in
674    * the middle
675    */
 
676  1 toggle @Test(groups = { "Functional" })
677    public void testSetBoxFromViewportHiddenRowsInMiddle()
678    {
679  1 int firstHidden = 200;
680  1 int lastHidden = 210;
681  1 hideSequences(firstHidden, lastHidden);
682   
683    // calculate with visible values
684  1 alheight = vpranges.getVisibleAlignmentHeight();
685  1 alwidth = vpranges.getVisibleAlignmentWidth();
686   
687  1 boxWidth = Math.round((float) (vpranges.getEndRes()
688    - vpranges.getStartRes() + 1)
689    * od.getWidth() / alwidth);
690  1 boxHeight = Math.round((float) (vpranges.getEndSeq()
691    - vpranges.getStartSeq() + 1)
692    * od.getSequencesHeight() / alheight);
693   
694    // move viewport to start of alignment:
695    // box, height etc as in non-hidden case
696  1 moveViewport(0, 0);
697  1 assertEquals(od.getBoxX(), 0);
698  1 assertEquals(od.getBoxY(), 0);
699  1 assertEquals(od.getBoxWidth(), boxWidth);
700  1 assertEquals(od.getBoxHeight(), boxHeight);
701   
702    // move viewport to straddle hidden rows
703  1 moveViewport(0, 198);
704  1 assertEquals(od.getBoxX(), 0);
705  1 assertEquals(od.getBoxY(), Math.round ((float)198 * od.getSequencesHeight()
706    / alheight));
707  1 assertEquals(od.getBoxWidth(), boxWidth);
708  1 assertEquals(od.getBoxHeight(), boxHeight);
709    }
710   
711    /**
712    * Test that the box position is set correctly when there are hidden rows at
713    * the bottom
714    */
 
715  1 toggle @Test(groups = { "Functional" })
716    public void testSetBoxFromViewportHiddenRowsAtEnd()
717    {
718  1 int firstHidden = 500;
719  1 int lastHidden = 524;
720  1 hideSequences(firstHidden, lastHidden);
721   
722    // calculate with visible values
723  1 alheight = vpranges.getVisibleAlignmentHeight();
724  1 alwidth = vpranges.getVisibleAlignmentWidth();
725   
726  1 boxWidth = Math.round((float) (vpranges.getEndRes()
727    - vpranges.getStartRes() + 1)
728    * od.getWidth() / alwidth);
729  1 boxHeight = Math.round((float) (vpranges.getEndSeq()
730    - vpranges.getStartSeq() + 1)
731    * od.getSequencesHeight() / alheight);
732   
733    // move viewport to start of alignment:
734    // box, height etc as in non-hidden case
735  1 moveViewport(0, 0);
736  1 assertEquals(od.getBoxX(), 0);
737  1 assertEquals(od.getBoxY(), 0);
738  1 assertEquals(od.getBoxWidth(), boxWidth);
739  1 assertEquals(od.getBoxHeight(), boxHeight);
740   
741    // move viewport to end of alignment
742    // viewport sits above hidden rows and does not include them
743  1 moveViewport(0, firstHidden - viewHeight - 1);
744  1 assertEquals(od.getBoxX(), 0);
745  1 assertEquals(
746    od.getBoxY(),
747    Math.round((float) (firstHidden - viewHeight - 1)
748    * od.getSequencesHeight() / alheight));
749  1 assertEquals(od.getBoxWidth(), boxWidth);
750  1 assertEquals(od.getBoxHeight(), boxHeight);
751   
752    }
753   
754    /**
755    * Test setting of the box position, when there are hidden rows at the start
756    * of the alignment
757    */
 
758  1 toggle @Test(groups = { "Functional" })
759    public void testFromMouseWithHiddenRowsAtStart()
760    {
761  1 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
762  1 assertEquals(od.getBoxX(), 0);
763  1 assertEquals(od.getBoxY(), 0);
764  1 assertEquals(od.getBoxHeight(), boxHeight);
765  1 assertEquals(od.getBoxWidth(), boxWidth);
766  1 assertEquals(vpranges.getStartRes(), 0);
767  1 assertEquals(vpranges.getStartSeq(), 0);
768   
769    // hide rows at start and check updated box position is correct
770  1 int lastHiddenRow = 30;
771  1 hideSequences(0, lastHiddenRow);
772   
773    // calculate with visible values
774  1 alheight = vpranges.getVisibleAlignmentHeight();
775  1 alwidth = vpranges.getVisibleAlignmentWidth();
776   
777  1 boxWidth = Math.round((float) (vpranges.getEndRes()
778    - vpranges.getStartRes() + 1)
779    * od.getWidth() / alwidth);
780  1 boxHeight = Math.round((float) (vpranges.getEndSeq()
781    - vpranges.getStartSeq() + 1)
782    * od.getSequencesHeight() / alheight);
783   
784  1 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
785  1 assertEquals(od.getBoxX(), 0);
786  1 assertEquals(od.getBoxY(), 0);
787  1 assertEquals(od.getBoxWidth(), boxWidth);
788  1 assertEquals(od.getBoxHeight(), boxHeight);
789   
790    // click below hidden rows
791  1 mouseClick(od, 0, 151 + boxHeight / 2);
792  1 assertEquals(od.getBoxX(), 0);
793  1 assertEquals(od.getBoxY(), 151);
794  1 assertEquals(od.getBoxWidth(), boxWidth);
795  1 assertEquals(od.getBoxHeight(), boxHeight);
796    }
797   
798    /**
799    * Test setting of the box position, when there are hidden rows at the middle
800    * of the alignment
801    */
 
802  1 toggle @Test(groups = { "Functional" })
803    public void testFromMouseWithHiddenRowsInMiddle()
804    {
805  1 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
806   
807  1 assertEquals(od.getBoxX(), 0);
808  1 assertEquals(od.getBoxY(), 0);
809  1 assertEquals(od.getBoxWidth(), boxWidth);
810  1 assertEquals(od.getBoxHeight(), boxHeight);
811  1 assertEquals(vpranges.getStartRes(), 0);
812  1 assertEquals(vpranges.getStartSeq(), 0);
813   
814    // hide rows in middle and check updated box position is correct
815    // no changes
816  1 int firstHiddenRow = 50;
817  1 int lastHiddenRow = 54;
818  1 hideSequences(firstHiddenRow, lastHiddenRow);
819   
820    // calculate with visible values
821  1 alheight = vpranges.getVisibleAlignmentHeight();
822  1 alwidth = vpranges.getVisibleAlignmentWidth();
823   
824  1 boxWidth = Math.round((float) (vpranges.getEndRes()
825    - vpranges.getStartRes() + 1)
826    * od.getWidth() / alwidth);
827  1 boxHeight = Math.round((float) (vpranges.getEndSeq()
828    - vpranges.getStartSeq() + 1)
829    * od.getSequencesHeight() / alheight);
830   
831  1 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
832   
833  1 assertEquals(od.getBoxX(), 0);
834  1 assertEquals(od.getBoxY(), 0);
835  1 assertEquals(od.getBoxWidth(), boxWidth);
836  1 assertEquals(od.getBoxHeight(), boxHeight);
837   
838    // click above hidden rows, so that box overlaps
839  1 int ypos = 35 + viewHeight / 2; // row value in residues
840  1 mouseClick(od, 0,
841    Math.round((float) ypos * od.getSequencesHeight() / alheight));
842  1 assertEquals(od.getBoxX(), 0);
843  1 assertEquals(od.getBoxY(),
844    Math.round((float) 35 * od.getSequencesHeight() / alheight));
845  1 assertEquals(od.getBoxWidth(), boxWidth);
846  1 assertEquals(od.getBoxHeight(), boxHeight);
847   
848    // click so that box straddles hidden rows
849  1 ypos = 45 + viewHeight / 2; // row value in residues
850  1 mouseClick(od, 0,
851    Math.round((float) ypos * od.getSequencesHeight() / alheight));
852  1 assertEquals(od.getBoxX(), 0);
853  1 assertEquals(od.getBoxY(),
854    Math.round((float) 45 * od.getSequencesHeight() / alheight));
855  1 assertEquals(od.getBoxWidth(), boxWidth);
856  1 assertEquals(od.getBoxHeight(), boxHeight);
857    }
858   
859    /**
860    * Test setting of the box position, when there are hidden rows at the end of
861    * the alignment
862    */
 
863  1 toggle @Test(groups = { "Functional" })
864    public void testFromMouseWithHiddenRowsAtEnd()
865    {
866  1 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
867  1 assertEquals(od.getBoxX(), 0);
868  1 assertEquals(od.getBoxY(), 0);
869  1 assertEquals(od.getBoxWidth(), boxWidth);
870  1 assertEquals(od.getBoxHeight(), boxHeight);
871  1 assertEquals(vpranges.getStartRes(), 0);
872  1 assertEquals(vpranges.getStartSeq(), 0);
873   
874    // hide rows at end and check updated box position is correct
875    // no changes
876  1 int firstHidden = 500;
877  1 int lastHidden = 524;
878  1 hideSequences(firstHidden, lastHidden);
879   
880    // calculate with visible values
881  1 alheight = vpranges.getVisibleAlignmentHeight();
882  1 alwidth = vpranges.getVisibleAlignmentWidth();
883   
884  1 boxWidth = Math.round((float) (vpranges.getEndRes()
885    - vpranges.getStartRes() + 1)
886    * od.getWidth() / alwidth);
887  1 boxHeight = Math.round((float) (vpranges.getEndSeq()
888    - vpranges.getStartSeq() + 1)
889    * od.getSequencesHeight() / alheight);
890   
891  1 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
892  1 assertEquals(od.getBoxX(), 0);
893  1 assertEquals(od.getBoxY(), 0);
894  1 assertEquals(od.getBoxWidth(), boxWidth);
895  1 assertEquals(od.getBoxHeight(), boxHeight);
896   
897    // click above hidden rows
898  1 int ypos = 41 + viewHeight / 2; // row 41
899  1 mouseClick(od, 0,
900    Math.round((float) ypos * od.getSequencesHeight() / alheight));
901  1 assertEquals(od.getBoxX(), 0);
902  1 assertEquals(od.getBoxY(),
903    Math.round((float) 41 * od.getSequencesHeight() / alheight));
904  1 assertEquals(od.getBoxWidth(), boxWidth);
905  1 assertEquals(od.getBoxHeight(), boxHeight);
906   
907    // click above hidden rows so box overlaps
908    // boxY, boxHeight remains same
909  1 ypos = 497 + viewHeight / 2; // row 497
910  1 mouseClick(od, 0,
911    Math.round((float) ypos * od.getSequencesHeight() / alheight));
912  1 assertEquals(od.getBoxX(), 0);
913  1 assertEquals(
914    od.getBoxY(),
915    Math.round((float) firstHidden * od.getSequencesHeight()
916    / alheight)
917    - boxHeight);
918  1 assertEquals(od.getBoxWidth(), boxWidth);
919  1 assertEquals(od.getBoxHeight(), boxHeight);
920    }
921   
922    /**
923    * Test the function to determine if a point is in the overview's box or not
924    */
 
925  1 toggle @Test(groups = { "Functional" })
926    public void testPositionInBox()
927    {
928  1 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
929   
930  1 assertFalse(od.isPositionInBox(0, 0));
931  1 assertTrue(od.isPositionInBox(10, 9));
932  1 assertFalse(od.isPositionInBox(0, 9));
933  1 assertFalse(od.isPositionInBox(9, 0));
934  1 assertFalse(od.isPositionInBox(75, 20));
935   
936    // hide columns in the box area
937    // makes absolutely no difference
938  1 hiddenCols.hideColumns(1, 4);
939  1 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
940  1 assertFalse(od.isPositionInBox(0, 0));
941  1 assertTrue(od.isPositionInBox(10, 9));
942  1 assertFalse(od.isPositionInBox(0, 9));
943  1 assertFalse(od.isPositionInBox(9, 0));
944  1 assertFalse(od.isPositionInBox(75, 20));
945   
946    // hide sequences in box area
947    // makes absolutely no difference
948  1 hideSequences(1, 3);
949  1 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
950  1 assertFalse(od.isPositionInBox(0, 0));
951  1 assertTrue(od.isPositionInBox(10, 9));
952  1 assertFalse(od.isPositionInBox(0, 9));
953  1 assertFalse(od.isPositionInBox(9, 0));
954  1 assertFalse(od.isPositionInBox(75, 20));
955    }
956   
957    /**
958    * Test the dragging functionality
959    */
 
960  1 toggle @Test(groups = { "Functional" })
961    public void testDragging()
962    {
963  1 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
964  1 od.setDragPoint(4, 16, al.getHiddenSequences(),
965    hiddenCols);
966  1 od.adjustViewportFromMouse(20, 22,
967    al.getHiddenSequences(), hiddenCols);
968   
969    // updates require an OverviewPanel to exist which it doesn't here
970    // so call setBoxPosition() as it would be called by the AlignmentPanel
971    // normally
972  1 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
973   
974    // corner moves 16 (20-4) right and 6 (22-16) up
975  1 assertEquals(od.getBoxX(), 16);
976  1 assertEquals(od.getBoxY(), 6);
977   
978    // hide columns - makes no difference
979  1 hiddenCols.hideColumns(1, 4);
980  1 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
981  1 od.setDragPoint(4, 16, al.getHiddenSequences(), hiddenCols);
982  1 od.adjustViewportFromMouse(20, 22, al.getHiddenSequences(), hiddenCols);
983  1 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
984   
985    // corner moves 16 (20-4) right and 6 (22-16) up
986  1 assertEquals(od.getBoxX(), 16);
987  1 assertEquals(od.getBoxY(), 6);
988   
989    // hide sequences in box area
990    // makes absolutely no difference
991  1 hideSequences(1, 3);
992  1 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
993  1 od.setDragPoint(4, 16, al.getHiddenSequences(), hiddenCols);
994  1 od.adjustViewportFromMouse(20, 22, al.getHiddenSequences(), hiddenCols);
995  1 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
996   
997    // corner moves 16 (20-4) right and 6 (22-16) up
998  1 assertEquals(od.getBoxX(), 16);
999  1 assertEquals(od.getBoxY(), 6);
1000    }
1001   
1002    /*
1003    * Move viewport horizontally: startRes + previous width gives new horizontal extent. Vertical extent stays the same.
1004    */
 
1005  2 toggle private void moveViewportH(int startRes)
1006    {
1007  2 vpranges.setViewportStartAndWidth(startRes, viewWidth);
1008  2 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
1009    }
1010   
1011    /*
1012    * Move viewport vertically: startSeq and endSeq give new vertical extent. Horizontal extent stays the same.
1013    */
 
1014  1 toggle private void moveViewportV(int startSeq)
1015    {
1016  1 vpranges.setViewportStartAndHeight(startSeq, viewHeight);
1017  1 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
1018    }
1019   
1020    /*
1021    * Move viewport horizontally and vertically.
1022    */
 
1023  33 toggle private void moveViewport(int startRes, int startSeq)
1024    {
1025  33 vpranges.setViewportStartAndWidth(startRes, viewWidth);
1026  33 vpranges.setViewportStartAndHeight(startSeq, viewHeight);
1027  33 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
1028    }
1029   
1030    /*
1031    * Mouse click as position x,y in overview window
1032    */
 
1033  45 toggle private void mouseClick(OverviewDimensions od, int x, int y)
1034    {
1035  45 od.updateViewportFromMouse(x, y, al.getHiddenSequences(), hiddenCols);
1036   
1037    // updates require an OverviewPanel to exist which it doesn't here
1038    // so call setBoxPosition() as it would be called by the AlignmentPanel
1039    // normally
1040  45 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
1041    }
1042   
1043    /*
1044    * Test that the box is positioned with the top left corner at xpos, ypos
1045    * and with the original width and height
1046    */
 
1047  8 toggle private void testBoxIsAtClickPoint(int xpos, int ypos)
1048    {
1049  8 mouseClick(od, xpos, ypos);
1050  8 assertEquals(od.getBoxX() + od.getBoxWidth() / 2, xpos);
1051  8 assertEquals(od.getBoxY() + od.getBoxHeight() / 2, ypos);
1052  8 assertEquals(od.getBoxWidth(), boxWidth);
1053  8 assertEquals(od.getBoxHeight(), boxHeight);
1054   
1055    }
1056   
1057    /*
1058    * Hide sequences between start and end
1059    */
 
1060  8 toggle private void hideSequences(int start, int end)
1061    {
1062  8 SequenceI[] allseqs = al.getSequencesArray();
1063  8 SequenceGroup theseSeqs = new SequenceGroup();
1064   
1065  132 for (int i = start; i <= end; i++)
1066    {
1067  124 theseSeqs.addSequence(allseqs[i], false);
1068  124 al.getHiddenSequences().hideSequence(allseqs[i]);
1069    }
1070   
1071  8 hiddenRepSequences.put(allseqs[start], theseSeqs);
1072    }
1073    }