+
+ /**
+ * @see FeatureColourTest#testGetDescription()
+ * @throws IOException
+ */
+ @Test(groups = "Functional")
+ public void testGetColorTooltip() throws IOException
+ {
+ 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, true), simpleTooltip);
+ assertNull(FeatureSettings.getColorTooltip(fc, false));
+
+ /*
+ * graduated colour tooltip includes description of colour
+ */
+ fc.setColourByLabel(true);
+ assertEquals(FeatureSettings.getColorTooltip(fc, false),
+ "<html>By Label</html>");
+ assertEquals(FeatureSettings.getColorTooltip(fc, true),
+ "<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, false),
+ "<html>By Score (< 4.0)</html>");
+ assertEquals(FeatureSettings.getColorTooltip(fc, true),
+ "<html>By Score (< 4.0)<br>" + simpleTooltip
+ + "</br></html>");
+
+ fc.setAboveThreshold(true);
+ assertEquals(FeatureSettings.getColorTooltip(fc, false),
+ "<html>By Score (> 4.0)</html>");
+ assertEquals(FeatureSettings.getColorTooltip(fc, true),
+ "<html>By Score (> 4.0)<br>" + simpleTooltip
+ + "</br></html>");
+ }
+
+ String fsfile = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ns2:JalviewUserColours schemeName=\"Sequence Features\" xmlns:ns2=\"www.jalview.org/colours\">",
+ fsfile2 = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<ns2:JalviewUserColours schemeName=\"Sequence Features\" xmlns:ns2=\"www.jalview.org/colours\">";
+
+ @Test(groups = "Functional")
+ public void testIdentifyFeatureSettingsFile() throws Exception
+ {
+ FileFormatI type = new IdentifyFile().identify(fsfile,
+ DataSourceType.PASTE);
+ assertTrue(FileFormat.FeatureSettings == type,
+ "Feature settings file was identified as " + type);
+ type = new IdentifyFile().identify(fsfile2, DataSourceType.PASTE);
+ assertTrue(FileFormat.FeatureSettings == type,
+ "Feature settings file with newline was identified as " + type);
+ }