From: gmungoc Date: Tue, 15 Mar 2016 15:19:46 +0000 (+0000) Subject: JAL-2016 corrected Javadoc, added test for anonymous instance X-Git-Tag: Release_2_10_0~296^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1d17220cc3868f513b5e310a5d09b0f419f13d84;p=jalview.git JAL-2016 corrected Javadoc, added test for anonymous instance --- diff --git a/src/jalview/api/FeatureSettingsModelI.java b/src/jalview/api/FeatureSettingsModelI.java index 28f5c77..c0fc523 100644 --- a/src/jalview/api/FeatureSettingsModelI.java +++ b/src/jalview/api/FeatureSettingsModelI.java @@ -68,8 +68,13 @@ public interface FeatureSettingsModelI extends Comparator float getTransparency(); /** - * Returns -1 if feature1 'precedes' (is displayed on top of) feature 2, +1 if - * feature2 is on top of feature1, or 0 if we don't care + * Returns -1 if feature1 is displayed before (below) feature 2, +1 if + * feature2 is displayed after (on top of) feature1, or 0 if we don't care. + * + *
+ * Note that this is the opposite ordering to how features are displayed in + * the feature settings dialogue. FeatureRendererModel.setFeaturePriority + * takes care of converting between the two. * * @param feature1 * @param feature2 diff --git a/test/jalview/ext/ensembl/EnsemblGeneTest.java b/test/jalview/ext/ensembl/EnsemblGeneTest.java index d1c7e2f..5cf296c 100644 --- a/test/jalview/ext/ensembl/EnsemblGeneTest.java +++ b/test/jalview/ext/ensembl/EnsemblGeneTest.java @@ -5,6 +5,7 @@ import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertSame; import static org.testng.AssertJUnit.assertTrue; +import jalview.api.FeatureSettingsModelI; import jalview.datamodel.SequenceDummy; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; @@ -12,6 +13,7 @@ import jalview.io.gff.SequenceOntologyFactory; import jalview.io.gff.SequenceOntologyLite; import jalview.util.MapList; +import java.awt.Color; import java.util.List; import org.testng.annotations.AfterClass; @@ -233,4 +235,31 @@ public class EnsemblGeneTest sf.setType("exon"); assertFalse(testee.identifiesSequence(sf, accId)); } + + /** + * Check behaviour of feature colour scheme for EnsemblGene sequences. + * Currently coded to display exon and sequence_variant (or sub-types) only, + * with sequence_variant in red above exon coloured by label. + */ + @Test(groups = "Functional") + public void testGetFeatureColourScheme() + { + FeatureSettingsModelI fc = new EnsemblGene().getFeatureColourScheme(); + assertTrue(fc.isFeatureDisplayed("exon")); + assertTrue(fc.isFeatureDisplayed("coding_exon")); // subtype of exon + assertTrue(fc.isFeatureDisplayed("sequence_variant")); + assertTrue(fc.isFeatureDisplayed("feature_variant")); // subtype + assertFalse(fc.isFeatureDisplayed("transcript")); + assertEquals(Color.RED, fc.getFeatureColour("sequence_variant") + .getColour()); + assertEquals(Color.RED, fc.getFeatureColour("feature_variant") + .getColour()); + assertTrue(fc.getFeatureColour("exon").isColourByLabel()); + assertTrue(fc.getFeatureColour("coding_exon").isColourByLabel()); + assertEquals(1, fc.compare("sequence_variant", "exon")); + assertEquals(-1, fc.compare("exon", "sequence_variant")); + assertEquals(1, fc.compare("feature_variant", "coding_exon")); + assertEquals(-1, fc.compare("coding_exon", "feature_variant")); + assertEquals(1f, fc.getTransparency()); + } }