JAL-3049 corrected code and unit tests
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 23 Jul 2018 10:19:54 +0000 (11:19 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 23 Jul 2018 10:19:54 +0000 (11:19 +0100)
.classpath
src/jalview/gui/FeatureSettings.java
test/jalview/gui/FeatureSettingsTest.java

index fe6fbcc..aba05fb 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
        <classpathentry kind="src" path="src"/>
+       <classpathentry kind="src" path="test"/>
        <classpathentry kind="src" path="src2"/>
        <classpathentry kind="src" path="utils"/>
        <classpathentry kind="lib" path="lib/activation.jar"/>
index 0e18d91..37258e4 100644 (file)
@@ -1371,9 +1371,9 @@ public class FeatureSettings extends JPanel
     {
       return null;
     }
-    if (fcol.isSimpleColour() && withHint)
+    if (fcol.isSimpleColour())
     {
-      return BASE_TOOLTIP;
+      return withHint ? BASE_TOOLTIP : null;
     }
     String description = fcol.getDescription();
     description = description.replaceAll("<", "&lt;");
index bf905fb..321adf6 100644 (file)
@@ -197,20 +197,23 @@ public class FeatureSettingsTest
   @Test(groups = "Functional")
   public void testGetColorTooltip() throws IOException
   {
-    assertNull(FeatureSettings.getColorTooltip(null,false));
+    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,false), 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,false),
+    assertEquals(FeatureSettings.getColorTooltip(fc, false),
+            "<html>By Label</html>");
+    assertEquals(FeatureSettings.getColorTooltip(fc, true),
             "<html>By Label<br>" + simpleTooltip + "</br></html>");
 
     /*
@@ -219,11 +222,16 @@ public class FeatureSettingsTest
     fc = new FeatureColour(Color.red, Color.blue, 2f, 10f);
     fc.setBelowThreshold(true);
     fc.setThreshold(4f);
-    assertEquals(FeatureSettings.getColorTooltip(fc,false),
+    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,false),
+    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>");
   }