From e850d8cdbb327813038d0f1961d4b34988e3be0d Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Fri, 13 Oct 2017 17:51:41 +0100 Subject: [PATCH] basic tests for Aptx --- .../ext/archaeopteryx/ArchaeopteryxInit.java | 8 +-- .../ext/archaeopteryx/AptxTreeCreationTest.java | 53 +++++++++++++++++++- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java b/src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java index 8302140..7ca870c 100644 --- a/src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java +++ b/src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java @@ -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); diff --git a/test/jalview/ext/archaeopteryx/AptxTreeCreationTest.java b/test/jalview/ext/archaeopteryx/AptxTreeCreationTest.java index 764c21f..1a22c81 100644 --- a/test/jalview/ext/archaeopteryx/AptxTreeCreationTest.java +++ b/test/jalview/ext/archaeopteryx/AptxTreeCreationTest.java @@ -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); + // + // + // + // } + + + } -- 1.7.10.2