basic tests for Aptx
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Fri, 13 Oct 2017 16:51:41 +0000 (17:51 +0100)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Fri, 13 Oct 2017 16:51:41 +0000 (17:51 +0100)
src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java
test/jalview/ext/archaeopteryx/AptxTreeCreationTest.java

index 8302140..7ca870c 100644 (file)
@@ -13,7 +13,7 @@ public final class ArchaeopteryxInit
 {
   public static MainFrame createInstance(Phylogeny[] aptxTrees)
   {
-    return createAptxFrame(aptxTrees);
+    return createBoundAptxFrame(aptxTrees);
 
   }
 
@@ -21,7 +21,7 @@ public final class ArchaeopteryxInit
   {
     Phylogeny[] aptxTrees = { aptxTree }; // future possibility to load in
     // several trees simultaneously
-    return createAptxFrame(aptxTrees);
+    return createBoundAptxFrame(aptxTrees);
 
   }
 
@@ -33,12 +33,12 @@ public final class ArchaeopteryxInit
     Phylogeny[] aptxTrees = { aptxTree }; // future possibility to load in
                                           // several trees simultaneously
 
-    return createAptxFrame(aptxTrees);
+    return createBoundAptxFrame(aptxTrees);
 
   }
 
 
-  private static MainFrame createAptxFrame(Phylogeny[] aptxTrees)
+  private static MainFrame createBoundAptxFrame(Phylogeny[] aptxTrees)
   {
     MainFrame aptxApp = Archaeopteryx.createApplication(aptxTrees,
             "_aptx_jalview_configuration_file", null);
index 764c21f..1a22c81 100644 (file)
@@ -1,8 +1,13 @@
 package jalview.ext.archaeopteryx;
 
+import static org.testng.Assert.assertTrue;
+
+import jalview.bin.Jalview;
+import jalview.gui.Desktop;
 import jalview.gui.JvOptionPane;
 
 import org.forester.archaeopteryx.MainFrame;
+import org.forester.archaeopteryx.TreePanel;
 import org.forester.phylogeny.Phylogeny;
 import org.forester.phylogeny.PhylogenyNode;
 import org.testng.annotations.BeforeClass;
@@ -24,6 +29,14 @@ public class AptxTreeCreationTest
 
   final PhylogenyNode leaf1cNode = new PhylogenyNode("leaf 1c");
 
+  MainFrame aptx;
+
+  TreePanel treePanel;
+
+  Jalview jalview;
+
+  @BeforeClass(alwaysRun = true)
+  public void setUpTrees()
   {
     ancestor1Node.addAsChild(leaf1aNode);
     ancestor1Node.addAsChild(leaf1bNode);
@@ -45,6 +58,14 @@ public class AptxTreeCreationTest
   }
 
   @BeforeClass(alwaysRun = true)
+  public void setUpJalview()
+  {
+    String[] args = new String[0];
+    Jalview.main(args);
+    aptx = ArchaeopteryxInit.createInstance(phy);
+  }
+
+  @BeforeClass(alwaysRun = true)
   public void setUpJvOptionPane()
   {
     JvOptionPane.setInteractiveMode(false);
@@ -52,10 +73,40 @@ public class AptxTreeCreationTest
   }
 
   @Test(groups = "Functional")
+  public void testAptxExists()
+  {
+    assertTrue(aptx != null);
+  }
+
+  @Test(groups = "Functional")
+  public void testAptxBoundToJalview()
+  {
+    assertTrue(aptx.getTopLevelAncestor() instanceof Desktop);
+  }
+
+  @Test(groups = "Functional")
   public void testShowingTree()
   {
-    MainFrame aptx = ArchaeopteryxInit.createInstance(phy);
+    assertTrue(aptx.isShowing());
 
   }
 
+  // @Test(groups = "Functional")
+  // public void testCorrectBranchLengths()
+  //
+  // {
+  // aptx.getMainPanel().getTabbedPane().setSelectedIndex(0); // select the
+  // // first
+  // // (and only) tree
+  // // panel
+  // treePanel = aptx.getMainPanel().getCurrentTreePanel();
+  //
+  // System.out.println(treePanel);
+  //
+  //
+  //
+  // }
+
+
+
 }