8154381: SwingSet tests are not auto closed in jtreg
Reviewed-by: alexsch
This commit is contained in:
parent
07cef26155
commit
2ef07f57fa
@ -3,6 +3,6 @@ build.xml.script.CRC32=f902e8b8
|
||||
build.xml.stylesheet.CRC32=8064a381@1.75.2.48
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=55414227
|
||||
nbproject/build-impl.xml.data.CRC32=16caf60f
|
||||
nbproject/build-impl.xml.script.CRC32=c12f9d04
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48
|
||||
|
@ -76,4 +76,4 @@ source.encoding=UTF-8
|
||||
src.src.dir=..\\..\\..\\test\\sanity\\client\\SwingSet\\src
|
||||
src.src2.dir=..\\..\\..\\test\\sanity\\client\\lib\\SwingSet3\\src
|
||||
src.src3.dir=..\\..\\..\\test\\sanity\\client\\lib\\jemmy\\src
|
||||
src.src4.dir=..\\..\\..\\test\\sanity\\client\\lib\\Jemmy2Ext\\src
|
||||
src.src4.dir=..\\..\\..\\test\\sanity\\client\\lib\\Extensions\\src
|
||||
|
@ -6,7 +6,7 @@
|
||||
<name>SanityTests</name>
|
||||
<source-roots>
|
||||
<root id="src.src3.dir" name="lib\jemmy\src"/>
|
||||
<root id="src.src4.dir" name="lib\Jemmy2Ext\src"/>
|
||||
<root id="src.src4.dir" name="lib\Extensions\src"/>
|
||||
<root id="src.src2.dir" name="lib\SwingSet3\src"/>
|
||||
<root id="src.src.dir" name="SwingSet\src"/>
|
||||
</source-roots>
|
||||
|
@ -21,6 +21,8 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import com.sun.swingset3.demos.button.ButtonDemo;
|
||||
import org.jtregext.GuiTestListener;
|
||||
import java.awt.Point;
|
||||
import java.awt.Robot;
|
||||
import java.awt.event.InputEvent;
|
||||
@ -32,6 +34,7 @@ import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
import static org.jemmy2ext.JemmyExt.*;
|
||||
import org.testng.annotations.Test;
|
||||
import static com.sun.swingset3.demos.button.ButtonDemo.*;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -41,31 +44,30 @@ import static com.sun.swingset3.demos.button.ButtonDemo.*;
|
||||
* image is different from initial button image.
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.button.ButtonDemo
|
||||
* @run testng ButtonDemoScreenshotTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class ButtonDemoScreenshotTest {
|
||||
|
||||
private static final int BUTTON_COUNT = 6; // TODO: Decide about "open browser" buttons (value was 8 originally)
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
captureDebugInfoOnFail(() -> {
|
||||
Robot rob = new Robot();
|
||||
Robot rob = new Robot();
|
||||
|
||||
new ClassReference(com.sun.swingset3.demos.button.ButtonDemo.class.getCanonicalName()).startApplication();
|
||||
new ClassReference(ButtonDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
|
||||
waitImageIsStill(rob, mainFrame);
|
||||
JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
|
||||
waitImageIsStill(rob, mainFrame);
|
||||
|
||||
// Check all the buttons
|
||||
for (int i = 0; i < BUTTON_COUNT; i++) {
|
||||
checkButton(mainFrame, i, rob);
|
||||
}
|
||||
});
|
||||
// Check all the buttons
|
||||
for (int i = 0; i < BUTTON_COUNT; i++) {
|
||||
checkButton(mainFrame, i, rob);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkButton(JFrameOperator jfo, int i, Robot rob) {
|
||||
|
@ -21,6 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.JHyperlink;
|
||||
import com.sun.swingset3.demos.button.ButtonDemo;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
@ -38,7 +39,7 @@ import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
import static com.sun.swingset3.demos.button.ButtonDemo.*;
|
||||
import org.jemmy2ext.JemmyExt;
|
||||
import org.jemmy2ext.JemmyExt.MultiThreadedTryCatch;
|
||||
import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -48,12 +49,13 @@ import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
* on buttons before and after click.
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.button.ButtonDemo
|
||||
* @run testng ButtonDemoTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class ButtonDemoTest {
|
||||
|
||||
private static final String[] BUTTON_TEXT_AFTER = {
|
||||
@ -92,34 +94,30 @@ public class ButtonDemoTest {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
|
||||
captureDebugInfoOnFail(() -> {
|
||||
new ClassReference(ButtonDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
new ClassReference(ButtonDemo.class.getCanonicalName()).startApplication();
|
||||
JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
|
||||
mainFrame.setComparator(EXACT_STRING_COMPARATOR);
|
||||
|
||||
JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
|
||||
mainFrame.setComparator(EXACT_STRING_COMPARATOR);
|
||||
// Check all the buttons
|
||||
for (int i = 0; i < BUTTON_TOOLTIP.length; i++) {
|
||||
String tooltip = BUTTON_TOOLTIP[i];
|
||||
|
||||
// Check all the buttons
|
||||
for (int i = 0; i < BUTTON_TOOLTIP.length; i++) {
|
||||
String tooltip = BUTTON_TOOLTIP[i];
|
||||
JButtonOperator button = new JButtonOperator(mainFrame, new ByToolTipChooser(tooltip));
|
||||
|
||||
JButtonOperator button = new JButtonOperator(mainFrame, new ByToolTipChooser(tooltip));
|
||||
assertEquals(BUTTON_TEXT_BEFORE[i], button.getText());
|
||||
|
||||
assertEquals(BUTTON_TEXT_BEFORE[i], button.getText());
|
||||
|
||||
// Two buttons are hyperlinks, we don't want to click them
|
||||
if (!button.getSource().getClass().equals(JHyperlink.class)) {
|
||||
checkButton(button);
|
||||
}
|
||||
|
||||
if (BUTTON_TEXT_AFTER.length > i) {
|
||||
assertEquals(BUTTON_TEXT_AFTER[i], button.getText());
|
||||
} else {
|
||||
assertEquals(BUTTON_TEXT_BEFORE[i], button.getText());
|
||||
}
|
||||
// Two buttons are hyperlinks, we don't want to click them
|
||||
if (!button.getSource().getClass().equals(JHyperlink.class)) {
|
||||
checkButton(button);
|
||||
}
|
||||
|
||||
});
|
||||
if (BUTTON_TEXT_AFTER.length > i) {
|
||||
assertEquals(BUTTON_TEXT_AFTER[i], button.getText());
|
||||
} else {
|
||||
assertEquals(BUTTON_TEXT_BEFORE[i], button.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkButton(JButtonOperator button) throws Exception {
|
||||
|
@ -21,6 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.combobox.ComboBoxDemo;
|
||||
import static org.testng.AssertJUnit.*;
|
||||
import org.testng.annotations.Test;
|
||||
@ -28,7 +29,7 @@ import org.netbeans.jemmy.ClassReference;
|
||||
import org.netbeans.jemmy.operators.JComboBoxOperator;
|
||||
import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
import static com.sun.swingset3.demos.combobox.ComboBoxDemo.*;
|
||||
import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -37,12 +38,13 @@ import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
* each value of each ComboBox.
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.combobox.ComboBoxDemo
|
||||
* @run testng ComboBoxDemoTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class ComboBoxDemoTest {
|
||||
|
||||
private static enum ComboBoxInfo {
|
||||
@ -61,14 +63,13 @@ public class ComboBoxDemoTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
captureDebugInfoOnFail(() -> {
|
||||
new ClassReference(ComboBoxDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
for (ComboBoxInfo comboBoxInfo : ComboBoxInfo.values()) {
|
||||
comboBoxChecker(frame, comboBoxInfo);
|
||||
}
|
||||
});
|
||||
new ClassReference(ComboBoxDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
for (ComboBoxInfo comboBoxInfo : ComboBoxInfo.values()) {
|
||||
comboBoxChecker(frame, comboBoxInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBoxChecker(JFrameOperator jfo, ComboBoxInfo comboBoxInfo) {
|
||||
|
@ -21,6 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.list.ListDemo;
|
||||
import static com.sun.swingset3.demos.list.ListDemo.DEMO_TITLE;
|
||||
import static org.testng.AssertJUnit.*;
|
||||
@ -30,7 +31,7 @@ import org.netbeans.jemmy.ClassReference;
|
||||
import org.netbeans.jemmy.operators.JCheckBoxOperator;
|
||||
import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
import org.netbeans.jemmy.operators.JListOperator;
|
||||
import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -40,64 +41,64 @@ import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
* list.
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.list.ListDemo
|
||||
* @run testng ListDemoTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class ListDemoTest {
|
||||
|
||||
private static final int CHECKBOX_COUNT = 50;
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
captureDebugInfoOnFail(() -> {
|
||||
new ClassReference(ListDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
JListOperator listOp = new JListOperator(frame);
|
||||
new ClassReference(ListDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
// Check *NO* Prefix and Suffixes Marked
|
||||
for (int i = 0; i < CHECKBOX_COUNT; i++) {
|
||||
JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
JListOperator listOp = new JListOperator(frame);
|
||||
|
||||
// Check *NO* Prefix and Suffixes Marked
|
||||
for (int i = 0; i < CHECKBOX_COUNT; i++) {
|
||||
JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
|
||||
checkBox.changeSelection(false);
|
||||
}
|
||||
System.out.println("######## Number of Items = " + listOp.getModel().getSize());
|
||||
assertEquals("Select None number of items is correct", 0, listOp.getModel().getSize());
|
||||
|
||||
// Check *ALL* Prefix and Suffixes Marked
|
||||
for (int i = 0; i < CHECKBOX_COUNT; i++) {
|
||||
JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
|
||||
checkBox.changeSelection(true);
|
||||
}
|
||||
System.out.println("######## Number of Items = " + listOp.getModel().getSize());
|
||||
assertEquals("Select All number of items is correct", CHECKBOX_COUNT / 2 * CHECKBOX_COUNT / 2, listOp.getModel().getSize());
|
||||
|
||||
// Check *ALL* Prefix and *NO* Suffixes Marked
|
||||
for (int i = 0; i < CHECKBOX_COUNT; i++) {
|
||||
JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
|
||||
if (i < CHECKBOX_COUNT / 2) {
|
||||
checkBox.changeSelection(true);
|
||||
} else {
|
||||
checkBox.changeSelection(false);
|
||||
}
|
||||
System.out.println("######## Number of Items = " + listOp.getModel().getSize());
|
||||
assertEquals("Select None number of items is correct", 0, listOp.getModel().getSize());
|
||||
}
|
||||
System.out.println("######## Number of Items = " + listOp.getModel().getSize());
|
||||
assertEquals("Select All Prefixes and NO Suffixes number of items is correct", 0, listOp.getModel().getSize());
|
||||
|
||||
// Check *ALL* Prefix and Suffixes Marked
|
||||
for (int i = 0; i < CHECKBOX_COUNT; i++) {
|
||||
JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
|
||||
// Check *NO* Prefix and *ALL* Suffixes Marked
|
||||
for (int i = 0; i < CHECKBOX_COUNT; i++) {
|
||||
JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
|
||||
if (i < CHECKBOX_COUNT / 2) {
|
||||
checkBox.changeSelection(false);
|
||||
} else {
|
||||
checkBox.changeSelection(true);
|
||||
}
|
||||
System.out.println("######## Number of Items = " + listOp.getModel().getSize());
|
||||
assertEquals("Select All number of items is correct", CHECKBOX_COUNT / 2 * CHECKBOX_COUNT / 2, listOp.getModel().getSize());
|
||||
|
||||
// Check *ALL* Prefix and *NO* Suffixes Marked
|
||||
for (int i = 0; i < CHECKBOX_COUNT; i++) {
|
||||
JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
|
||||
if (i < CHECKBOX_COUNT / 2) {
|
||||
checkBox.changeSelection(true);
|
||||
} else {
|
||||
checkBox.changeSelection(false);
|
||||
}
|
||||
}
|
||||
System.out.println("######## Number of Items = " + listOp.getModel().getSize());
|
||||
assertEquals("Select All Prefixes and NO Suffixes number of items is correct", 0, listOp.getModel().getSize());
|
||||
|
||||
// Check *NO* Prefix and *ALL* Suffixes Marked
|
||||
for (int i = 0; i < CHECKBOX_COUNT; i++) {
|
||||
JCheckBoxOperator checkBox = getJCheckBoxOperator(frame, i);
|
||||
if (i < CHECKBOX_COUNT / 2) {
|
||||
checkBox.changeSelection(false);
|
||||
} else {
|
||||
checkBox.changeSelection(true);
|
||||
}
|
||||
}
|
||||
System.out.println("######## Number of Items = " + listOp.getModel().getSize());
|
||||
assertEquals("Select NO Prefixes and All Suffixes number of items is correct", 0, listOp.getModel().getSize());
|
||||
});
|
||||
}
|
||||
System.out.println("######## Number of Items = " + listOp.getModel().getSize());
|
||||
assertEquals("Select NO Prefixes and All Suffixes number of items is correct", 0, listOp.getModel().getSize());
|
||||
}
|
||||
|
||||
private JCheckBoxOperator getJCheckBoxOperator(JFrameOperator frame, int index) {
|
||||
|
@ -21,10 +21,10 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.optionpane.OptionPaneDemo;
|
||||
import static com.sun.swingset3.demos.optionpane.OptionPaneDemo.*;
|
||||
import javax.swing.UIManager;
|
||||
import static org.jemmy2ext.JemmyExt.*;
|
||||
import static org.testng.AssertJUnit.*;
|
||||
import org.testng.annotations.Test;
|
||||
import org.netbeans.jemmy.ClassReference;
|
||||
@ -34,6 +34,7 @@ import org.netbeans.jemmy.operators.JDialogOperator;
|
||||
import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
import org.netbeans.jemmy.operators.JLabelOperator;
|
||||
import org.netbeans.jemmy.operators.JTextFieldOperator;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
|
||||
/*
|
||||
@ -43,12 +44,13 @@ import org.netbeans.jemmy.operators.JTextFieldOperator;
|
||||
* and choosing different options in them.
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.optionpane.OptionPaneDemo
|
||||
* @run testng OptionPaneDemoTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class OptionPaneDemoTest {
|
||||
|
||||
public static final String SOME_TEXT_TO_TYPE = "I am some text";
|
||||
@ -59,21 +61,20 @@ public class OptionPaneDemoTest {
|
||||
public static final String TEXT_TO_TYPE = "Hooray! I'm a textField";
|
||||
public static final String NO = "No";
|
||||
public static final String YES = "Yes";
|
||||
public static final String SELECT_AN__OPTION = UIManager.getString("OptionPane.titleText");
|
||||
public static final String SELECT_AN_OPTION = UIManager.getString("OptionPane.titleText");
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
captureDebugInfoOnFail(() -> {
|
||||
new ClassReference(OptionPaneDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
new ClassReference(OptionPaneDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
showInputDialog(frame);
|
||||
showWarningDialog(frame);
|
||||
showMessageDialog(frame);
|
||||
showComponentDialog(frame);
|
||||
showConfirmationDialog(frame);
|
||||
});
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
|
||||
showInputDialog(frame);
|
||||
showWarningDialog(frame);
|
||||
showMessageDialog(frame);
|
||||
showComponentDialog(frame);
|
||||
showConfirmationDialog(frame);
|
||||
}
|
||||
|
||||
public void showInputDialog(JFrameOperator jfo) throws Exception {
|
||||
@ -286,7 +287,7 @@ public class OptionPaneDemoTest {
|
||||
{
|
||||
new JButtonOperator(jfo, CONFIRM_BUTTON).pushNoBlock();
|
||||
|
||||
JDialogOperator jdo = new JDialogOperator(SELECT_AN__OPTION);
|
||||
JDialogOperator jdo = new JDialogOperator(SELECT_AN_OPTION);
|
||||
new JButtonOperator(jdo, YES).pushNoBlock();
|
||||
|
||||
JDialogOperator jdo1 = new JDialogOperator(MESSAGE);
|
||||
@ -306,7 +307,7 @@ public class OptionPaneDemoTest {
|
||||
{
|
||||
new JButtonOperator(jfo, CONFIRM_BUTTON).pushNoBlock();
|
||||
|
||||
JDialogOperator jdo = new JDialogOperator(SELECT_AN__OPTION);
|
||||
JDialogOperator jdo = new JDialogOperator(SELECT_AN_OPTION);
|
||||
new JButtonOperator(jdo, NO).pushNoBlock();
|
||||
|
||||
JDialogOperator jdo1 = new JDialogOperator(MESSAGE);
|
||||
@ -326,7 +327,7 @@ public class OptionPaneDemoTest {
|
||||
{
|
||||
new JButtonOperator(jfo, CONFIRM_BUTTON).pushNoBlock();
|
||||
|
||||
JDialogOperator jdo = new JDialogOperator(SELECT_AN__OPTION);
|
||||
JDialogOperator jdo = new JDialogOperator(SELECT_AN_OPTION);
|
||||
|
||||
assertTrue("Show Confirmation Dialog Cancel Option", jdo.isShowing());
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.progressbar.ProgressBarDemo;
|
||||
import static com.sun.swingset3.demos.progressbar.ProgressBarDemo.*;
|
||||
import java.awt.Component;
|
||||
@ -31,7 +32,7 @@ import org.netbeans.jemmy.ComponentChooser;
|
||||
import org.netbeans.jemmy.operators.JButtonOperator;
|
||||
import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
import org.netbeans.jemmy.operators.JProgressBarOperator;
|
||||
import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -40,31 +41,31 @@ import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
* buttons and checking the progress bar and the buttons state.
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.progressbar.ProgressBarDemo
|
||||
* @run testng ProgressBarDemoTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class ProgressBarDemoTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
captureDebugInfoOnFail(() -> {
|
||||
new ClassReference(ProgressBarDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
new ClassReference(ProgressBarDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JButtonOperator startButton = new JButtonOperator(frame, START_BUTTON);
|
||||
JButtonOperator stopButton = new JButtonOperator(frame, STOP_BUTTON);
|
||||
JProgressBarOperator jpbo = new JProgressBarOperator(frame);
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
|
||||
// Check that progress completes and corect enable/disable of start/stop buttons
|
||||
checkCompleteProgress(frame, startButton, stopButton, jpbo);
|
||||
JButtonOperator startButton = new JButtonOperator(frame, START_BUTTON);
|
||||
JButtonOperator stopButton = new JButtonOperator(frame, STOP_BUTTON);
|
||||
JProgressBarOperator jpbo = new JProgressBarOperator(frame);
|
||||
|
||||
// Check progess bar progression and start/stop button disabled/enabled states
|
||||
checkStartStop(frame, startButton, stopButton, jpbo);
|
||||
});
|
||||
// Check that progress completes and corect enable/disable of start/stop buttons
|
||||
checkCompleteProgress(frame, startButton, stopButton, jpbo);
|
||||
|
||||
// Check progess bar progression and start/stop button disabled/enabled states
|
||||
checkStartStop(frame, startButton, stopButton, jpbo);
|
||||
}
|
||||
|
||||
// Check that progress completes and corect enable/disable of start/stop buttons
|
||||
|
@ -21,6 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.scrollpane.ScrollPaneDemo;
|
||||
import static com.sun.swingset3.demos.scrollpane.ScrollPaneDemo.DEMO_TITLE;
|
||||
import static org.testng.AssertJUnit.*;
|
||||
@ -28,7 +29,7 @@ import org.testng.annotations.Test;
|
||||
import org.netbeans.jemmy.ClassReference;
|
||||
import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
import org.netbeans.jemmy.operators.JScrollPaneOperator;
|
||||
import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -37,73 +38,73 @@ import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
* to left and to right and checking scroll bar values.
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.scrollpane.ScrollPaneDemo
|
||||
* @run testng ScrollPaneDemoTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class ScrollPaneDemoTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
captureDebugInfoOnFail(() -> {
|
||||
new ClassReference(ScrollPaneDemo.class.getName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
JScrollPaneOperator jspo = new JScrollPaneOperator(frame);
|
||||
new ClassReference(ScrollPaneDemo.class.getName()).startApplication();
|
||||
|
||||
// Set initial scrollbar positions
|
||||
int initialVerticalValue = jspo.getVerticalScrollBar().getValue();
|
||||
int initialHorizontalValue = jspo.getHorizontalScrollBar().getValue();
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
JScrollPaneOperator jspo = new JScrollPaneOperator(frame);
|
||||
|
||||
System.out.println("Initial Vertical Value = " + jspo.getVerticalScrollBar().getValue());
|
||||
System.out.println("Initial HoriZontal Value = " + jspo.getHorizontalScrollBar().getValue());
|
||||
// Set initial scrollbar positions
|
||||
int initialVerticalValue = jspo.getVerticalScrollBar().getValue();
|
||||
int initialHorizontalValue = jspo.getHorizontalScrollBar().getValue();
|
||||
|
||||
// Check scroll to Bottom
|
||||
{
|
||||
jspo.scrollToBottom();
|
||||
int currentValue = jspo.getVerticalScrollBar().getValue();
|
||||
System.out.println("Final Value = " + currentValue);
|
||||
assertTrue("Scroll to Bottom of Pane "
|
||||
+ "(initialVerticalValue, actual value: " + initialVerticalValue + " "
|
||||
+ "< currentValue, actual value = " + currentValue + ")",
|
||||
initialVerticalValue < currentValue);
|
||||
}
|
||||
System.out.println("Initial Vertical Value = " + jspo.getVerticalScrollBar().getValue());
|
||||
System.out.println("Initial HoriZontal Value = " + jspo.getHorizontalScrollBar().getValue());
|
||||
|
||||
// Check scroll to Top
|
||||
{
|
||||
jspo.scrollToTop();
|
||||
int currentValue = jspo.getVerticalScrollBar().getValue();
|
||||
System.out.println("Top Scroll Final Value = " + currentValue);
|
||||
assertTrue("Scroll to Top of Pane "
|
||||
+ "(initialVerticalValue, actual value: " + initialVerticalValue + " "
|
||||
+ "> currentValue, actual value = " + currentValue + ")",
|
||||
initialVerticalValue > currentValue);
|
||||
}
|
||||
// Check scroll to Bottom
|
||||
{
|
||||
jspo.scrollToBottom();
|
||||
int currentValue = jspo.getVerticalScrollBar().getValue();
|
||||
System.out.println("Final Value = " + currentValue);
|
||||
assertTrue("Scroll to Bottom of Pane "
|
||||
+ "(initialVerticalValue, actual value: " + initialVerticalValue + " "
|
||||
+ "< currentValue, actual value = " + currentValue + ")",
|
||||
initialVerticalValue < currentValue);
|
||||
}
|
||||
|
||||
// Check scroll to Left
|
||||
{
|
||||
jspo.scrollToLeft();
|
||||
int currentValue = jspo.getHorizontalScrollBar().getValue();
|
||||
System.out.println("Scroll to Left Final Value = " + currentValue);
|
||||
assertTrue("Scroll to Left of Pane "
|
||||
+ "(initialHorizontalValue, actual value: " + initialHorizontalValue + " "
|
||||
+ "> currentValue, actual value = " + currentValue + ")",
|
||||
initialHorizontalValue > currentValue);
|
||||
}
|
||||
// Check scroll to Top
|
||||
{
|
||||
jspo.scrollToTop();
|
||||
int currentValue = jspo.getVerticalScrollBar().getValue();
|
||||
System.out.println("Top Scroll Final Value = " + currentValue);
|
||||
assertTrue("Scroll to Top of Pane "
|
||||
+ "(initialVerticalValue, actual value: " + initialVerticalValue + " "
|
||||
+ "> currentValue, actual value = " + currentValue + ")",
|
||||
initialVerticalValue > currentValue);
|
||||
}
|
||||
|
||||
// Check scroll to Right
|
||||
{
|
||||
jspo.scrollToRight();
|
||||
int currentValue = jspo.getHorizontalScrollBar().getValue();
|
||||
System.out.println("Scroll to Right Final Value = " + currentValue);
|
||||
assertTrue("Scroll to Right of Pane "
|
||||
+ "(initialHorizontalValue, actual value: " + initialHorizontalValue + " "
|
||||
+ "< currentValue, actual value = " + currentValue + ")",
|
||||
initialHorizontalValue < currentValue);
|
||||
}
|
||||
});
|
||||
// Check scroll to Left
|
||||
{
|
||||
jspo.scrollToLeft();
|
||||
int currentValue = jspo.getHorizontalScrollBar().getValue();
|
||||
System.out.println("Scroll to Left Final Value = " + currentValue);
|
||||
assertTrue("Scroll to Left of Pane "
|
||||
+ "(initialHorizontalValue, actual value: " + initialHorizontalValue + " "
|
||||
+ "> currentValue, actual value = " + currentValue + ")",
|
||||
initialHorizontalValue > currentValue);
|
||||
}
|
||||
|
||||
// Check scroll to Right
|
||||
{
|
||||
jspo.scrollToRight();
|
||||
int currentValue = jspo.getHorizontalScrollBar().getValue();
|
||||
System.out.println("Scroll to Right Final Value = " + currentValue);
|
||||
assertTrue("Scroll to Right of Pane "
|
||||
+ "(initialHorizontalValue, actual value: " + initialHorizontalValue + " "
|
||||
+ "< currentValue, actual value = " + currentValue + ")",
|
||||
initialHorizontalValue < currentValue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.spinner.SpinnerDemo;
|
||||
import static com.sun.swingset3.demos.spinner.SpinnerDemo.DEMO_TITLE;
|
||||
import java.text.DecimalFormat;
|
||||
@ -30,7 +31,7 @@ import org.netbeans.jemmy.ClassReference;
|
||||
import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
import org.netbeans.jemmy.operators.JSpinnerOperator;
|
||||
import org.netbeans.jemmy.operators.JTextFieldOperator;
|
||||
import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -39,12 +40,13 @@ import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
* the spinner button and checking text field value.
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.spinner.SpinnerDemo
|
||||
* @run testng SpinnerDemoTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class SpinnerDemoTest {
|
||||
|
||||
private static final int SPINNERS_COUNT = 9;
|
||||
@ -52,16 +54,14 @@ public class SpinnerDemoTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
captureDebugInfoOnFail(() -> {
|
||||
new ClassReference(SpinnerDemo.class.getCanonicalName()).startApplication();
|
||||
new ClassReference(SpinnerDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
|
||||
// Check changing different spinners
|
||||
for (int i = 0; i < SPINNERS_COUNT; i++) {
|
||||
changeValues(frame, i);
|
||||
}
|
||||
});
|
||||
// Check changing different spinners
|
||||
for (int i = 0; i < SPINNERS_COUNT; i++) {
|
||||
changeValues(frame, i);
|
||||
}
|
||||
}
|
||||
|
||||
private void changeValues(JFrameOperator jfo, int spinnerIndex) throws Exception {
|
||||
|
@ -21,6 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.splitpane.SplitPaneDemo;
|
||||
import static com.sun.swingset3.demos.splitpane.SplitPaneDemo.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
@ -35,6 +36,7 @@ import org.netbeans.jemmy.operators.JRadioButtonOperator;
|
||||
import org.netbeans.jemmy.operators.JSplitPaneOperator;
|
||||
import org.netbeans.jemmy.operators.JTextFieldOperator;
|
||||
import static org.jemmy2ext.JemmyExt.*;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -44,39 +46,39 @@ import static org.jemmy2ext.JemmyExt.*;
|
||||
* and changing the divider orientation.
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.splitpane.SplitPaneDemo
|
||||
* @run testng SplitPaneDemoTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class SplitPaneDemoTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
captureDebugInfoOnFail(() -> {
|
||||
new ClassReference(SplitPaneDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
new ClassReference(SplitPaneDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JSplitPaneOperator splitPane = new JSplitPaneOperator(frame);
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
|
||||
// Toggle OneTouch Expandable
|
||||
checkOneTouch(frame, splitPane, true);
|
||||
checkOneTouch(frame, splitPane, false);
|
||||
JSplitPaneOperator splitPane = new JSplitPaneOperator(frame);
|
||||
|
||||
// Check changing divider size to minimum and maximum values
|
||||
changeDividerSize(frame, splitPane, 50);
|
||||
changeDividerSize(frame, splitPane, 6);
|
||||
// Toggle OneTouch Expandable
|
||||
checkOneTouch(frame, splitPane, true);
|
||||
checkOneTouch(frame, splitPane, false);
|
||||
|
||||
// Check moving the divider
|
||||
checkDividerMoves(frame, splitPane, false);
|
||||
checkDividerMoves(frame, splitPane, true);
|
||||
// Check changing divider size to minimum and maximum values
|
||||
changeDividerSize(frame, splitPane, 50);
|
||||
changeDividerSize(frame, splitPane, 6);
|
||||
|
||||
// Check different minumum Day/Night sizes
|
||||
changeMinimumSizes(frame, splitPane, 100);
|
||||
changeMinimumSizes(frame, splitPane, 0);
|
||||
});
|
||||
// Check moving the divider
|
||||
checkDividerMoves(frame, splitPane, false);
|
||||
checkDividerMoves(frame, splitPane, true);
|
||||
|
||||
// Check different minumum Day/Night sizes
|
||||
changeMinimumSizes(frame, splitPane, 100);
|
||||
changeMinimumSizes(frame, splitPane, 0);
|
||||
}
|
||||
|
||||
// Check for different day and night minimum size
|
||||
|
@ -21,6 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.tabbedpane.TabbedPaneDemo;
|
||||
import static com.sun.swingset3.demos.tabbedpane.TabbedPaneDemo.*;
|
||||
import static org.jemmy2ext.JemmyExt.getLabeledContainerOperator;
|
||||
@ -31,7 +32,7 @@ import org.netbeans.jemmy.operators.ContainerOperator;
|
||||
import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
import org.netbeans.jemmy.operators.JRadioButtonOperator;
|
||||
import org.netbeans.jemmy.operators.JTabbedPaneOperator;
|
||||
import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -40,25 +41,24 @@ import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
* positions, opening each tab and verifying the the tab gets selected.
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.tabbedpane.TabbedPaneDemo
|
||||
* @run testng TabbedPaneDemoTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class TabbedPaneDemoTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
captureDebugInfoOnFail(() -> {
|
||||
new ClassReference(TabbedPaneDemo.class.getCanonicalName()).startApplication();
|
||||
new ClassReference(TabbedPaneDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
|
||||
JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
|
||||
|
||||
for (String tp : new String[]{TOP, LEFT, BOTTOM, RIGHT}) {
|
||||
testTabs(mainFrame, tp);
|
||||
}
|
||||
});
|
||||
for (String tp : new String[]{TOP, LEFT, BOTTOM, RIGHT}) {
|
||||
testTabs(mainFrame, tp);
|
||||
}
|
||||
}
|
||||
|
||||
public void testTabs(JFrameOperator mainFrame, String tabPlacement) throws Exception {
|
||||
|
@ -21,6 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.textfield.JHistoryTextField;
|
||||
import com.sun.swingset3.demos.textfield.TextFieldDemo;
|
||||
import static com.sun.swingset3.demos.textfield.TextFieldDemo.*;
|
||||
@ -41,6 +42,7 @@ import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
import org.netbeans.jemmy.operators.JLabelOperator;
|
||||
import org.netbeans.jemmy.operators.JPasswordFieldOperator;
|
||||
import org.netbeans.jemmy.operators.JTextFieldOperator;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -49,25 +51,25 @@ import org.netbeans.jemmy.operators.JTextFieldOperator;
|
||||
* checking that app reacts accordingly.
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.textfield.TextFieldDemo
|
||||
* @run testng TextFieldDemoTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class TextFieldDemoTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
captureDebugInfoOnFail(() -> {
|
||||
new ClassReference(TextFieldDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
new ClassReference(TextFieldDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
historyTextField(frame);
|
||||
dateTextField(frame);
|
||||
passwordField(frame);
|
||||
});
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
|
||||
historyTextField(frame);
|
||||
dateTextField(frame);
|
||||
passwordField(frame);
|
||||
}
|
||||
|
||||
private void historyTextField(JFrameOperator jfo) throws Exception {
|
||||
|
@ -21,6 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.DemoProperties;
|
||||
import com.sun.swingset3.demos.togglebutton.DirectionPanel;
|
||||
import com.sun.swingset3.demos.togglebutton.LayoutControlPanel;
|
||||
@ -40,7 +41,7 @@ import org.netbeans.jemmy.operators.JCheckBoxOperator;
|
||||
import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
import org.netbeans.jemmy.operators.JRadioButtonOperator;
|
||||
import org.netbeans.jemmy.operators.JTabbedPaneOperator;
|
||||
import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -53,50 +54,49 @@ import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
* selected.
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.togglebutton.ToggleButtonDemo
|
||||
* @run testng ToggleButtonDemoTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class ToggleButtonDemoTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
captureDebugInfoOnFail(() -> {
|
||||
new ClassReference(ToggleButtonDemo.class.getCanonicalName()).startApplication();
|
||||
new ClassReference(ToggleButtonDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator mainFrame = new JFrameOperator(ToggleButtonDemo.class.getAnnotation(DemoProperties.class).value());
|
||||
JTabbedPaneOperator tabPane = new JTabbedPaneOperator(mainFrame);
|
||||
JFrameOperator mainFrame = new JFrameOperator(ToggleButtonDemo.class.getAnnotation(DemoProperties.class).value());
|
||||
JTabbedPaneOperator tabPane = new JTabbedPaneOperator(mainFrame);
|
||||
|
||||
// Radio Button Toggles
|
||||
testRadioButtons(getBorderTitledJPanelOperator(mainFrame, TEXT_RADIO_BUTTONS), 3, null);
|
||||
testRadioButtons(getBorderTitledJPanelOperator(mainFrame, IMAGE_RADIO_BUTTONS), 3, null);
|
||||
testRadioButtons(getLabeledContainerOperator(mainFrame, PAD_AMOUNT), 3, (t, i) -> DEFAULT.equals(t));
|
||||
// Radio Button Toggles
|
||||
testRadioButtons(getBorderTitledJPanelOperator(mainFrame, TEXT_RADIO_BUTTONS), 3, null);
|
||||
testRadioButtons(getBorderTitledJPanelOperator(mainFrame, IMAGE_RADIO_BUTTONS), 3, null);
|
||||
testRadioButtons(getLabeledContainerOperator(mainFrame, PAD_AMOUNT), 3, (t, i) -> DEFAULT.equals(t));
|
||||
|
||||
// switch to the Check Boxes Tab
|
||||
tabPane.selectPage(CHECK_BOXES);
|
||||
// switch to the Check Boxes Tab
|
||||
tabPane.selectPage(CHECK_BOXES);
|
||||
|
||||
// Check Box Toggles
|
||||
ContainerOperator<?> textCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, TEXT_CHECKBOXES);
|
||||
testCheckBox(textCheckBoxesJPanel, CHECK1, false);
|
||||
testCheckBox(textCheckBoxesJPanel, CHECK2, false);
|
||||
testCheckBox(textCheckBoxesJPanel, CHECK3, false);
|
||||
// Check Box Toggles
|
||||
ContainerOperator<?> textCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, TEXT_CHECKBOXES);
|
||||
testCheckBox(textCheckBoxesJPanel, CHECK1, false);
|
||||
testCheckBox(textCheckBoxesJPanel, CHECK2, false);
|
||||
testCheckBox(textCheckBoxesJPanel, CHECK3, false);
|
||||
|
||||
ContainerOperator<?> imageCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, IMAGE_CHECKBOXES);
|
||||
testCheckBox(imageCheckBoxesJPanel, CHECK1, false);
|
||||
testCheckBox(imageCheckBoxesJPanel, CHECK2, false);
|
||||
testCheckBox(imageCheckBoxesJPanel, CHECK3, false);
|
||||
ContainerOperator<?> imageCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, IMAGE_CHECKBOXES);
|
||||
testCheckBox(imageCheckBoxesJPanel, CHECK1, false);
|
||||
testCheckBox(imageCheckBoxesJPanel, CHECK2, false);
|
||||
testCheckBox(imageCheckBoxesJPanel, CHECK3, false);
|
||||
|
||||
ContainerOperator<?> displayOptionsContainer = getLabeledContainerOperator(mainFrame, DISPLAY_OPTIONS);
|
||||
testCheckBox(displayOptionsContainer, PAINT_BORDER, false);
|
||||
testCheckBox(displayOptionsContainer, PAINT_FOCUS, true);
|
||||
testCheckBox(displayOptionsContainer, ENABLED, true);
|
||||
testCheckBox(displayOptionsContainer, CONTENT_FILLED, true);
|
||||
ContainerOperator<?> displayOptionsContainer = getLabeledContainerOperator(mainFrame, DISPLAY_OPTIONS);
|
||||
testCheckBox(displayOptionsContainer, PAINT_BORDER, false);
|
||||
testCheckBox(displayOptionsContainer, PAINT_FOCUS, true);
|
||||
testCheckBox(displayOptionsContainer, ENABLED, true);
|
||||
testCheckBox(displayOptionsContainer, CONTENT_FILLED, true);
|
||||
|
||||
// Direction Button Toggles
|
||||
testToggleButtons(mainFrame);
|
||||
});
|
||||
// Direction Button Toggles
|
||||
testToggleButtons(mainFrame);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,6 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.tree.TreeDemo;
|
||||
import static com.sun.swingset3.demos.tree.TreeDemo.DEMO_TITLE;
|
||||
import javax.swing.tree.TreePath;
|
||||
@ -29,7 +30,7 @@ import org.testng.annotations.Test;
|
||||
import org.netbeans.jemmy.ClassReference;
|
||||
import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
import org.netbeans.jemmy.operators.JTreeOperator;
|
||||
import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -42,67 +43,67 @@ import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail;
|
||||
* vertically (as ScrollPane allows it).
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.tree.TreeDemo
|
||||
* @run testng TreeDemoTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class TreeDemoTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
captureDebugInfoOnFail(() -> {
|
||||
new ClassReference(TreeDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
new ClassReference(TreeDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JTreeOperator tree = new JTreeOperator(frame);
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
|
||||
assertEquals("Initial number of rows in the tree", 4, tree.getRowCount());
|
||||
JTreeOperator tree = new JTreeOperator(frame);
|
||||
|
||||
int initialTreeHeight = tree.getHeight();
|
||||
assertEquals("Initial number of rows in the tree", 4, tree.getRowCount());
|
||||
|
||||
// expand all nodes
|
||||
int expandsCount = 0;
|
||||
for (int i = 0; i < tree.getRowCount(); i++) {
|
||||
TreePath tp = tree.getPathForRow(i);
|
||||
if (tree.getChildCount(tp) > 0 && !tree.isExpanded(tp)) {
|
||||
tree.expandRow(i);
|
||||
expandsCount++;
|
||||
}
|
||||
int initialTreeHeight = tree.getHeight();
|
||||
|
||||
// expand all nodes
|
||||
int expandsCount = 0;
|
||||
for (int i = 0; i < tree.getRowCount(); i++) {
|
||||
TreePath tp = tree.getPathForRow(i);
|
||||
if (tree.getChildCount(tp) > 0 && !tree.isExpanded(tp)) {
|
||||
tree.expandRow(i);
|
||||
expandsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
assertEquals("Number of rows expanded", 75, expandsCount);
|
||||
assertEquals("Number of rows in the tree after expanding all of them",
|
||||
616, tree.getRowCount());
|
||||
assertEquals("Number of rows expanded", 75, expandsCount);
|
||||
assertEquals("Number of rows in the tree after expanding all of them",
|
||||
616, tree.getRowCount());
|
||||
|
||||
int expandedTreeHeight = tree.getHeight();
|
||||
assertTrue("Expanded tree height has increased, current "
|
||||
+ expandedTreeHeight + " > initial " + initialTreeHeight,
|
||||
expandedTreeHeight > initialTreeHeight);
|
||||
int expandedTreeHeight = tree.getHeight();
|
||||
assertTrue("Expanded tree height has increased, current "
|
||||
+ expandedTreeHeight + " > initial " + initialTreeHeight,
|
||||
expandedTreeHeight > initialTreeHeight);
|
||||
|
||||
// collapse all nodes
|
||||
int collapsesCount = 0;
|
||||
for (int i = tree.getRowCount() - 1; i >= 0; i--) {
|
||||
TreePath tp = tree.getPathForRow(i);
|
||||
if (tree.getChildCount(tp) > 0 && tree.isExpanded(tp)) {
|
||||
tree.collapseRow(i);
|
||||
collapsesCount++;
|
||||
}
|
||||
// collapse all nodes
|
||||
int collapsesCount = 0;
|
||||
for (int i = tree.getRowCount() - 1; i >= 0; i--) {
|
||||
TreePath tp = tree.getPathForRow(i);
|
||||
if (tree.getChildCount(tp) > 0 && tree.isExpanded(tp)) {
|
||||
tree.collapseRow(i);
|
||||
collapsesCount++;
|
||||
}
|
||||
}
|
||||
|
||||
assertEquals("Number of rows collapsed", 76, collapsesCount);
|
||||
assertEquals("Number of rows in the tree after collapsing all of them",
|
||||
1, tree.getRowCount());
|
||||
assertEquals("Number of rows collapsed", 76, collapsesCount);
|
||||
assertEquals("Number of rows in the tree after collapsing all of them",
|
||||
1, tree.getRowCount());
|
||||
|
||||
int collapsedTreeHeight = tree.getHeight();
|
||||
assertTrue("Collpased tree height is not longer than initial, "
|
||||
+ "current " + collapsedTreeHeight + " <= initial "
|
||||
+ initialTreeHeight,
|
||||
collapsedTreeHeight <= initialTreeHeight);
|
||||
int collapsedTreeHeight = tree.getHeight();
|
||||
assertTrue("Collpased tree height is not longer than initial, "
|
||||
+ "current " + collapsedTreeHeight + " <= initial "
|
||||
+ initialTreeHeight,
|
||||
collapsedTreeHeight <= initialTreeHeight);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.window.WindowDemo;
|
||||
import static com.sun.swingset3.demos.window.WindowDemo.*;
|
||||
import static org.jemmy2ext.JemmyExt.*;
|
||||
@ -31,6 +32,7 @@ import org.netbeans.jemmy.operators.JButtonOperator;
|
||||
import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
import org.netbeans.jemmy.operators.JLabelOperator;
|
||||
import org.netbeans.jemmy.operators.WindowOperator;
|
||||
import org.testng.annotations.Listeners;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -40,37 +42,37 @@ import org.netbeans.jemmy.operators.WindowOperator;
|
||||
* when the "Show JWindow..." button is clicked.
|
||||
*
|
||||
* @library /sanity/client/lib/jemmy/src
|
||||
* @library /sanity/client/lib/Jemmy2Ext/src
|
||||
* @library /sanity/client/lib/Extensions/src
|
||||
* @library /sanity/client/lib/SwingSet3/src
|
||||
* @build org.jemmy2ext.JemmyExt
|
||||
* @build com.sun.swingset3.demos.window.WindowDemo
|
||||
* @run testng WindowDemoTest
|
||||
*/
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class WindowDemoTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
captureDebugInfoOnFail(() -> {
|
||||
new ClassReference(WindowDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator();
|
||||
new ClassReference(WindowDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
assertEquals("Only one JWindow is shown", 1, getJWindowCount());
|
||||
JFrameOperator frame = new JFrameOperator();
|
||||
|
||||
WindowOperator window = new WindowOperator(getJWindow());
|
||||
assertEquals("Only one JWindow is shown", 1, getJWindowCount());
|
||||
|
||||
assertTrue("JFrame is showing", frame.isShowing());
|
||||
assertFalse("JFrame is not iconified", isIconified(frame));
|
||||
assertTrue("JWindow is showing", window.isShowing());
|
||||
WindowOperator window = new WindowOperator(getJWindow());
|
||||
|
||||
final String labelText = I_HAVE_NO_SYSTEM_BORDER;
|
||||
JLabelOperator jLabelOperator = new JLabelOperator(window, labelText);
|
||||
assertEquals("JWindow contains the label with corresponding text", labelText, jLabelOperator.getText());
|
||||
assertTrue("JFrame is showing", frame.isShowing());
|
||||
assertFalse("JFrame is not iconified", isIconified(frame));
|
||||
assertTrue("JWindow is showing", window.isShowing());
|
||||
|
||||
new JButtonOperator(frame, SHOW_J_WINDOW).push();
|
||||
final String labelText = I_HAVE_NO_SYSTEM_BORDER;
|
||||
JLabelOperator jLabelOperator = new JLabelOperator(window, labelText);
|
||||
assertEquals("JWindow contains the label with corresponding text", labelText, jLabelOperator.getText());
|
||||
|
||||
assertEquals("Only one JWindow is shown", 1, getJWindowCount());
|
||||
});
|
||||
new JButtonOperator(frame, SHOW_J_WINDOW).push();
|
||||
|
||||
assertEquals("Only one JWindow is shown", 1, getJWindowCount());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -258,20 +258,19 @@ public class JemmyExt {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps the test code so that in case of any failure as much information as
|
||||
* possible is captured
|
||||
*
|
||||
* @param r test code Runnable
|
||||
* @throws Exception whatever exception the test may throw
|
||||
* Dispose all AWT/Swing windows causing event thread to stop
|
||||
*/
|
||||
public static void captureDebugInfoOnFail(RunnableWithException r) throws Exception {
|
||||
// TODO: Remove this once https://bugs.openjdk.java.net/browse/JDK-8151671 is fixed
|
||||
public static void disposeAllWindows() {
|
||||
System.out.println("disposeAllWindows");
|
||||
try {
|
||||
r.run();
|
||||
System.out.println("TEST PASSED");
|
||||
} catch (Throwable t) {
|
||||
captureAll();
|
||||
throw t;
|
||||
EventQueue.invokeAndWait(() -> {
|
||||
Window[] windows = Window.getWindows();
|
||||
for (Window w : windows) {
|
||||
w.dispose();
|
||||
}
|
||||
});
|
||||
} catch (InterruptedException | InvocationTargetException ex) {
|
||||
Logger.getLogger(JemmyExt.class.getName()).log(Level.SEVERE, "Failed to dispose all windows", ex);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
package org.jtregext;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
import org.jemmy2ext.JemmyExt;
|
||||
import static org.jemmy2ext.JemmyExt.captureAll;
|
||||
import org.testng.ITestContext;
|
||||
import org.testng.ITestListener;
|
||||
import org.testng.ITestResult;
|
||||
|
||||
// TODO: Remove this once https://bugs.openjdk.java.net/browse/JDK-8151671 is fixed
|
||||
public class GuiTestListener implements ITestListener {
|
||||
|
||||
private void afterTest() {
|
||||
JemmyExt.disposeAllWindows();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestStart(ITestResult result) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestSuccess(ITestResult result) {
|
||||
System.out.println("TEST PASSED");
|
||||
afterTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestFailure(ITestResult result) {
|
||||
captureAll();
|
||||
afterTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestSkipped(ITestResult result) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(ITestContext context) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish(ITestContext context) {
|
||||
}
|
||||
|
||||
}
|
@ -204,7 +204,9 @@ public class TabbedPaneDemo extends JPanel implements ActionListener {
|
||||
}
|
||||
|
||||
public void go() {
|
||||
animator = new javax.swing.Timer(22 + 22 + 22, this);
|
||||
if (animator == null) {
|
||||
animator = new javax.swing.Timer(22 + 22 + 22, this);
|
||||
}
|
||||
animator.start();
|
||||
}
|
||||
|
||||
@ -246,7 +248,7 @@ public class TabbedPaneDemo extends JPanel implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (isVisible()) {
|
||||
if (isShowing()) {
|
||||
repaint();
|
||||
} else {
|
||||
animator.stop();
|
||||
|
Loading…
x
Reference in New Issue
Block a user