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;
});
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),
+ "<html>By Label<br>" + simpleTooltip + "</br></html>");
+
+ /*
+ * 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),
+ "<html>By Score (< 4.0)<br>" + simpleTooltip
+ + "</br></html>");
+ fc.setAboveThreshold(true);
+ assertEquals(FeatureSettings.getColorTooltip(fc),
+ "<html>By Score (> 4.0)<br>" + simpleTooltip
+ + "</br></html>");
+ }
}