JAL-3746 apply copyright to tests
[jalview.git] / test / jalview / gui / FeatureSettingsTest.java
index db37733..f0b3aef 100644 (file)
@@ -1,9 +1,36 @@
+/*
+ * 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.gui;
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
 
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+
+import org.testng.annotations.Test;
+
 import jalview.api.FeatureColourI;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
@@ -15,13 +42,7 @@ import jalview.io.FileLoader;
 import jalview.schemes.FeatureColour;
 import jalview.schemes.FeatureColourTest;
 import jalview.util.matcher.Condition;
-
-import java.awt.Color;
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-
-import org.testng.annotations.Test;
+import jalview.viewmodel.seqfeatures.FeatureRendererModel;
 
 public class FeatureSettingsTest
 {
@@ -50,7 +71,7 @@ public class FeatureSettingsTest
     /*
      * set colour schemes for features
      */
-    FeatureRenderer fr = af.getFeatureRenderer();
+    FeatureRendererModel fr = af.getFeatureRenderer();
 
     // type1: red
     fr.setColour("type1", new FeatureColour(Color.red));
@@ -61,8 +82,8 @@ public class FeatureSettingsTest
     fr.setColour("type2", byLabel);
 
     // type3: by score above threshold
-    FeatureColourI byScore = new FeatureColour(Color.BLACK, Color.BLUE, 1,
-            10);
+    FeatureColourI byScore = new FeatureColour(null, Color.BLACK,
+            Color.BLUE, null, 1, 10);
     byScore.setAboveThreshold(true);
     byScore.setThreshold(2f);
     fr.setColour("type3", byScore);
@@ -74,8 +95,8 @@ public class FeatureSettingsTest
     fr.setColour("type4", byAF);
 
     // type5: by attribute CSQ:PolyPhen below threshold
-    FeatureColourI byPolyPhen = new FeatureColour(Color.BLACK, Color.BLUE,
-            1, 10);
+    FeatureColourI byPolyPhen = new FeatureColour(null, Color.BLACK,
+            Color.BLUE, null, 1, 10);
     byPolyPhen.setBelowThreshold(true);
     byPolyPhen.setThreshold(3f);
     byPolyPhen.setAttributeName("CSQ", "PolyPhen");
@@ -155,11 +176,12 @@ public class FeatureSettingsTest
     assertTrue(fc.isBelowThreshold());
     assertEquals(fc.getThreshold(), 3f);
 
-    assertEquals(fr.getFeatureFilter("type1").toStableString(), "Label Contains x");
+    assertEquals(fr.getFeatureFilter("type1").toStableString(),
+            "Label Contains x");
     assertEquals(fr.getFeatureFilter("type2").toStableString(),
             "(Score LE 2.4) AND (Score GT 1.1)");
     assertEquals(fr.getFeatureFilter("type3").toStableString(),
-            "(AF Contains X) OR (CSQ:PolyPhen NE 0.0)");
+            "(AF Contains X) OR (CSQ:PolyPhen NE 0)");
   }
 
   /**
@@ -197,33 +219,41 @@ public class FeatureSettingsTest
   @Test(groups = "Functional")
   public void testGetColorTooltip() throws IOException
   {
-    assertNull(FeatureSettings.getColorTooltip(null));
+    assertNull(FeatureSettings.getColorTooltip(null, false));
 
     /*
      * simple colour
      */
     FeatureColourI fc = new FeatureColour(Color.black);
     String simpleTooltip = "Click to edit, right-click for menu";
-    assertEquals(FeatureSettings.getColorTooltip(fc), simpleTooltip);
+    assertEquals(FeatureSettings.getColorTooltip(fc, true), simpleTooltip);
+    assertNull(FeatureSettings.getColorTooltip(fc, false));
 
     /*
      * graduated colour tooltip includes description of colour
      */
     fc.setColourByLabel(true);
-    assertEquals(FeatureSettings.getColorTooltip(fc),
+    assertEquals(FeatureSettings.getColorTooltip(fc, false),
+            "<html>By Label</html>");
+    assertEquals(FeatureSettings.getColorTooltip(fc, true),
             "<html>By Label<br>" + simpleTooltip + "</br></html>");
 
     /*
      * graduated colour with threshold is html-encoded
      */
-    fc = new FeatureColour(Color.red, Color.blue, 2f, 10f);
+    fc = new FeatureColour(null, Color.red, Color.blue, null, 2f, 10f);
     fc.setBelowThreshold(true);
     fc.setThreshold(4f);
-    assertEquals(FeatureSettings.getColorTooltip(fc),
+    assertEquals(FeatureSettings.getColorTooltip(fc, false),
+            "<html>By Score (&lt; 4.0)</html>");
+    assertEquals(FeatureSettings.getColorTooltip(fc, true),
             "<html>By Score (&lt; 4.0)<br>" + simpleTooltip
                     + "</br></html>");
+
     fc.setAboveThreshold(true);
-    assertEquals(FeatureSettings.getColorTooltip(fc),
+    assertEquals(FeatureSettings.getColorTooltip(fc, false),
+            "<html>By Score (&gt; 4.0)</html>");
+    assertEquals(FeatureSettings.getColorTooltip(fc, true),
             "<html>By Score (&gt; 4.0)<br>" + simpleTooltip
                     + "</br></html>");
   }