Merge branch 'merge/JAL-3285_mchmmer_with_211_develop' into alpha/JAL-3362_Jalview_21...
[jalview.git] / test / jalview / gui / AlignFrameTest.java
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.gui;
22
23 import static org.junit.Assert.assertNotEquals;
24 import static org.testng.Assert.assertEquals;
25 import static org.testng.Assert.assertFalse;
26 import static org.testng.Assert.assertNotSame;
27 import static org.testng.Assert.assertSame;
28 import static org.testng.Assert.assertTrue;
29
30 import jalview.api.AlignViewportI;
31 import jalview.api.FeatureColourI;
32 import jalview.bin.Cache;
33 import jalview.bin.Jalview;
34 import jalview.datamodel.Alignment;
35 import jalview.datamodel.AlignmentI;
36 import jalview.datamodel.HiddenColumns;
37 import jalview.datamodel.Sequence;
38 import jalview.datamodel.SequenceFeature;
39 import jalview.datamodel.SequenceGroup;
40 import jalview.datamodel.SequenceI;
41 import jalview.io.DataSourceType;
42 import jalview.io.FileLoader;
43 import jalview.project.Jalview2xmlTests;
44 import jalview.renderer.ResidueShaderI;
45 import jalview.schemes.BuriedColourScheme;
46 import jalview.schemes.FeatureColour;
47 import jalview.schemes.HelixColourScheme;
48 import jalview.schemes.JalviewColourScheme;
49 import jalview.schemes.StrandColourScheme;
50 import jalview.schemes.TurnColourScheme;
51 import jalview.util.MessageManager;
52 import jalview.viewmodel.AlignmentViewport;
53
54 import java.awt.Color;
55 import java.util.Iterator;
56
57 import org.testng.annotations.AfterMethod;
58 import org.testng.annotations.BeforeClass;
59 import org.testng.annotations.BeforeMethod;
60 import org.testng.annotations.Test;
61
62 public class AlignFrameTest
63 {
64   AlignFrame af;
65
66   @BeforeClass(alwaysRun = true)
67   public static void setUpBeforeClass() throws Exception
68   {
69     setUpJvOptionPane();
70     /*
71      * use read-only test properties file
72      */
73     Cache.loadProperties("test/jalview/io/testProps.jvprops");
74     Jalview.main(new String[] { "-nonews" });
75   }
76
77   @AfterMethod(alwaysRun = true)
78   public void tearDown()
79   {
80     Desktop.instance.closeAll_actionPerformed(null);
81   }
82
83   /**
84    * configure (read-only) properties for test to ensure Consensus is computed for
85    * colour Above PID testing
86    */
87   @BeforeMethod(alwaysRun = true)
88   public void setUp()
89   {
90     Cache.loadProperties("test/jalview/io/testProps.jvprops");
91     Cache.applicationProperties.setProperty("SHOW_IDENTITY",
92             Boolean.TRUE.toString());
93     af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa",
94             DataSourceType.FILE);
95
96     /*
97      * wait for Consensus thread to complete
98      */
99     synchronized (this)
100     {
101       while (af.getViewport().getConsensusSeq() == null)
102       {
103         try
104         {
105           wait(50);
106         } catch (InterruptedException e)
107         {
108         }
109       }
110     }
111   }
112
113   public static void setUpJvOptionPane()
114   {
115     JvOptionPane.setInteractiveMode(false);
116     JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
117   }
118
119   @Test(groups = "Functional")
120   public void testHideFeatureColumns()
121   {
122     SequenceI seq1 = new Sequence("Seq1", "ABCDEFGHIJ");
123     SequenceI seq2 = new Sequence("Seq2", "ABCDEFGHIJ");
124     seq1.addSequenceFeature(new SequenceFeature("Metal", "", 1, 5, 0f, null));
125     seq2.addSequenceFeature(new SequenceFeature("Metal", "", 6, 10, 10f,
126             null));
127     seq1.addSequenceFeature(new SequenceFeature("Turn", "", 2, 4,
128             Float.NaN, null));
129     seq2.addSequenceFeature(new SequenceFeature("Turn", "", 7, 9,
130             Float.NaN, null));
131     AlignmentI al = new Alignment(new SequenceI[] { seq1, seq2 });
132     AlignFrame alignFrame = new AlignFrame(al, al.getWidth(),
133             al.getHeight());
134
135     /*
136      * make all features visible (select feature columns checks visibility)
137      */
138     alignFrame.getFeatureRenderer().findAllFeatures(true);
139
140     /*
141      * hiding a feature not present does nothing
142      */
143     assertFalse(alignFrame.hideFeatureColumns("exon", true));
144     assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty());
145
146     assertEquals(alignFrame.getViewport().getAlignment().getHiddenColumns()
147             .getNumberOfRegions(), 0);
148
149     assertFalse(alignFrame.hideFeatureColumns("exon", false));
150     assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty());
151
152     assertEquals(alignFrame.getViewport().getAlignment().getHiddenColumns()
153             .getNumberOfRegions(), 0);
154
155     /*
156      * hiding a feature in all columns does nothing
157      */
158     assertFalse(alignFrame.hideFeatureColumns("Metal", true));
159     assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty());
160
161     assertEquals(alignFrame.getViewport().getAlignment().getHiddenColumns()
162             .getNumberOfRegions(), 0);
163
164
165     /*
166      * threshold Metal to hide features where score < 5
167      * seq1 feature in columns 1-5 is hidden
168      * seq2 feature in columns 6-10 is shown
169      */
170     FeatureColourI fc = new FeatureColour(null, Color.red, Color.blue, null,
171             0f, 10f);
172     fc.setAboveThreshold(true);
173     fc.setThreshold(5f);
174     alignFrame.getFeatureRenderer().setColour("Metal", fc);
175     assertTrue(alignFrame.hideFeatureColumns("Metal", true));
176     HiddenColumns hidden = alignFrame.getViewport().getAlignment().getHiddenColumns();
177     assertEquals(hidden.getNumberOfRegions(), 1);
178     Iterator<int[]> regions = hidden.iterator();
179     int[] next = regions.next();
180     assertEquals(next[0], 5);
181     assertEquals(next[1], 9);
182
183     /*
184      * hide a feature present in some columns
185      * sequence positions [2-4], [7-9] are column positions
186      * [1-3], [6-8] base zero
187      */
188     alignFrame.getViewport().showAllHiddenColumns();
189     assertTrue(alignFrame.hideFeatureColumns("Turn", true));
190     regions = alignFrame.getViewport().getAlignment()
191             .getHiddenColumns().iterator();
192     assertEquals(alignFrame.getViewport().getAlignment().getHiddenColumns()
193             .getNumberOfRegions(), 2);
194     next = regions.next();
195     assertEquals(next[0], 1);
196     assertEquals(next[1], 3);
197     next = regions.next();
198     assertEquals(next[0], 6);
199     assertEquals(next[1], 8);
200   }
201
202   /**
203    * Test that changing background (alignment) colour scheme
204    * <ul>
205    * <li>with Apply Colour to All Groups not selected, does not change group
206    * colours</li>
207    * <li>with Apply Colour to All Groups selected, does change group colours</li>
208    * <li>in neither case, changes alignment or group colour thresholds (PID or
209    * Conservation)</li>
210    * </ul>
211    */
212   @Test(groups = "Functional")
213   public void testChangeColour_background_groupsAndThresholds()
214   {
215     AlignViewportI av = af.getViewport();
216     AlignmentI al = av.getAlignment();
217
218     /*
219      * Colour alignment by Buried Index
220      */
221     af.applyToAllGroups_actionPerformed(false);
222     af.changeColour_actionPerformed(JalviewColourScheme.Buried.toString());
223     assertTrue(av.getGlobalColourScheme() instanceof BuriedColourScheme);
224     assertFalse(av.getResidueShading().conservationApplied());
225     assertEquals(av.getResidueShading().getThreshold(), 0);
226
227     /*
228      * Apply Conservation 20%
229      */
230     af.conservationMenuItem_actionPerformed(true);
231     SliderPanel sp = SliderPanel.getSliderPanel();
232     assertEquals(sp.getTitle(), MessageManager.formatMessage(
233             "label.conservation_colour_increment",
234             new String[] { "Background" }));
235     assertTrue(sp.isForConservation());
236     sp.valueChanged(20);
237     assertTrue(av.getResidueShading().conservationApplied());
238     assertEquals(av.getResidueShading().getConservationInc(), 20);
239
240     /*
241      * Apply PID threshold 10% (conservation still applies as well)
242      */
243     af.abovePIDThreshold_actionPerformed(true);
244     sp = SliderPanel.getSliderPanel();
245     assertFalse(sp.isForConservation());
246     assertEquals(sp.getTitle(), MessageManager.formatMessage(
247             "label.percentage_identity_threshold",
248             new String[] { "Background" }));
249     sp.valueChanged(10);
250     assertEquals(av.getResidueShading().getThreshold(), 10);
251     assertTrue(av.getResidueShading().conservationApplied());
252     assertEquals(av.getResidueShading().getConservationInc(), 20);
253
254     /*
255      * create a group with Strand colouring, 30% Conservation
256      * and 40% PID threshold
257      */
258     SequenceGroup sg = new SequenceGroup();
259     sg.addSequence(al.getSequenceAt(0), false);
260     sg.setStartRes(15);
261     sg.setEndRes(25);
262     av.setSelectionGroup(sg);
263
264     /*
265      * apply 30% Conservation to group
266      */
267     PopupMenu popupMenu = new PopupMenu(af.alignPanel, null, null);
268     popupMenu.changeColour_actionPerformed(JalviewColourScheme.Strand
269             .toString());
270     assertTrue(sg.getColourScheme() instanceof StrandColourScheme);
271     assertEquals(al.getGroups().size(), 1);
272     assertSame(al.getGroups().get(0), sg);
273     popupMenu.conservationMenuItem_actionPerformed(true);
274     sp = SliderPanel.getSliderPanel();
275     assertTrue(sp.isForConservation());
276     assertEquals(sp.getTitle(), MessageManager.formatMessage(
277             "label.conservation_colour_increment",
278             new String[] { sg.getName() }));
279     sp.valueChanged(30);
280     assertTrue(sg.getGroupColourScheme().conservationApplied());
281     assertEquals(sg.getGroupColourScheme().getConservationInc(), 30);
282
283     /*
284      * apply 40% PID threshold to group
285      */
286     popupMenu.abovePIDColour_actionPerformed(true);
287     sp = SliderPanel.getSliderPanel();
288     assertFalse(sp.isForConservation());
289     assertEquals(sp.getTitle(), MessageManager.formatMessage(
290             "label.percentage_identity_threshold",
291             new String[] { sg.getName() }));
292     sp.valueChanged(40);
293     assertEquals(sg.getGroupColourScheme().getThreshold(), 40);
294     // conservation threshold is unchanged:
295     assertTrue(sg.getGroupColourScheme().conservationApplied());
296     assertEquals(sg.getGroupColourScheme().getConservationInc(), 30);
297
298     /*
299      * change alignment colour - group colour, and all thresholds,
300      * should be unaffected
301      */
302     af.changeColour_actionPerformed(JalviewColourScheme.Turn.toString());
303     assertTrue(av.getGlobalColourScheme() instanceof TurnColourScheme);
304     assertTrue(av.getResidueShading().conservationApplied());
305     assertEquals(av.getResidueShading().getConservationInc(), 20);
306     assertEquals(av.getResidueShading().getThreshold(), 10);
307     assertTrue(sg.getColourScheme() instanceof StrandColourScheme);
308     assertTrue(sg.getGroupColourScheme().conservationApplied());
309     assertEquals(sg.getGroupColourScheme().getConservationInc(), 30);
310     assertEquals(sg.getGroupColourScheme().getThreshold(), 40);
311
312     /*
313      * Now change alignment colour with Apply Colour To All Groups
314      * - group colour should change, but not colour thresholds
315      */
316     af.applyToAllGroups_actionPerformed(true);
317     af.changeColour_actionPerformed(JalviewColourScheme.Helix.toString());
318     assertTrue(av.getGlobalColourScheme() instanceof HelixColourScheme);
319     assertTrue(av.getResidueShading().conservationApplied());
320     assertEquals(av.getResidueShading().getConservationInc(), 20);
321     assertEquals(av.getResidueShading().getThreshold(), 10);
322     assertTrue(sg.getColourScheme() instanceof HelixColourScheme);
323     assertTrue(sg.getGroupColourScheme().conservationApplied());
324     assertEquals(sg.getGroupColourScheme().getConservationInc(), 30);
325     assertEquals(sg.getGroupColourScheme().getThreshold(), 40);
326   }
327
328   /**
329    * Test residue colouring with various options
330    * <ol>
331    * <li>no PID or Conservation threshold</li>
332    * <li>colour by Conservation applied</li>
333    * <li>colour by Conservation removed</li>
334    * <li>colour above PID - various values</li>
335    * <li>colour above PID removed</li>
336    * <li>Above PID plus By Conservation combined</li>
337    * <li>remove Above PID to leave just By Conservation</li>
338    * <li>re-add Above PID</li>
339    * <li>remove By Conservation to leave just Above PID</li>
340    * <li>remove Above PID to leave original colours</li>
341    * </ol>
342    */
343   @Test(groups = "Functional")
344   public void testColourThresholdActions()
345   {
346     AlignViewportI av = af.getViewport();
347     AlignmentI al = av.getAlignment();
348
349     /*
350      * Colour alignment by Helix Propensity, no thresholds
351      */
352     af.applyToAllGroups_actionPerformed(false);
353     af.changeColour_actionPerformed(JalviewColourScheme.Helix.toString());
354     assertTrue(av.getGlobalColourScheme() instanceof HelixColourScheme);
355     assertFalse(av.getResidueShading().conservationApplied());
356     assertEquals(av.getResidueShading().getThreshold(), 0);
357
358     /*
359      * inspect the colour of 
360      * FER_CAPAN.9(I), column 14 (14 base 0)
361      * FER_CAPAN.10(SER), column 16 (15 base 0)
362      */
363     SequenceI ferCapan = al.findName("FER_CAPAN");
364     ResidueShaderI rs = av.getResidueShading();
365     Color c = rs.findColour('I', 14, ferCapan);
366     Color i_original = new Color(138, 117, 138);
367     assertEquals(c, i_original);
368     c = rs.findColour('S', 15, ferCapan);
369     Color s_original = new Color(54, 201, 54);
370     assertEquals(c, s_original);
371
372     /*
373      * colour by conservation with increment 10
374      */
375     af.conservationMenuItem_actionPerformed(true);
376     SliderPanel sp = SliderPanel.getSliderPanel();
377     assertTrue(sp.isForConservation());
378     assertEquals(sp.getValue(), 30); // initial slider setting
379     sp.valueChanged(10);
380     assertSame(rs, av.getResidueShading());
381     c = rs.findColour('I', 14, ferCapan);
382     Color i_faded = new Color(196, 186, 196);
383     assertEquals(c, i_faded);
384     c = rs.findColour('S', 15, ferCapan);
385     Color s_faded = new Color(144, 225, 144);
386     assertEquals(c, s_faded);
387
388     /*
389      * deselect By Conservation - colour should revert
390      */
391     af.conservationMenuItem_actionPerformed(false);
392     c = rs.findColour('S', 15, ferCapan);
393     assertEquals(c, s_original);
394
395     /*
396      * now Above PID, threshold = 0%
397      * should be no change
398      */
399     af.abovePIDThreshold_actionPerformed(true);
400     sp = SliderPanel.getSliderPanel();
401     assertFalse(sp.isForConservation());
402     assertEquals(sp.getValue(), 0); // initial slider setting
403     c = rs.findColour('I', 14, ferCapan);
404     assertEquals(c, i_original);
405     c = rs.findColour('S', 15, ferCapan);
406     assertEquals(c, s_original);
407
408     /*
409      * Above PID, threshold = 1%
410      * 15.I becomes White because no match to consensus (V)
411      * 16.S remains coloured as matches 66.66% consensus
412      */
413     sp.valueChanged(1);
414     c = rs.findColour('I', 14, ferCapan);
415     assertEquals(c, Color.white);
416     c = rs.findColour('S', 15, ferCapan);
417     assertEquals(c, s_original);
418
419     /*
420      * threshold 66% - no further change yet...
421      */
422     sp.valueChanged(66);
423     c = rs.findColour('I', 14, ferCapan);
424     assertEquals(c, Color.white);
425     c = rs.findColour('S', 15, ferCapan);
426     assertEquals(c, s_original);
427
428     /*
429      * threshold 67% - now both residues are white
430      */
431     sp.valueChanged(67);
432     c = rs.findColour('I', 14, ferCapan);
433     assertEquals(c, Color.white);
434     c = rs.findColour('S', 15, ferCapan);
435     assertEquals(c, Color.white);
436
437     /*
438      * deselect Above PID - colours should revert
439      */
440     af.abovePIDThreshold_actionPerformed(false);
441     c = rs.findColour('I', 14, ferCapan);
442     assertEquals(c, i_original);
443     c = rs.findColour('S', 15, ferCapan);
444     assertEquals(c, s_original);
445
446     /*
447      * Now combine Above 50% PID and By Conservation 10%
448      * 15.I is White because no match to consensus (V)
449      * 16.S is coloured but faded
450      */
451     af.abovePIDThreshold_actionPerformed(true);
452     sp = SliderPanel.getSliderPanel();
453     assertFalse(sp.isForConservation());
454     sp.valueChanged(50);
455     af.conservationMenuItem_actionPerformed(true);
456     sp = SliderPanel.getSliderPanel();
457     assertTrue(sp.isForConservation());
458     sp.valueChanged(10);
459     c = rs.findColour('I', 14, ferCapan);
460     assertEquals(c, Color.white);
461     c = rs.findColour('S', 15, ferCapan);
462     assertEquals(c, s_faded);
463
464     /*
465      * turn off Above PID - should just leave Conservation fading as before 
466      */
467     af.abovePIDThreshold_actionPerformed(false);
468     c = rs.findColour('I', 14, ferCapan);
469     assertEquals(c, i_faded);
470     c = rs.findColour('S', 15, ferCapan);
471     assertEquals(c, s_faded);
472
473     /*
474      * Now add Above 50% PID to conservation colouring
475      * - should give the same as PID followed by conservation (above)
476      */
477     af.abovePIDThreshold_actionPerformed(true);
478     SliderPanel.getSliderPanel().valueChanged(50);
479     c = rs.findColour('I', 14, ferCapan);
480     assertEquals(c, Color.white);
481     c = rs.findColour('S', 15, ferCapan);
482     assertEquals(c, s_faded);
483
484     /*
485      * turn off By Conservation
486      * should leave I white, S original (unfaded) colour
487      */
488     af.conservationMenuItem_actionPerformed(false);
489     c = rs.findColour('I', 14, ferCapan);
490     assertEquals(c, Color.white);
491     c = rs.findColour('S', 15, ferCapan);
492     assertEquals(c, s_original);
493
494     /*
495      * finally turn off Above PID to leave original colours
496      */
497     af.abovePIDThreshold_actionPerformed(false);
498     c = rs.findColour('I', 14, ferCapan);
499     assertEquals(c, i_original);
500     c = rs.findColour('S', 15, ferCapan);
501     assertEquals(c, s_original);
502   }
503
504   /**
505    * Verify that making a New View transfers alignment and group colour schemes,
506    * including any thresholds, to the new view. Because New View is performed by
507    * saving and reloading a 'project' file, this is similar to verifying a
508    * project save and reload.
509    * 
510    * @see Jalview2xmlTests#testStoreAndRecoverColourThresholds()
511    */
512   @Test(groups = "Functional")
513   public void testNewView_colourThresholds()
514   {
515     AlignViewportI av = af.getViewport();
516     AlignmentI al = av.getAlignment();
517
518     /*
519      * Colour alignment by Buried Index, Above 10% PID, By Conservation 20%
520      */
521     af.changeColour_actionPerformed(JalviewColourScheme.Buried.toString());
522     assertTrue(av.getGlobalColourScheme() instanceof BuriedColourScheme);
523     af.abovePIDThreshold_actionPerformed(true);
524     SliderPanel sp = SliderPanel.getSliderPanel();
525     assertFalse(sp.isForConservation());
526     sp.valueChanged(10);
527     af.conservationMenuItem_actionPerformed(true);
528     sp = SliderPanel.getSliderPanel();
529     assertTrue(sp.isForConservation());
530     sp.valueChanged(20);
531     ResidueShaderI rs = av.getResidueShading();
532     assertEquals(rs.getThreshold(), 10);
533     assertTrue(rs.conservationApplied());
534     assertEquals(rs.getConservationInc(), 20);
535
536     /*
537      * create a group with Strand colouring, 30% Conservation
538      * and 40% PID threshold
539      */
540     SequenceGroup sg = new SequenceGroup();
541     sg.addSequence(al.getSequenceAt(0), false);
542     sg.setStartRes(15);
543     sg.setEndRes(25);
544     av.setSelectionGroup(sg);
545     PopupMenu popupMenu = new PopupMenu(af.alignPanel, null, null);
546     popupMenu.changeColour_actionPerformed(JalviewColourScheme.Strand
547             .toString());
548     assertTrue(sg.getColourScheme() instanceof StrandColourScheme);
549     assertEquals(al.getGroups().size(), 1);
550     assertSame(al.getGroups().get(0), sg);
551     popupMenu.conservationMenuItem_actionPerformed(true);
552     sp = SliderPanel.getSliderPanel();
553     assertTrue(sp.isForConservation());
554     sp.valueChanged(30);
555     popupMenu.abovePIDColour_actionPerformed(true);
556     sp = SliderPanel.getSliderPanel();
557     assertFalse(sp.isForConservation());
558     sp.valueChanged(40);
559     rs = sg.getGroupColourScheme();
560     assertTrue(rs.conservationApplied());
561     assertEquals(rs.getConservationInc(), 30);
562     assertEquals(rs.getThreshold(), 40);
563
564     /*
565      * set slider panel focus to the background alignment
566      */
567     af.conservationMenuItem_actionPerformed(true);
568     sp = SliderPanel.getSliderPanel();
569     assertTrue(sp.isForConservation());
570     assertEquals(sp.getTitle(), MessageManager.formatMessage(
571             "label.conservation_colour_increment",
572             new String[] { "Background" }));
573
574     /*
575      * make a new View, verify alignment and group colour schemes
576      */
577     af.newView_actionPerformed(null);
578     assertEquals(af.alignPanel.getViewName(), "View 1");
579     AlignmentViewport av2 = af.getViewport();
580     assertNotSame(av, av2);
581     assertSame(av2, af.alignPanel.av);
582     rs = av2.getResidueShading();
583     assertNotSame(av.getResidueShading(), rs);
584     assertEquals(rs.getThreshold(), 10);
585     assertTrue(rs.conservationApplied(), rs.toString());
586     assertEquals(rs.getConservationInc(), 20);
587     assertEquals(av2.getAlignment().getGroups().size(), 1);
588     sg = av2.getAlignment().getGroups().get(0);
589     rs = sg.getGroupColourScheme();
590     assertTrue(rs.conservationApplied());
591     assertEquals(rs.getConservationInc(), 30);
592     assertEquals(rs.getThreshold(), 40);
593
594     /*
595      * check the Conservation SliderPanel (still open) is linked to 
596      * and updates the new view (JAL-2385)
597      */
598     sp = SliderPanel.getSliderPanel();
599     assertTrue(sp.isForConservation());
600     assertEquals(sp.getTitle(), MessageManager.formatMessage(
601             "label.conservation_colour_increment",
602             new String[] { "View 1" }));
603     sp.valueChanged(22);
604     assertEquals(av2.getResidueShading().getConservationInc(), 22);
605   }
606
607   /**
608    * Verify that making a New View preserves the dataset reference for the
609    * alignment. Otherwise, see a 'duplicate jar entry' reference when trying to
610    * save alignments with multiple views, and codon mappings will not be shared
611    * across all panels in a split frame.
612    * 
613    * @see Jalview2xmlTests#testStoreAndRecoverColourThresholds()
614    */
615   @Test(groups = "Functional")
616   public void testNewView_dsRefPreserved()
617   {
618     AlignViewport av = af.getViewport();
619     AlignmentI al = av.getAlignment();
620     AlignmentI original_ds = al.getDataset();
621     af.newView_actionPerformed(null);
622     assertNotEquals("New view didn't select the a new panel", av,
623             af.getViewport());
624     org.testng.Assert.assertEquals(original_ds,
625             af.getViewport().getAlignment().getDataset(),
626             "Dataset was not preserved in new view");
627   }
628 }