JAL-3187 unit tests updated and errors caught
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 21 Jan 2019 14:54:23 +0000 (14:54 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 21 Jan 2019 14:54:23 +0000 (14:54 +0000)
src/jalview/datamodel/features/SequenceFeatures.java
src/jalview/renderer/seqfeatures/FeatureColourFinder.java
src/jalview/viewmodel/styles/ViewStyle.java
test/jalview/datamodel/features/SequenceFeaturesTest.java
test/jalview/io/FeaturesFileTest.java

index 08f3847..1120291 100644 (file)
@@ -247,7 +247,7 @@ public class SequenceFeatures implements SequenceFeaturesI
     List<FeatureStore> types = new ArrayList<>();
     for (String theType : type)
     {
-      if (featureStore.containsKey(theType))
+      if (theType != null && featureStore.containsKey(theType))
       {
         types.add(featureStore.get(theType));
       }
index 52090e1..d5784b0 100644 (file)
@@ -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;
     }
index 1d1ab4d..d68227b 100644 (file)
@@ -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()
index 29e76bb..4198a37 100644 (file)
@@ -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());
 
     /*
index 32ca841..f244ac5 100644 (file)
@@ -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"
             + "<html>Pfam domain<a href=\"http://pfam.xfam.org/family/PF00111\">Pfam_3_4</a></html>\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);
   }