Merge branch 'develop' into patch/JAL-4281_idwidthandannotHeight_in_project
[jalview.git] / test / jalview / schemes / ColourSchemesTest.java
index 0aaa38c..052bb8b 100644 (file)
@@ -1,3 +1,23 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
 package jalview.schemes;
 
 import static org.testng.Assert.assertEquals;
@@ -5,6 +25,15 @@ import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertSame;
 import static org.testng.Assert.assertTrue;
 
+import java.awt.Color;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import jalview.api.AlignViewportI;
 import jalview.bin.Cache;
 import jalview.bin.Jalview;
 import jalview.datamodel.AnnotatedCollectionI;
@@ -17,14 +46,6 @@ import jalview.io.DataSourceType;
 import jalview.io.FileLoader;
 import jalview.schemes.ClustalxColourScheme.ClustalColour;
 
-import java.awt.Color;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
 public class ColourSchemesTest
 {
   /*
@@ -54,15 +75,15 @@ public class ColourSchemesTest
     }
 
     @Override
-    public ColourSchemeI getInstance(AnnotatedCollectionI sg,
-            Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+    public ColourSchemeI getInstance(AlignViewportI view,
+            AnnotatedCollectionI sg)
     {
-      final ColourSchemeI cs1 = ColourSchemes.getInstance()
-              .getColourScheme(JalviewColourScheme.Taylor.toString(),
-                      (AnnotatedCollectionI) null);
-      final ColourSchemeI cs2 = ColourSchemes.getInstance()
-              .getColourScheme(JalviewColourScheme.Zappo.toString(),
-                      (AnnotatedCollectionI) null);
+      final ColourSchemeI cs1 = ColourSchemes.getInstance().getColourScheme(
+              JalviewColourScheme.Taylor.toString(),
+              (AnnotatedCollectionI) null);
+      final ColourSchemeI cs2 = ColourSchemes.getInstance().getColourScheme(
+              JalviewColourScheme.Zappo.toString(),
+              (AnnotatedCollectionI) null);
       return new Stripy(cs1, cs2);
     }
 
@@ -85,7 +106,7 @@ public class ColourSchemesTest
       return "stripy";
     }
   };
-  
+
   /*
    * a colour scheme that is Clustal but using AWT colour equivalents
    */
@@ -144,10 +165,10 @@ public class ColourSchemesTest
     }
 
     @Override
-    public ColourSchemeI getInstance(AnnotatedCollectionI sg,
-            Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+    public ColourSchemeI getInstance(AlignViewportI view,
+            AnnotatedCollectionI sg)
     {
-      return new MyClustal(sg,              hiddenRepSequences);
+      return new MyClustal(sg, view.getHiddenRepSequences());
     }
 
     @Override
@@ -165,13 +186,14 @@ public class ColourSchemesTest
      * use read-only test properties file
      */
     Cache.loadProperties("test/jalview/io/testProps.jvprops");
-    Jalview.main(new String[] { "-nonews" });
+    Jalview.main(new String[] { "--nonews" });
   }
 
   @AfterClass(alwaysRun = true)
   public static void tearDownAfterClass() throws Exception
   {
-    Desktop.instance.closeAll_actionPerformed(null);
+    if (Desktop.instance != null)
+      Desktop.instance.closeAll_actionPerformed(null);
   }
 
   @Test(groups = "Functional")
@@ -182,7 +204,8 @@ public class ColourSchemesTest
      * in the order in which they are declared in the JalviewColourScheme enum
      * (this also determines their order in Colour menus)
      */
-    Iterator<ColourSchemeI> schemes = ColourSchemes.getInstance().getColourSchemes().iterator();
+    Iterator<ColourSchemeI> schemes = ColourSchemes.getInstance()
+            .getColourSchemes().iterator();
     JalviewColourScheme[] jalviewSchemes = JalviewColourScheme.values();
     int i = 0;
     while (schemes.hasNext() && i < jalviewSchemes.length)
@@ -209,7 +232,7 @@ public class ColourSchemesTest
     }
     af.closeMenuItem_actionPerformed(true);
   }
-  
+
   @Test(groups = "Functional")
   public void testRegisterColourScheme()
   {