JAL-2446 merged to spike branch
[jalview.git] / test / jalview / schemes / FeatureColourTest.java
index 47613a1..1beca80 100644 (file)
@@ -27,6 +27,7 @@ import static org.testng.AssertJUnit.fail;
 
 import jalview.datamodel.SequenceFeature;
 import jalview.gui.JvOptionPane;
+import jalview.util.ColorUtils;
 import jalview.util.Format;
 
 import java.awt.Color;
@@ -86,7 +87,8 @@ public class FeatureColourTest
   public void testIsColored_simpleColour()
   {
     FeatureColour fc = new FeatureColour(Color.RED);
-    assertTrue(fc.isColored(new SequenceFeature()));
+    assertTrue(fc
+            .isColored(new SequenceFeature("Cath", "", 1, 2, 0f, null)));
   }
 
   @Test(groups = { "Functional" })
@@ -94,7 +96,8 @@ public class FeatureColourTest
   {
     FeatureColour fc = new FeatureColour();
     fc.setColourByLabel(true);
-    assertTrue(fc.isColored(new SequenceFeature()));
+    assertTrue(fc
+            .isColored(new SequenceFeature("Cath", "", 1, 2, 0f, null)));
   }
 
   @Test(groups = { "Functional" })
@@ -111,13 +114,15 @@ public class FeatureColourTest
     assertEquals(Color.WHITE, fc.getColor(sf));
 
     // score 120 is adjusted to top of range
-    sf.setScore(120f);
+    sf = new SequenceFeature(sf, sf.getBegin(), sf.getEnd(),
+            sf.getFeatureGroup(), 120f);
     assertEquals(Color.BLACK, fc.getColor(sf));
 
     // value below threshold is still rendered
     // setting threshold has no effect yet...
     fc.setThreshold(60f);
-    sf.setScore(36f);
+    sf = new SequenceFeature(sf, sf.getBegin(), sf.getEnd(),
+            sf.getFeatureGroup(), 36f);
     assertTrue(fc.isColored(sf));
     assertEquals(new Color(204, 204, 204), fc.getColor(sf));
 
@@ -127,7 +132,9 @@ public class FeatureColourTest
     // colour is still returned though ?!?
     assertEquals(new Color(204, 204, 204), fc.getColor(sf));
 
-    sf.setScore(84); // above threshold now
+    sf = new SequenceFeature(sf, sf.getBegin(), sf.getEnd(),
+            sf.getFeatureGroup(), 84f);
+    // above threshold now
     assertTrue(fc.isColored(sf));
     assertEquals(new Color(51, 51, 51), fc.getColor(sf));
   }
@@ -136,7 +143,8 @@ public class FeatureColourTest
   public void testGetColor_simpleColour()
   {
     FeatureColour fc = new FeatureColour(Color.RED);
-    assertEquals(Color.RED, fc.getColor(new SequenceFeature()));
+    assertEquals(Color.RED,
+            fc.getColor(new SequenceFeature("Cath", "", 1, 2, 0f, null)));
   }
 
   @Test(groups = { "Functional" })
@@ -146,7 +154,7 @@ public class FeatureColourTest
     fc.setColourByLabel(true);
     SequenceFeature sf = new SequenceFeature("type", "desc", 0, 20, 1f,
             null);
-    Color expected = UserColourScheme.createColourFromName("desc");
+    Color expected = ColorUtils.createColourFromName("desc");
     assertEquals(expected, fc.getColor(sf));
   }