What this is
This file is included in the DevDaily.com
"Java Source Code
Warehouse" project. The intent of this project is to help you "Learn
Java by Example" TM.
Other links
The source code
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.qa.form.visualDevelopment;
import java.awt.Point;
import org.netbeans.junit.NbTestSuite;
import org.netbeans.jemmy.TimeoutExpiredException;
import org.netbeans.jemmy.operators.JPopupMenuOperator;
import org.netbeans.jellytools.*;
import org.netbeans.jellytools.modules.form.*;
import org.netbeans.jellytools.modules.form.properties.editors.*;
import org.netbeans.jellytools.nodes.*;
import org.netbeans.jellytools.properties.*;
import org.netbeans.jellytools.actions.*;
import org.netbeans.jemmy.operators.*;
import java.util.*;
import org.netbeans.junit.ide.ProjectSupport;
import org.netbeans.qa.form.*;
import java.io.*;
/**
*
* Test create frame.
*
*
What it tests:
* Frame containing all components from Component Palette SWING category try compile.
*
How it works:
* Find tested form file, add all components from SWING category and compile created frame (check compile resolution).
*
*
Settings:
* Jemmy/Jelly classes, VisualDevelopmentSupport class in the classpath.
*
*
Resources:
* File (Resources.) clear_Frame(java/form) generated by NBr32(37).
*
* Possible reasons of failure
* jelly didn't find menu or popup menu
* is impossible add component or components in SWING category is another as in NB r3.2 (37)
* component was't add correctly or generated source code is wrong
*
* @author Marian.Mirilovic@czech.sun.com
* @version
*/
public class AddComponents_SWING extends JellyTestCase {
public String FILE_NAME = "clear_JFrame";
public String PACKAGE_NAME = "data";
public String DATA_PROJECT_NAME = "SampleProject";
public String FRAME_ROOT = "[JFrame]";
public MainWindowOperator mainWindow;
public ProjectsTabOperator pto;
public Node formnode;
public AddComponents_SWING(String testName) {
super(testName);
}
/** Run test.
*/
public void testOpenDataProject(){
mainWindow = MainWindowOperator.getDefault();
openDataProject();
}
/** Run test.
*/
public void testCloseDataProject(){
closeDataProject();
EditorWindowOperator ewo = new EditorWindowOperator();
ewo.closeDiscard();
}
/** Run test.
*/
public void testAddAndCompile() {
String categoryName = "Swing";
pto = new ProjectsTabOperator();
ProjectRootNode prn = pto.getProjectRootNode(DATA_PROJECT_NAME);
prn.select();
formnode = new Node(prn, "Source Packages|" + PACKAGE_NAME + "|" + FILE_NAME);
formnode.select();
log("Form node selected.");
EditAction editAction = new EditAction();
editAction.perform(formnode);
log("Source Editor window opened.");
OpenAction openAction = new OpenAction();
openAction.perform(formnode);
log("Form Editor window opened.");
// store all component names from the category in the Vector
Vector componentNames = new Vector();
ComponentPaletteOperator palette = new ComponentPaletteOperator();
JListOperator list = palette.selectPage(categoryName);
for (int i=0;i
|