test for JAL-1268
authorJim Procter <jprocter@dundee.ac.uk>
Fri, 25 Apr 2014 16:09:55 +0000 (17:09 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Fri, 25 Apr 2014 16:09:55 +0000 (17:09 +0100)
test/jalview/io/Jalview2xmlTests.java

index 2e19e99..4ef038a 100644 (file)
@@ -66,5 +66,32 @@ public class Jalview2xmlTests
     assertTrue("Differing numbers of dataset sequence annotation\nOriginally "+olddsann+" and now "+newdsann,olddsann==newdsann);
     System.out.println("Read in same number of annotations as originally present ("+olddsann+")");
   }
+  @Test
+  public void testTCoffeeScores() throws Exception
+  {
+    String inFile = "examples/uniref50.fa",inAnnot="examples/uniref50.score_ascii";
+    String tfile = File.createTempFile("JalviewTest", ".jvp").getAbsolutePath();
+    AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(inFile, FormatAdapter.FILE);
+    assertTrue("Didn't read input file "+inFile, af!=null);
+    af.loadJalviewDataFile(inAnnot, FormatAdapter.FILE, null,null);
+    assertTrue(
+            "Didn't set T-coffee colourscheme",
+            af.getViewport().getGlobalColourScheme().getClass()
+                    .equals(jalview.schemes.TCoffeeColourScheme.class));
+    assertTrue(
+            "Recognise T-Coffee score from string",
+            jalview.schemes.ColourSchemeProperty.getColour(af.getViewport()
+                    .getAlignment(),
+                    jalview.schemes.ColourSchemeProperty.getColourName(af
+                            .getViewport().getGlobalColourScheme())) != null);
+
+    assertTrue("Failed to store as a project.",af.saveAlignment(tfile, "Jalview"));
+    af.closeMenuItem_actionPerformed(true);
+    af=null;
+    af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(tfile, FormatAdapter.FILE);
+    assertTrue("Failed to import new project", af!=null);
+    assertTrue("Didn't set T-coffee colourscheme for imported project.",af.getViewport().getGlobalColourScheme().getClass().equals(jalview.schemes.TCoffeeColourScheme.class));
+    System.out.println("T-Coffee score shading successfully recovered from project.");
+  }
 
 }