X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fgui%2FFeatureSettingsTest.java;fp=test%2Fjalview%2Fgui%2FFeatureSettingsTest.java;h=db37733c18f31c1a1a42fc102ed95b4e25f3f7f9;hb=c184de2a81afe5ba6f8b7b68dde221c256e70195;hp=6ddebf8a93c8b5e5195aa62b0d66c28f6782a078;hpb=00ec8073218a0788e62cc2aa22de9a1a14d81952;p=jalview.git diff --git a/test/jalview/gui/FeatureSettingsTest.java b/test/jalview/gui/FeatureSettingsTest.java index 6ddebf8..db37733 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; @@ -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(Color.red, Color.blue, 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 + + "
"); + } }