From: gmungoc Date: Mon, 21 Jan 2019 14:54:23 +0000 (+0000) Subject: JAL-3187 unit tests updated and errors caught X-Git-Tag: Release_2_11_1_0~72 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3a9c9cd41358438efc1c4f365fecc7491592ca46;p=jalview.git JAL-3187 unit tests updated and errors caught --- diff --git a/src/jalview/datamodel/features/SequenceFeatures.java b/src/jalview/datamodel/features/SequenceFeatures.java index 08f3847..1120291 100644 --- a/src/jalview/datamodel/features/SequenceFeatures.java +++ b/src/jalview/datamodel/features/SequenceFeatures.java @@ -247,7 +247,7 @@ public class SequenceFeatures implements SequenceFeaturesI List types = new ArrayList<>(); for (String theType : type) { - if (featureStore.containsKey(theType)) + if (theType != null && featureStore.containsKey(theType)) { types.add(featureStore.get(theType)); } diff --git a/src/jalview/renderer/seqfeatures/FeatureColourFinder.java b/src/jalview/renderer/seqfeatures/FeatureColourFinder.java index 52090e1..d5784b0 100644 --- a/src/jalview/renderer/seqfeatures/FeatureColourFinder.java +++ b/src/jalview/renderer/seqfeatures/FeatureColourFinder.java @@ -123,12 +123,16 @@ public class FeatureColourFinder */ boolean noFeaturesDisplayed() { + if (featureRenderer == null) + { + return true; + } AlignViewportI av = featureRenderer.getViewport(); if (av.isShowComplementFeatures()) { return false; } - if (featureRenderer == null || !av.isShowSequenceFeatures()) + if (!av.isShowSequenceFeatures()) { return true; } diff --git a/src/jalview/viewmodel/styles/ViewStyle.java b/src/jalview/viewmodel/styles/ViewStyle.java index 1d1ab4d..d68227b 100644 --- a/src/jalview/viewmodel/styles/ViewStyle.java +++ b/src/jalview/viewmodel/styles/ViewStyle.java @@ -213,6 +213,7 @@ public class ViewStyle implements ViewStyleI setShowNPFeats(vs.isShowNPFeats()); setShowSequenceFeaturesHeight(vs.isShowSequenceFeaturesHeight()); setShowSequenceFeatures(vs.isShowSequenceFeatures()); + setShowComplementFeatures(vs.isShowComplementFeatures()); setShowText(vs.getShowText()); setShowUnconserved(vs.getShowUnconserved()); setTextColour(vs.getTextColour()); @@ -275,6 +276,7 @@ public class ViewStyle implements ViewStyleI && isShowSequenceFeaturesHeight() == vs .isShowSequenceFeaturesHeight() && isShowSequenceFeatures() == vs.isShowSequenceFeatures() + && isShowComplementFeatures() == vs.isShowComplementFeatures() && getShowText() == vs.getShowText() && getShowUnconserved() == vs.getShowUnconserved() && getThreshold() == vs.getThreshold() diff --git a/test/jalview/datamodel/features/SequenceFeaturesTest.java b/test/jalview/datamodel/features/SequenceFeaturesTest.java index 29e76bb..4198a37 100644 --- a/test/jalview/datamodel/features/SequenceFeaturesTest.java +++ b/test/jalview/datamodel/features/SequenceFeaturesTest.java @@ -940,14 +940,14 @@ public class SequenceFeaturesTest assertFalse(iterator.hasNext()); /* - * two types specified - get sorted alphabetically + * two types specified - order is preserved */ types = sf.varargToTypes("Metal", "Cath"); iterator = types.iterator(); assertTrue(iterator.hasNext()); - assertSame(iterator.next(), featureStores.get("Cath")); - assertTrue(iterator.hasNext()); assertSame(iterator.next(), featureStores.get("Metal")); + assertTrue(iterator.hasNext()); + assertSame(iterator.next(), featureStores.get("Cath")); assertFalse(iterator.hasNext()); /* diff --git a/test/jalview/io/FeaturesFileTest.java b/test/jalview/io/FeaturesFileTest.java index 32ca841..f244ac5 100644 --- a/test/jalview/io/FeaturesFileTest.java +++ b/test/jalview/io/FeaturesFileTest.java @@ -506,8 +506,8 @@ public class FeaturesFileTest expected = "METAL\tcc9900\n" + "GAMMA-TURN\tscore|ff0000|00ffff|noValueMin|20.0|95.0|below|66.0\n" + "\nSTARTGROUP\tuniprot\n" - + "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n" + "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\t0.0\n" + + "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n" + "ENDGROUP\tuniprot\n"; assertEquals(expected, exported); @@ -525,9 +525,9 @@ public class FeaturesFileTest + "Pfam\tff0000\n" + "GAMMA-TURN\tscore|ff0000|00ffff|noValueMin|20.0|95.0|below|66.0\n" + "\nSTARTGROUP\tuniprot\n" - + "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n" + "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\t0.0\n" + "Pfam domainPfam_3_4\tFER_CAPAA\t-1\t20\t20\tPfam\t0.0\n" + + "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n" + "ENDGROUP\tuniprot\n" // null / empty group features output after features in named // groups: @@ -628,8 +628,8 @@ public class FeaturesFileTest // Pfam feature columns include strand(+), phase(2), attributes expected = gffHeader + "FER_CAPAA\tCath\tMETAL\t39\t39\t1.2\t.\t.\n" - + "FER_CAPAN\ts3dm\tGAMMA-TURN\t36\t38\t2.1\t.\t.\n" - + "FER_CAPAN\tUniprot\tPfam\t20\t20\t0.0\t+\t2\tx=y;black=white\n"; + + "FER_CAPAN\tUniprot\tPfam\t20\t20\t0.0\t+\t2\tx=y;black=white\n" + + "FER_CAPAN\ts3dm\tGAMMA-TURN\t36\t38\t2.1\t.\t.\n"; assertEquals(expected, exported); }