2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
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.
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.
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.
23 import static jalview.util.UrlConstants.DB_ACCESSION;
24 import static jalview.util.UrlConstants.SEQUENCE_ID;
25 import static org.testng.AssertJUnit.assertEquals;
26 import static org.testng.AssertJUnit.assertFalse;
27 import static org.testng.AssertJUnit.assertTrue;
29 import jalview.datamodel.AlignmentAnnotation;
30 import jalview.datamodel.AlignmentI;
31 import jalview.datamodel.Annotation;
32 import jalview.datamodel.ColumnSelection;
33 import jalview.datamodel.DBRefEntry;
34 import jalview.datamodel.DBRefSource;
35 import jalview.datamodel.HiddenColumns;
36 import jalview.datamodel.Sequence;
37 import jalview.datamodel.SequenceGroup;
38 import jalview.datamodel.SequenceI;
39 import jalview.io.DataSourceType;
40 import jalview.io.FileFormat;
41 import jalview.io.FormatAdapter;
42 import jalview.util.MessageManager;
44 import java.awt.Component;
45 import java.io.IOException;
46 import java.util.ArrayList;
47 import java.util.Iterator;
48 import java.util.List;
50 import javax.swing.JMenu;
51 import javax.swing.JMenuItem;
52 import javax.swing.JPopupMenu;
53 import javax.swing.JSeparator;
55 import org.testng.annotations.BeforeClass;
56 import org.testng.annotations.BeforeMethod;
57 import org.testng.annotations.Test;
59 public class PopupMenuTest
62 @BeforeClass(alwaysRun = true)
63 public void setUpJvOptionPane()
65 JvOptionPane.setInteractiveMode(false);
66 JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
69 // 4 sequences x 13 positions
70 final static String TEST_DATA = ">FER_CAPAA Ferredoxin\n"
72 + ">FER_CAPAN Ferredoxin, chloroplast precursor\n"
74 + ">FER1_SOLLC Ferredoxin-1, chloroplast precursor\n"
75 + "TIETHKEEELTA-\n" + ">Q93XJ9_SOLTU Ferredoxin I precursor\n"
80 AlignmentPanel parentPanel;
82 PopupMenu testee = null;
84 @BeforeMethod(alwaysRun = true)
85 public void setUp() throws IOException
87 alignment = new FormatAdapter().readFile(TEST_DATA,
88 DataSourceType.PASTE, FileFormat.Fasta);
89 AlignFrame af = new AlignFrame(alignment, 700, 500);
90 parentPanel = new AlignmentPanel(af, af.getViewport());
91 testee = new PopupMenu(parentPanel, null, null);
93 for (SequenceI seq : alignment.getSequences())
95 final AlignmentAnnotation annotation = new AlignmentAnnotation(
96 "label" + i, "desc" + i, i);
97 annotation.setCalcId("calcId" + i);
98 seq.addAlignmentAnnotation(annotation);
99 annotation.setSequenceRef(seq);
103 @Test(groups = { "Functional" })
104 public void testConfigureReferenceAnnotationsMenu_noSequenceSelected()
106 JMenuItem menu = new JMenuItem();
107 List<SequenceI> seqs = new ArrayList<>();
108 testee.configureReferenceAnnotationsMenu(menu, seqs);
109 assertFalse(menu.isEnabled());
111 menu.setEnabled(true);
112 testee.configureReferenceAnnotationsMenu(menu, null);
113 assertFalse(menu.isEnabled());
117 * Test building the 'add reference annotations' menu for the case where there
118 * are no reference annotations to add to the alignment. The menu item should
121 @Test(groups = { "Functional" })
122 public void testConfigureReferenceAnnotationsMenu_noReferenceAnnotations()
124 JMenuItem menu = new JMenuItem();
127 * Initial state is that sequences have annotations, and have dataset
128 * sequences, but the dataset sequences have no annotations. Hence nothing
131 List<SequenceI> seqs = parentPanel.getAlignment().getSequences();
133 testee.configureReferenceAnnotationsMenu(menu, seqs);
134 assertFalse(menu.isEnabled());
138 * Test building the 'add reference annotations' menu for the case where all
139 * reference annotations are already on the alignment. The menu item should be
142 @Test(groups = { "Functional" })
143 public void testConfigureReferenceAnnotationsMenu_alreadyAdded()
145 JMenuItem menu = new JMenuItem();
146 List<SequenceI> seqs = parentPanel.getAlignment().getSequences();
148 // make up new annotations and add to dataset sequences, sequences and
150 attachReferenceAnnotations(seqs, true, true);
152 testee.configureReferenceAnnotationsMenu(menu, seqs);
153 assertFalse(menu.isEnabled());
157 * Test building the 'add reference annotations' menu for the case where
158 * several reference annotations are on the dataset but not on the sequences.
159 * The menu item should be enabled, and acquire a tooltip which lists the
160 * annotation sources (calcIds) and type (labels).
162 @Test(groups = { "Functional" })
163 public void testConfigureReferenceAnnotationsMenu()
165 JMenuItem menu = new JMenuItem();
166 List<SequenceI> seqs = parentPanel.getAlignment().getSequences();
168 // make up new annotations and add to dataset sequences
169 attachReferenceAnnotations(seqs, false, false);
171 testee.configureReferenceAnnotationsMenu(menu, seqs);
172 assertTrue(menu.isEnabled());
173 String s = MessageManager.getString("label.add_annotations_for");
174 String expected = "<html><style> p.ttip {width: 350; text-align: justify; word-wrap: break-word;}</style><p class=\"ttip\">"
175 + s + "<br/>Jmol/secondary structure<br/>PDB/Temp</p></html>";
176 assertEquals(expected, menu.getToolTipText());
180 * Test building the 'add reference annotations' menu for the case where
181 * several reference annotations are on the dataset and the sequences but not
182 * on the alignment. The menu item should be enabled, and acquire a tooltip
183 * which lists the annotation sources (calcIds) and type (labels).
185 @Test(groups = { "Functional" })
186 public void testConfigureReferenceAnnotationsMenu_notOnAlignment()
188 JMenuItem menu = new JMenuItem();
189 List<SequenceI> seqs = parentPanel.getAlignment().getSequences();
191 // make up new annotations and add to dataset sequences and sequences
192 attachReferenceAnnotations(seqs, true, false);
194 testee.configureReferenceAnnotationsMenu(menu, seqs);
195 assertTrue(menu.isEnabled());
196 String s = MessageManager.getString("label.add_annotations_for");
197 String expected = "<html><style> p.ttip {width: 350; text-align: justify; word-wrap: break-word;}</style><p class=\"ttip\">"
198 + s + "<br/>Jmol/secondary structure<br/>PDB/Temp</p></html>";
199 assertEquals(expected, menu.getToolTipText());
203 * Generate annotations and add to dataset sequences and (optionally)
204 * sequences and/or alignment
207 * @param addToSequence
208 * @param addToAlignment
210 private void attachReferenceAnnotations(List<SequenceI> seqs,
211 boolean addToSequence, boolean addToAlignment)
213 // PDB.secondary structure on Sequence0
214 AlignmentAnnotation annotation = new AlignmentAnnotation(
215 "secondary structure", "", 0);
216 annotation.setCalcId("PDB");
217 seqs.get(0).getDatasetSequence().addAlignmentAnnotation(annotation);
220 seqs.get(0).addAlignmentAnnotation(annotation);
224 this.alignment.addAnnotation(annotation);
227 // PDB.Temp on Sequence1
228 annotation = new AlignmentAnnotation("Temp", "", 0);
229 annotation.setCalcId("PDB");
230 seqs.get(1).getDatasetSequence().addAlignmentAnnotation(annotation);
233 seqs.get(1).addAlignmentAnnotation(annotation);
237 this.alignment.addAnnotation(annotation);
240 // JMOL.secondary structure on Sequence0
241 annotation = new AlignmentAnnotation("secondary structure", "", 0);
242 annotation.setCalcId("Jmol");
243 seqs.get(0).getDatasetSequence().addAlignmentAnnotation(annotation);
246 seqs.get(0).addAlignmentAnnotation(annotation);
250 this.alignment.addAnnotation(annotation);
255 * Test building the 'add reference annotations' menu for the case where there
256 * are two alignment views:
258 * <li>in one view, reference annotations have been added (are on the
259 * datasets, sequences and alignment)</li>
260 * <li>in the current view, reference annotations are on the dataset and
261 * sequence, but not the alignment</li>
263 * The menu item should be enabled, and acquire a tooltip which lists the
264 * annotation sources (calcIds) and type (labels).
266 @Test(groups = { "Functional" })
267 public void testConfigureReferenceAnnotationsMenu_twoViews()
272 * Test for building menu options including 'show' and 'hide' annotation
275 @Test(groups = { "Functional" })
276 public void testBuildAnnotationTypesMenus()
278 JMenu showMenu = new JMenu();
279 JMenu hideMenu = new JMenu();
280 List<SequenceI> seqs = parentPanel.getAlignment().getSequences();
282 // make up new annotations and add to sequences and to the alignment
284 // PDB.secondary structure on Sequence0
285 AlignmentAnnotation annotation = new AlignmentAnnotation(
286 "secondary structure", "", new Annotation[] {});
287 annotation.setCalcId("PDB");
288 annotation.visible = true;
289 seqs.get(0).addAlignmentAnnotation(annotation);
290 parentPanel.getAlignment().addAnnotation(annotation);
292 // JMOL.secondary structure on Sequence0 - hidden
293 annotation = new AlignmentAnnotation("secondary structure", "",
294 new Annotation[] {});
295 annotation.setCalcId("JMOL");
296 annotation.visible = false;
297 seqs.get(0).addAlignmentAnnotation(annotation);
298 parentPanel.getAlignment().addAnnotation(annotation);
300 // Jpred.SSP on Sequence0 - hidden
301 annotation = new AlignmentAnnotation("SSP", "", new Annotation[] {});
302 annotation.setCalcId("JPred");
303 annotation.visible = false;
304 seqs.get(0).addAlignmentAnnotation(annotation);
305 parentPanel.getAlignment().addAnnotation(annotation);
307 // PDB.Temp on Sequence1
308 annotation = new AlignmentAnnotation("Temp", "", new Annotation[] {});
309 annotation.setCalcId("PDB");
310 annotation.visible = true;
311 seqs.get(1).addAlignmentAnnotation(annotation);
312 parentPanel.getAlignment().addAnnotation(annotation);
315 * Expect menu options to show "secondary structure" and "SSP", and to hide
316 * "secondary structure" and "Temp". Tooltip should be calcId.
318 testee.buildAnnotationTypesMenus(showMenu, hideMenu, seqs);
320 assertTrue(showMenu.isEnabled());
321 assertTrue(hideMenu.isEnabled());
323 Component[] showOptions = showMenu.getMenuComponents();
324 Component[] hideOptions = hideMenu.getMenuComponents();
326 assertEquals(4, showOptions.length); // includes 'All' and separator
327 assertEquals(4, hideOptions.length);
328 String all = MessageManager.getString("label.all");
329 assertEquals(all, ((JMenuItem) showOptions[0]).getText());
330 assertTrue(showOptions[1] instanceof JPopupMenu.Separator);
331 assertEquals(JSeparator.HORIZONTAL,
332 ((JSeparator) showOptions[1]).getOrientation());
333 assertEquals("secondary structure",
334 ((JMenuItem) showOptions[2]).getText());
335 assertEquals("JMOL", ((JMenuItem) showOptions[2]).getToolTipText());
336 assertEquals("SSP", ((JMenuItem) showOptions[3]).getText());
337 assertEquals("JPred", ((JMenuItem) showOptions[3]).getToolTipText());
339 assertEquals(all, ((JMenuItem) hideOptions[0]).getText());
340 assertTrue(hideOptions[1] instanceof JPopupMenu.Separator);
341 assertEquals(JSeparator.HORIZONTAL,
342 ((JSeparator) hideOptions[1]).getOrientation());
343 assertEquals("secondary structure",
344 ((JMenuItem) hideOptions[2]).getText());
345 assertEquals("PDB", ((JMenuItem) hideOptions[2]).getToolTipText());
346 assertEquals("Temp", ((JMenuItem) hideOptions[3]).getText());
347 assertEquals("PDB", ((JMenuItem) hideOptions[3]).getToolTipText());
351 * Test for building menu options with only 'hide' annotation types enabled.
353 @Test(groups = { "Functional" })
354 public void testBuildAnnotationTypesMenus_showDisabled()
356 JMenu showMenu = new JMenu();
357 JMenu hideMenu = new JMenu();
358 List<SequenceI> seqs = parentPanel.getAlignment().getSequences();
360 // make up new annotations and add to sequences and to the alignment
362 // PDB.secondary structure on Sequence0
363 AlignmentAnnotation annotation = new AlignmentAnnotation(
364 "secondary structure", "", new Annotation[] {});
365 annotation.setCalcId("PDB");
366 annotation.visible = true;
367 seqs.get(0).addAlignmentAnnotation(annotation);
368 parentPanel.getAlignment().addAnnotation(annotation);
370 // PDB.Temp on Sequence1
371 annotation = new AlignmentAnnotation("Temp", "", new Annotation[] {});
372 annotation.setCalcId("PDB");
373 annotation.visible = true;
374 seqs.get(1).addAlignmentAnnotation(annotation);
375 parentPanel.getAlignment().addAnnotation(annotation);
378 * Expect menu options to hide "secondary structure" and "Temp". Tooltip
379 * should be calcId. 'Show' menu should be disabled.
381 testee.buildAnnotationTypesMenus(showMenu, hideMenu, seqs);
383 assertFalse(showMenu.isEnabled());
384 assertTrue(hideMenu.isEnabled());
386 Component[] showOptions = showMenu.getMenuComponents();
387 Component[] hideOptions = hideMenu.getMenuComponents();
389 assertEquals(2, showOptions.length); // includes 'All' and separator
390 assertEquals(4, hideOptions.length);
391 String all = MessageManager.getString("label.all");
392 assertEquals(all, ((JMenuItem) showOptions[0]).getText());
393 assertTrue(showOptions[1] instanceof JPopupMenu.Separator);
394 assertEquals(JSeparator.HORIZONTAL,
395 ((JSeparator) showOptions[1]).getOrientation());
397 assertEquals(all, ((JMenuItem) hideOptions[0]).getText());
398 assertTrue(hideOptions[1] instanceof JPopupMenu.Separator);
399 assertEquals(JSeparator.HORIZONTAL,
400 ((JSeparator) hideOptions[1]).getOrientation());
401 assertEquals("secondary structure",
402 ((JMenuItem) hideOptions[2]).getText());
403 assertEquals("PDB", ((JMenuItem) hideOptions[2]).getToolTipText());
404 assertEquals("Temp", ((JMenuItem) hideOptions[3]).getText());
405 assertEquals("PDB", ((JMenuItem) hideOptions[3]).getToolTipText());
409 * Test for building menu options with only 'show' annotation types enabled.
411 @Test(groups = { "Functional" })
412 public void testBuildAnnotationTypesMenus_hideDisabled()
414 JMenu showMenu = new JMenu();
415 JMenu hideMenu = new JMenu();
416 List<SequenceI> seqs = parentPanel.getAlignment().getSequences();
418 // make up new annotations and add to sequences and to the alignment
420 // PDB.secondary structure on Sequence0
421 AlignmentAnnotation annotation = new AlignmentAnnotation(
422 "secondary structure", "", new Annotation[] {});
423 annotation.setCalcId("PDB");
424 annotation.visible = false;
425 seqs.get(0).addAlignmentAnnotation(annotation);
426 parentPanel.getAlignment().addAnnotation(annotation);
428 // PDB.Temp on Sequence1
429 annotation = new AlignmentAnnotation("Temp", "", new Annotation[] {});
430 annotation.setCalcId("PDB2");
431 annotation.visible = false;
432 seqs.get(1).addAlignmentAnnotation(annotation);
433 parentPanel.getAlignment().addAnnotation(annotation);
436 * Expect menu options to show "secondary structure" and "Temp". Tooltip
437 * should be calcId. 'hide' menu should be disabled.
439 testee.buildAnnotationTypesMenus(showMenu, hideMenu, seqs);
441 assertTrue(showMenu.isEnabled());
442 assertFalse(hideMenu.isEnabled());
444 Component[] showOptions = showMenu.getMenuComponents();
445 Component[] hideOptions = hideMenu.getMenuComponents();
447 assertEquals(4, showOptions.length); // includes 'All' and separator
448 assertEquals(2, hideOptions.length);
449 String all = MessageManager.getString("label.all");
450 assertEquals(all, ((JMenuItem) showOptions[0]).getText());
451 assertTrue(showOptions[1] instanceof JPopupMenu.Separator);
452 assertEquals(JSeparator.HORIZONTAL,
453 ((JSeparator) showOptions[1]).getOrientation());
454 assertEquals("secondary structure",
455 ((JMenuItem) showOptions[2]).getText());
456 assertEquals("PDB", ((JMenuItem) showOptions[2]).getToolTipText());
457 assertEquals("Temp", ((JMenuItem) showOptions[3]).getText());
458 assertEquals("PDB2", ((JMenuItem) showOptions[3]).getToolTipText());
460 assertEquals(all, ((JMenuItem) hideOptions[0]).getText());
461 assertTrue(hideOptions[1] instanceof JPopupMenu.Separator);
462 assertEquals(JSeparator.HORIZONTAL,
463 ((JSeparator) hideOptions[1]).getOrientation());
467 * Test for adding feature links
469 @Test(groups = { "Functional" })
470 public void testAddFeatureLinks()
472 // sequences from the alignment
473 List<SequenceI> seqs = parentPanel.getAlignment().getSequences();
475 // create list of links and list of DBRefs
476 List<String> links = new ArrayList<>();
477 List<DBRefEntry> refs = new ArrayList<>();
479 // links as might be added into Preferences | Connections dialog
480 links.add("EMBL-EBI Search | http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$"
481 + SEQUENCE_ID + "$");
482 links.add("UNIPROT | http://www.uniprot.org/uniprot/$" + DB_ACCESSION
484 links.add("INTERPRO | http://www.ebi.ac.uk/interpro/entry/$"
485 + DB_ACCESSION + "$");
486 // Gene3D entry tests for case (in)sensitivity
487 links.add("Gene3D | http://gene3d.biochem.ucl.ac.uk/Gene3D/search?sterm=$"
488 + DB_ACCESSION + "$&mode=protein");
491 refs.add(new DBRefEntry(DBRefSource.UNIPROT, "1", "P83527"));
492 refs.add(new DBRefEntry("INTERPRO", "1", "IPR001041"));
493 refs.add(new DBRefEntry("INTERPRO", "1", "IPR006058"));
494 refs.add(new DBRefEntry("INTERPRO", "1", "IPR012675"));
497 refs.add(new DBRefEntry(DBRefSource.UNIPROT, "1", "Q9ZTS2"));
498 refs.add(new DBRefEntry("GENE3D", "1", "3.10.20.30"));
500 // add all the dbrefs to the sequences: Uniprot 1 each, Interpro all 3 to
501 // seq0, Gene3D to seq1
502 seqs.get(0).addDBRef(refs.get(0));
504 seqs.get(0).addDBRef(refs.get(1));
505 seqs.get(0).addDBRef(refs.get(2));
506 seqs.get(0).addDBRef(refs.get(3));
508 seqs.get(1).addDBRef(refs.get(4));
509 seqs.get(1).addDBRef(refs.get(5));
511 // get the Popup Menu for first sequence
512 testee = new PopupMenu(parentPanel, (Sequence) seqs.get(0), links);
513 Component[] seqItems = testee.sequenceMenu.getMenuComponents();
514 JMenu linkMenu = (JMenu) seqItems[6];
515 Component[] linkItems = linkMenu.getMenuComponents();
517 // check the number of links are the expected number
518 assertEquals(5, linkItems.length);
520 // first entry is EMBL-EBI which just uses sequence id not accession id?
521 assertEquals("EMBL-EBI Search", ((JMenuItem) linkItems[0]).getText());
523 // sequence id for each link should match corresponding DB accession id
524 for (int i = 1; i < 4; i++)
526 assertEquals(refs.get(i - 1).getSource(), ((JMenuItem) linkItems[i])
527 .getText().split("\\|")[0]);
528 assertEquals(refs.get(i - 1).getAccessionId(),
529 ((JMenuItem) linkItems[i])
530 .getText().split("\\|")[1]);
533 // get the Popup Menu for second sequence
534 testee = new PopupMenu(parentPanel, (Sequence) seqs.get(1), links);
535 seqItems = testee.sequenceMenu.getMenuComponents();
536 linkMenu = (JMenu) seqItems[6];
537 linkItems = linkMenu.getMenuComponents();
539 // check the number of links are the expected number
540 assertEquals(3, linkItems.length);
542 // first entry is EMBL-EBI which just uses sequence id not accession id?
543 assertEquals("EMBL-EBI Search", ((JMenuItem) linkItems[0]).getText());
545 // sequence id for each link should match corresponding DB accession id
546 for (int i = 1; i < 3; i++)
548 assertEquals(refs.get(i + 3).getSource(), ((JMenuItem) linkItems[i])
549 .getText().split("\\|")[0].toUpperCase());
550 assertEquals(refs.get(i + 3).getAccessionId(),
551 ((JMenuItem) linkItems[i]).getText().split("\\|")[1]);
554 // if there are no valid links the Links submenu is disabled
555 List<String> nomatchlinks = new ArrayList<>();
556 nomatchlinks.add("NOMATCH | http://www.uniprot.org/uniprot/$"
557 + DB_ACCESSION + "$");
559 testee = new PopupMenu(parentPanel, (Sequence) seqs.get(0),
561 seqItems = testee.sequenceMenu.getMenuComponents();
562 linkMenu = (JMenu) seqItems[6];
563 assertFalse(linkMenu.isEnabled());
568 * Test for adding feature links
570 @Test(groups = { "Functional" })
571 public void testHideInsertions()
573 // get sequences from the alignment
574 List<SequenceI> seqs = parentPanel.getAlignment().getSequences();
576 // add our own seqs to avoid problems with changes to existing sequences
577 // (gap at end of sequences varies depending on how tests are run!)
578 Sequence seqGap1 = new Sequence("GappySeq",
579 "AAAA----AA-AAAAAAA---AAA-----------AAAAAAAAAA--");
580 seqGap1.createDatasetSequence();
582 Sequence seqGap2 = new Sequence("LessGappySeq",
583 "AAAAAA-AAAAA---AAA--AAAAA--AAAAAAA-AAAAAA");
584 seqGap2.createDatasetSequence();
586 Sequence seqGap3 = new Sequence("AnotherGapSeq",
587 "AAAAAA-AAAAAA--AAAAAA-AAAAAAAAAAA---AAAAAAAA");
588 seqGap3.createDatasetSequence();
590 Sequence seqGap4 = new Sequence("NoGaps",
591 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
592 seqGap4.createDatasetSequence();
595 ColumnSelection sel = new ColumnSelection();
596 parentPanel.av.getAlignment().getHiddenColumns()
597 .revealAllHiddenColumns(sel);
599 // get the Popup Menu for 7th sequence - no insertions
600 testee = new PopupMenu(parentPanel, (Sequence) seqs.get(7), null);
601 testee.hideInsertions_actionPerformed(null);
603 HiddenColumns hidden = parentPanel.av.getAlignment().getHiddenColumns();
604 Iterator<int[]> it = hidden.iterator();
605 assertFalse(it.hasNext());
607 // get the Popup Menu for GappySeq - this time we have insertions
608 testee = new PopupMenu(parentPanel, (Sequence) seqs.get(4), null);
609 testee.hideInsertions_actionPerformed(null);
610 hidden = parentPanel.av.getAlignment().getHiddenColumns();
611 it = hidden.iterator();
613 assertTrue(it.hasNext());
614 int[] region = it.next();
615 assertEquals(region[0], 4);
616 assertEquals(region[1], 7);
618 assertTrue(it.hasNext());
620 assertEquals(region[0], 10);
621 assertEquals(region[1], 10);
623 assertTrue(it.hasNext());
625 assertEquals(region[0], 18);
626 assertEquals(region[1], 20);
628 assertTrue(it.hasNext());
630 assertEquals(region[0], 24);
631 assertEquals(region[1], 34);
633 assertTrue(it.hasNext());
635 assertEquals(region[0], 45);
636 assertEquals(region[1], 46);
638 assertFalse(it.hasNext());
640 sel = new ColumnSelection();
641 hidden.revealAllHiddenColumns(sel);
643 // make a sequence group and hide insertions within the group
644 SequenceGroup sg = new SequenceGroup();
647 sg.addSequence(seqGap2, false);
648 sg.addSequence(seqGap3, false);
649 parentPanel.av.setSelectionGroup(sg);
651 // hide columns outside and within selection
652 // only hidden columns outside the collection will be retained (unless also
653 // gaps in the selection)
654 hidden.hideColumns(1, 10);
655 hidden.hideColumns(31, 40);
657 // get the Popup Menu for LessGappySeq in the sequence group
658 testee = new PopupMenu(parentPanel, (Sequence) seqs.get(5), null);
659 testee.hideInsertions_actionPerformed(null);
660 hidden = parentPanel.av.getAlignment().getHiddenColumns();
661 it = hidden.iterator();
663 assertTrue(it.hasNext());
665 assertEquals(region[0], 1);
666 assertEquals(region[1], 7);
668 assertTrue(it.hasNext());
670 assertEquals(region[0], 13);
671 assertEquals(region[1], 14);
673 assertTrue(it.hasNext());
675 assertEquals(region[0], 34);
676 assertEquals(region[1], 34);