Author: mes
Date: 2012-06-13 17:33:26 -0700 (Wed, 13 Jun 2012)
New Revision: 29563
Modified:
core3/functional-testing/trunk/
core3/functional-testing/trunk/pom.xml
core3/functional-testing/trunk/src/test/java/org/cytoscape/functional/menus/BasicMenuTest.java
Log:
added more tests
Property changes on: core3/functional-testing/trunk
___________________________________________________________________
Added: svn:ignore
+ target
Modified: core3/functional-testing/trunk/pom.xml
===================================================================
--- core3/functional-testing/trunk/pom.xml 2012-06-14 00:30:24 UTC (rev
29562)
+++ core3/functional-testing/trunk/pom.xml 2012-06-14 00:33:26 UTC (rev
29563)
@@ -60,12 +60,6 @@
<version>4.8.2</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.cytoscape</groupId>
- <artifactId>swing-application-api</artifactId>
- <version>${cytoscape.api.version}</version>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>cytoscape-temp</groupId>
<artifactId>uispec4j</artifactId>
@@ -85,5 +79,23 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>swing-application-api</artifactId>
+ <version>${cytoscape.api.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>model-api</artifactId>
+ <version>${cytoscape.api.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>viewmodel-api</artifactId>
+ <version>${cytoscape.api.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
Modified:
core3/functional-testing/trunk/src/test/java/org/cytoscape/functional/menus/BasicMenuTest.java
===================================================================
---
core3/functional-testing/trunk/src/test/java/org/cytoscape/functional/menus/BasicMenuTest.java
2012-06-14 00:30:24 UTC (rev 29562)
+++
core3/functional-testing/trunk/src/test/java/org/cytoscape/functional/menus/BasicMenuTest.java
2012-06-14 00:33:26 UTC (rev 29563)
@@ -34,9 +34,14 @@
import
org.openengsb.labs.paxexam.karaf.options.KarafDistributionConfigurationFilePutOption;
import org.cytoscape.application.swing.CySwingApplication;
+import org.cytoscape.model.CyNetworkManager;
+import org.cytoscape.view.model.CyNetworkViewManager;
import org.uispec4j.UISpec4J;
import org.uispec4j.Window;
+import org.uispec4j.Trigger;
+import org.uispec4j.interception.WindowInterceptor;
+import org.uispec4j.interception.WindowHandler;
import org.uispec4j.MenuItem;
@RunWith(JUnit4TestRunner.class)
@@ -45,8 +50,14 @@
// Inject any other desired services in the same way.
@Inject
- private CySwingApplication swingApp;
+ private CySwingApplication cySwingApplication;
+ @Inject
+ private CyNetworkManager cyNetworkManager;
+
+ @Inject
+ private CyNetworkViewManager cyNetworkViewManager;
+
@Configuration
public Option[] config() {
// Very important to initialize uispec4j before any guis are
created.
@@ -55,6 +66,8 @@
return new Option[] {
karafDistributionConfiguration("mvn:org.apache.karaf/apache-karaf/2.2.7/zip",
"karaf", "2.2.7"),
+ systemProperty("hideWelcomeScreen").value("true"),
+
// These custom properties are the same as the custom
properties
// found in framework/etc/custom.properties and are
needed to
// get the startlevels right.
@@ -91,24 +104,55 @@
@Test
public void test() throws Exception {
- assertNotNull(swingApp);
- Window mainWindow = new Window(swingApp.getJFrame());
- checkTopLevelMenus(mainWindow);
+ assertNotNull(cySwingApplication);
+ Window mainWindow = new Window(cySwingApplication.getJFrame());
+ checkMenuExistence(mainWindow);
+ checkMenuFunctionality(mainWindow);
// more tests...
}
- private void checkTopLevelMenus(Window mainWindow) {
- checkFileMenus( mainWindow.getMenuBar().getMenu("File"));
- checkEditMenus( mainWindow.getMenuBar().getMenu("Edit"));
- checkViewMenus( mainWindow.getMenuBar().getMenu("View"));
- checkSelectMenus( mainWindow.getMenuBar().getMenu("Select"));
- checkLayoutMenus( mainWindow.getMenuBar().getMenu("Layout"));
- checkAppsMenus( mainWindow.getMenuBar().getMenu("Apps"));
- checkToolsMenus( mainWindow.getMenuBar().getMenu("Tools"));
- checkHelpMenus( mainWindow.getMenuBar().getMenu("Help"));
+/*
+ //WindowInterceptor.init(new
WelcomeScreenTrigger(mainWindow)).process( "Welcome to Cytoscape 3", new
WelcomeScreenClose() ).run();
+ private class WelcomeScreenTrigger implements Trigger {
+ private Window main;
+ WelcomeScreenTrigger(Window main) { this.main = main; }
+ public void run() {
+ main.getMenuBar().getMenu("Help").getSubMenu("Show
Welcome Screen...").click();
+ }
+ }
+
+ private class WelcomeScreenClose extends WindowHandler {
+ public Trigger process(Window window) {
+ return window.getButton("Close").triggerClick();
+ }
+ }
+ */
+
+ private void checkMenuFunctionality(Window mainWindow) {
+
checkFileMenusFunctionality(mainWindow.getMenuBar().getMenu("File"));
+ }
+
+ private void checkFileMenusFunctionality(MenuItem fileMenu) {
+ int numNets = cyNetworkManager.getNetworkSet().size();
+ int numViews = cyNetworkViewManager.getNetworkViewSet().size();
+
fileMenu.getSubMenu("New").getSubMenu("Network").getSubMenu("Empty
Network").click();
+ sleep(1000); // allow thread to complete
+ assertEquals( numNets + 1,
cyNetworkManager.getNetworkSet().size());
+ assertEquals( numViews + 1,
cyNetworkViewManager.getNetworkViewSet().size());
+ }
+
+ private void checkMenuExistence(Window mainWindow) {
+ checkFileMenusExistence(
mainWindow.getMenuBar().getMenu("File"));
+ checkEditMenusExistence(
mainWindow.getMenuBar().getMenu("Edit"));
+ checkViewMenusExistence(
mainWindow.getMenuBar().getMenu("View"));
+ checkSelectMenusExistence(
mainWindow.getMenuBar().getMenu("Select"));
+ checkLayoutMenusExistence(
mainWindow.getMenuBar().getMenu("Layout"));
+ checkAppsMenusExistence(
mainWindow.getMenuBar().getMenu("Apps"));
+ checkToolsMenusExistence(
mainWindow.getMenuBar().getMenu("Tools"));
+ checkHelpMenusExistence(
mainWindow.getMenuBar().getMenu("Help"));
}
- private void checkFileMenus(MenuItem fileMenu) {
+ private void checkFileMenusExistence(MenuItem fileMenu) {
assertNotNull(fileMenu);
assertNotNull(fileMenu.getSubMenu("Recent Session"));
assertNotNull(fileMenu.getSubMenu("New"));
@@ -120,7 +164,7 @@
assertNotNull(fileMenu.getSubMenu("Print Current Network..."));
}
- private void checkEditMenus(MenuItem editMenu) {
+ private void checkEditMenusExistence(MenuItem editMenu) {
assertNotNull(editMenu);
assertNotNull(editMenu.getSubMenu("Copy"));
assertNotNull(editMenu.getSubMenu("Cut"));
@@ -138,7 +182,7 @@
assertNotNull(editMenu.getSubMenu("Connect Selected Nodes"));
}
- private void checkViewMenus(MenuItem viewMenu) {
+ private void checkViewMenusExistence(MenuItem viewMenu) {
assertNotNull(viewMenu);
assertNotNull(viewMenu.getSubMenu("Hide Control Panel"));
assertNotNull(viewMenu.getSubMenu("Hide Table Panel"));
@@ -150,7 +194,7 @@
assertNotNull(viewMenu.getSubMenu("Arrange Network Windows"));
}
- private void checkSelectMenus(MenuItem selectMenu) {
+ private void checkSelectMenusExistence(MenuItem selectMenu) {
assertNotNull(selectMenu);
assertNotNull(selectMenu.getSubMenu("Nodes"));
assertNotNull(selectMenu.getSubMenu("Edges"));
@@ -161,7 +205,7 @@
assertNotNull(selectMenu.getSubMenu("Use Filters"));
}
- private void checkLayoutMenus(MenuItem layoutMenu) {
+ private void checkLayoutMenusExistence(MenuItem layoutMenu) {
assertNotNull(layoutMenu);
assertNotNull(layoutMenu.getSubMenu("Bundle Edges"));
assertNotNull(layoutMenu.getSubMenu("Rotate"));
@@ -174,12 +218,12 @@
assertNotNull(layoutMenu.getSubMenu("yFiles Layouts"));
}
- private void checkAppsMenus(MenuItem appsMenu) {
+ private void checkAppsMenusExistence(MenuItem appsMenu) {
assertNotNull(appsMenu);
assertNotNull(appsMenu.getSubMenu("App Manager"));
}
- private void checkToolsMenus(MenuItem toolsMenu) {
+ private void checkToolsMenusExistence(MenuItem toolsMenu) {
assertNotNull(toolsMenu);
assertNotNull(toolsMenu.getSubMenu("Network Analyzer"));
assertNotNull(toolsMenu.getSubMenu("Run script..."));
@@ -189,7 +233,7 @@
assertNotNull(toolsMenu.getSubMenu("Merge Networks"));
}
- private void checkHelpMenus(MenuItem helpMenu) {
+ private void checkHelpMenusExistence(MenuItem helpMenu) {
assertNotNull(helpMenu);
assertNotNull(helpMenu.getSubMenu("Contents..."));
assertNotNull(helpMenu.getSubMenu("About..."));
@@ -198,4 +242,12 @@
assertNotNull(helpMenu.getSubMenu("Log Console"));
assertNotNull(helpMenu.getSubMenu("Show Welcome Screen..."));
}
+
+ private void sleep(int millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.