import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
-import jalview.gui.JvOptionPane;
+import jalview.gui.Desktop;
+import org.forester.archaeopteryx.Archaeopteryx;
import org.forester.archaeopteryx.MainFrame;
import org.forester.archaeopteryx.TreePanel;
import org.forester.phylogeny.Phylogeny;
ancestor1Node.setDistanceToParent(36);
ancestor2Node.setDistanceToParent(42);
+ inputTree.setName("test");
inputTree.setRoot(rootNode);
inputTree.setRooted(true);
@BeforeClass(dependsOnMethods = { "setUpJalview", "setUpTree" })
public void createTreeView()
{
-
- treeView = ArchaeopteryxInit.createInstance(inputTree);
+ treeView = Archaeopteryx.createApplication(inputTree);
aptx = (MainFrame) treeView; // pretty ugly
treePanel = aptx.getMainPanel().getCurrentTreePanel();
tree = treePanel.getPhylogeny();
- }
+ Desktop.addInternalFrame(aptx, "Archaeopteryx", 500, 500);
- @BeforeClass(alwaysRun = true)
- public void setUpJvOptionPane()
- {
- JvOptionPane.setInteractiveMode(false);
- JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
}
+
+
@Test(groups = "Functional")
public void testMainPanelExists()
{
@Test(groups = "Functional")
public void testTreePanelExists()
{
- assertTrue(aptx.getMainPanel().getCurrentTreePanel() != null);
+ assertTrue(treePanel != null);
}
@Override
+ public void testTreeTitle()
+ {
+ assertTrue(tree.getName().equals("test"));
+
+ }
+
@Test(
groups = "Functional",
expectedExceptions = IllegalArgumentException.class)
}
@Override
- @Test(groups = "Functional")
public void testExistingBranchName()
{
tree.getNode("leaf 2");
}
@Override
- @Test(groups = "Functional")
public void testTreeLoaded()
{
- assertTrue(aptx.getMainPanel().getCurrentTreePanel()
- .getPhylogeny() != null);
+ assertTrue(tree != null);
}
@Override
- @Test(groups = "Functional")
public void testChildNodesCount()
{
assertEquals(tree.getNode("ancestor 1").getNumberOfExternalNodes(), 3);
}
@Override
- @Test(groups = "Functional")
public void testChildToParentBranchLength()
{
assertEquals(tree.getNode("leaf 1a").getDistanceToParent(), 2.0);
}
@Override
- @Test(groups = "Functional")
public void testNodeToRootBranchLength()
{
assertEquals(tree.getNode("leaf 2").getDistanceToParent(), 42.0);
}
@Override
- @Test(groups = "Functional")
public void testDistantNodeToRootBranchLength()
{
assertEquals(tree.getNode("leaf 1c").calculateDistanceToRoot(),
+
}