JAL-3390 unit tests and command and menu refinements
[jalview.git] / test / jalview / ext / rbvi / chimera / ChimeraCommandsTest.java
index b8ca2dd..fd4ec69 100644 (file)
@@ -61,11 +61,10 @@ public class ChimeraCommandsTest
 
     // Colours should appear in the Chimera command in the order in which
     // they were added; within colour, by model, by chain, ranges in start order
-    // all prefixed with #808080 to colour hidden regions (if shown) gray
     List<StructureCommandI> commands = testee.colourBySequence(map);
     assertEquals(commands.size(), 1);
     assertEquals(commands.get(0).getCommand(),
-            "color #808080; color #0000ff #0:2-5.A,9-23.A,7.B|#1:1.A,4-7.B;color #ffff00 #1:3-5.A,8.A;color #ff0000 #0:3-9.A");
+            "color #0000ff #0:2-5.A,9-23.A,7.B|#1:1.A,4-7.B;color #ffff00 #1:3-5.A,8.A;color #ff0000 #0:3-9.A");
   }
 
   @Test(groups = { "Functional" })
@@ -340,4 +339,39 @@ public class ChimeraCommandsTest
     assertEquals(testee.setAttribute("jv_kd", "27.3", model).getCommand(),
             "setattr res jv_kd '27.3' #1:89-92.A|#2:8-9.B,12-20.B");
   }
+
+  @Test(groups = "Functional")
+  public void testHideAll()
+  {
+    StructureCommandI cmd = testee.hideAll();
+    assertEquals(cmd.getCommand(), "~display all; ~ribbon");
+  }
+
+  @Test(groups = "Functional")
+  public void testHideChain()
+  {
+    StructureCommandI cmd = testee.hideChain("1.1", "B");
+    assertEquals(cmd.getCommand(), "~ribbon #1.1:.B");
+  }
+
+  @Test(groups = "Functional")
+  public void testShowStructures()
+  {
+    /*
+     * with nothing excluded
+     */
+    StructureCommandI cmd = testee.showStructures(null);
+    assertEquals(cmd.getCommand(), "ribbon");
+
+    /*
+     * restricted to specified positions
+     */
+    AtomSpecModel restrictTo = new AtomSpecModel();
+    restrictTo.addRange("1.1", 12, 20, "A");
+    restrictTo.addRange("1.1", 30, 35, "A");
+    restrictTo.addRange("2.1", 11, 30, "B");
+    cmd = testee.showStructures(restrictTo);
+    assertEquals(cmd.getCommand(),
+            "ribbon #1.1:12-20.A,30-35.A|#2.1:11-30.B");
+  }
 }