X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=test%2Fjalview%2Fgui%2FFeatureSettingsTest.java;h=5219bda5d9116cfc6b76129c2519d8a47e9a6e3d;hb=ee7d621eea4811c90ce8bc470cc1e217cd2d806c;hp=6ddebf8a93c8b5e5195aa62b0d66c28f6782a078;hpb=14b1b2a878190d5fffda298c4b9a901c72c74ad3;p=jalview.git
diff --git a/test/jalview/gui/FeatureSettingsTest.java b/test/jalview/gui/FeatureSettingsTest.java
index 6ddebf8..5219bda 100644
--- a/test/jalview/gui/FeatureSettingsTest.java
+++ b/test/jalview/gui/FeatureSettingsTest.java
@@ -13,6 +13,7 @@ import jalview.datamodel.features.FeatureMatcherSetI;
import jalview.io.DataSourceType;
import jalview.io.FileLoader;
import jalview.schemes.FeatureColour;
+import jalview.schemes.FeatureColourTest;
import jalview.util.matcher.Condition;
import java.awt.Color;
@@ -60,8 +61,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);
@@ -73,8 +74,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");
@@ -188,4 +189,42 @@ public class FeatureSettingsTest
});
seq.addSequenceFeature(sf);
}
+
+ /**
+ * @see FeatureColourTest#testGetDescription()
+ * @throws IOException
+ */
+ @Test(groups = "Functional")
+ public void testGetColorTooltip() throws IOException
+ {
+ assertNull(FeatureSettings.getColorTooltip(null));
+
+ /*
+ * simple colour
+ */
+ FeatureColourI fc = new FeatureColour(Color.black);
+ String simpleTooltip = "Click to edit, right-click for menu";
+ assertEquals(FeatureSettings.getColorTooltip(fc), simpleTooltip);
+
+ /*
+ * graduated colour tooltip includes description of colour
+ */
+ fc.setColourByLabel(true);
+ assertEquals(FeatureSettings.getColorTooltip(fc),
+ "By Label
" + simpleTooltip + "");
+
+ /*
+ * graduated colour with threshold is html-encoded
+ */
+ fc = new FeatureColour(null, Color.red, Color.blue, null, 2f, 10f);
+ fc.setBelowThreshold(true);
+ fc.setThreshold(4f);
+ assertEquals(FeatureSettings.getColorTooltip(fc),
+ "By Score (< 4.0)
" + simpleTooltip
+ + "");
+ fc.setAboveThreshold(true);
+ assertEquals(FeatureSettings.getColorTooltip(fc),
+ "By Score (> 4.0)
" + simpleTooltip
+ + "");
+ }
}