JAL-2843 help text for colour by attribute, feature filters
[jalview.git] / test / jalview / schemes / FeatureColourTest.java
index 2eb718b..a96caec 100644 (file)
@@ -523,11 +523,60 @@ public class FeatureColourTest
     assertFalse(fc.hasThreshold());
     assertEquals(Color.RED, fc.getMinColour());
     assertEquals(Color.GREEN, fc.getMaxColour());
+    assertEquals(Color.RED, fc.getNoColour());
     assertEquals(10f, fc.getMin());
     assertEquals(20f, fc.getMax());
     assertTrue(fc.isAutoScaled());
 
     /*
+     * the same, with 'no value colour' specified as max
+     */
+    fc = FeatureColour
+            .parseJalviewFeatureColour("red|green|novaluemax|10.0|20.0");
+    assertEquals(Color.RED, fc.getMinColour());
+    assertEquals(Color.GREEN, fc.getMaxColour());
+    assertEquals(Color.GREEN, fc.getNoColour());
+    assertEquals(10f, fc.getMin());
+    assertEquals(20f, fc.getMax());
+
+    /*
+     * the same, with 'no value colour' specified as min
+     */
+    fc = FeatureColour
+            .parseJalviewFeatureColour("red|green|novalueMin|10.0|20.0");
+    assertEquals(Color.RED, fc.getMinColour());
+    assertEquals(Color.GREEN, fc.getMaxColour());
+    assertEquals(Color.RED, fc.getNoColour());
+    assertEquals(10f, fc.getMin());
+    assertEquals(20f, fc.getMax());
+
+    /*
+     * the same, with 'no value colour' specified as none
+     */
+    fc = FeatureColour
+            .parseJalviewFeatureColour("red|green|novaluenone|10.0|20.0");
+    assertEquals(Color.RED, fc.getMinColour());
+    assertEquals(Color.GREEN, fc.getMaxColour());
+    assertNull(fc.getNoColour());
+    assertEquals(10f, fc.getMin());
+    assertEquals(20f, fc.getMax());
+
+    /*
+     * the same, with invalid 'no value colour'
+     */
+    try
+    {
+      fc = FeatureColour
+              .parseJalviewFeatureColour("red|green|blue|10.0|20.0");
+      fail("expected exception");
+    } catch (IllegalArgumentException e)
+    {
+      assertEquals(
+              "Couldn't parse the minimum value for graduated colour ('blue')",
+              e.getMessage());
+    }
+
+    /*
      * graduated colour (explicitly by 'score') (no threshold)
      */
     fc = FeatureColour