8210052: Enable testing for all the available look and feels in SwingSet3 demo tests
Reviewed-by: shurailine, serb
This commit is contained in:
parent
cd38b8562f
commit
4508402c6e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2018, 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
|
||||
@ -36,6 +36,7 @@ import java.awt.Component;
|
||||
import java.awt.Robot;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import static com.sun.swingset3.demos.button.ButtonDemo.DEMO_TITLE;
|
||||
import static org.jemmy2ext.JemmyExt.*;
|
||||
|
||||
@ -66,8 +67,9 @@ public class ButtonDemoScreenshotTest {
|
||||
sComparator = new StrictImageComparator();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
||||
public void test(String lookAndFeel) throws Exception {
|
||||
UIManager.setLookAndFeel(lookAndFeel);
|
||||
Robot rob = new Robot();
|
||||
|
||||
new ClassReference(ButtonDemo.class.getCanonicalName()).startApplication();
|
||||
@ -112,19 +114,22 @@ public class ButtonDemoScreenshotTest {
|
||||
assertNotBlack(pressedImage[0]);
|
||||
return !sComparator.compare(initialButtonImage, pressedImage[0]);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "Button with new image";
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
if(pressedImage[0] != null) save(pressedImage[0], "button" + i + "_pressed.png");
|
||||
if (pressedImage[0] != null) {
|
||||
save(pressedImage[0], "button" + i + "_pressed.png");
|
||||
}
|
||||
button.releaseMouse();
|
||||
//additional instrumentation for JDK-8198920. To be removed after the bug is fixed
|
||||
button.getOutput().printTrace("JDK-8198920: Button released at " + System.currentTimeMillis());
|
||||
try {
|
||||
button.waitState(comp -> actionListenerCalled.get());
|
||||
button.getOutput().printTrace("JDK-8198920: Action listener was called by " + System.currentTimeMillis());
|
||||
} catch(org.netbeans.jemmy.TimeoutExpiredException e) {
|
||||
} catch (org.netbeans.jemmy.TimeoutExpiredException e) {
|
||||
button.getOutput().printTrace("JDK-8198920: Action listener was not called by " + System.currentTimeMillis());
|
||||
}
|
||||
//end of instrumentation for JDK-8198920
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2018, 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
|
||||
@ -28,6 +28,7 @@ import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import javax.swing.ButtonModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import static org.testng.AssertJUnit.*;
|
||||
import org.testng.annotations.Test;
|
||||
@ -93,8 +94,9 @@ public class ButtonDemoTest {
|
||||
"isArmed = false, isEnabled = true, isPressed = false, isSelected = false"
|
||||
};
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
||||
public void test(String lookAndFeel) throws Exception {
|
||||
UIManager.setLookAndFeel(lookAndFeel);
|
||||
|
||||
new ClassReference(ButtonDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2018, 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
|
||||
@ -24,6 +24,7 @@
|
||||
import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.combobox.ComboBoxDemo;
|
||||
import static org.testng.AssertJUnit.*;
|
||||
import javax.swing.UIManager;
|
||||
import org.testng.annotations.Test;
|
||||
import org.netbeans.jemmy.ClassReference;
|
||||
import org.netbeans.jemmy.operators.JComboBoxOperator;
|
||||
@ -50,6 +51,7 @@ import org.testng.annotations.Listeners;
|
||||
public class ComboBoxDemoTest {
|
||||
|
||||
private static enum ComboBoxInfo {
|
||||
|
||||
PRESETS("Presets:"),
|
||||
HAIR("Hair:"),
|
||||
EYES_N_NOSE("Eyes & Nose:"),
|
||||
@ -63,9 +65,9 @@ public class ComboBoxDemoTest {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
|
||||
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
||||
public void test(String lookAndFeel) throws Exception {
|
||||
UIManager.setLookAndFeel(lookAndFeel);
|
||||
new ClassReference(ComboBoxDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2018, 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
|
||||
@ -26,6 +26,7 @@ import static com.sun.swingset3.demos.list.ListDemo.DEMO_TITLE;
|
||||
|
||||
import java.awt.Component;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import org.netbeans.jemmy.ClassReference;
|
||||
import org.netbeans.jemmy.ComponentChooser;
|
||||
@ -67,14 +68,16 @@ public class ListDemoTest {
|
||||
public boolean checkComponent(Component comp) {
|
||||
return getUIValue(listOp, (JList list) -> list.getModel().getSize()) == size;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "Model size to be equal to " + size;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
||||
public void test(String lookAndFeel) throws Exception {
|
||||
UIManager.setLookAndFeel(lookAndFeel);
|
||||
|
||||
new ClassReference(ListDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2018, 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
|
||||
@ -70,8 +70,9 @@ public class OptionPaneDemoTest {
|
||||
public static final String YES = "Yes";
|
||||
public static final String SELECT_AN_OPTION = UIManager.getString("OptionPane.titleText");
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
||||
public void test(String lookAndFeel) throws Exception {
|
||||
UIManager.setLookAndFeel(lookAndFeel);
|
||||
|
||||
new ClassReference(OptionPaneDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
@ -94,7 +95,7 @@ public class OptionPaneDemoTest {
|
||||
private void useInputDialog(JFrameOperator jfo, String textToType, String buttonToPush) {
|
||||
new JButtonOperator(jfo, INPUT_BUTTON).pushNoBlock();
|
||||
JDialogOperator jdo = new JDialogOperator(INPUT);
|
||||
if(textToType != null) {
|
||||
if (textToType != null) {
|
||||
JTextFieldOperator jto = new JTextFieldOperator(jdo);
|
||||
jto.typeText(textToType);
|
||||
jto.waitText(textToType);
|
||||
@ -146,7 +147,7 @@ public class OptionPaneDemoTest {
|
||||
}
|
||||
|
||||
private void callADialogAndClose(JFrameOperator jfo, String buttonToOpenDialog,
|
||||
String dialogTitle, String buttonToPush) {
|
||||
String dialogTitle, String buttonToPush) {
|
||||
new JButtonOperator(jfo, buttonToOpenDialog).pushNoBlock();
|
||||
JDialogOperator jdo = new JDialogOperator(dialogTitle);
|
||||
new JButtonOperator(jdo, buttonToPush).push();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2018, 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
|
||||
@ -25,6 +25,7 @@ import org.jtregext.GuiTestListener;
|
||||
import com.sun.swingset3.demos.progressbar.ProgressBarDemo;
|
||||
import static com.sun.swingset3.demos.progressbar.ProgressBarDemo.*;
|
||||
import java.awt.Component;
|
||||
import javax.swing.UIManager;
|
||||
import static org.testng.AssertJUnit.*;
|
||||
import org.testng.annotations.Test;
|
||||
import org.netbeans.jemmy.ClassReference;
|
||||
@ -55,9 +56,9 @@ public class ProgressBarDemoTest {
|
||||
|
||||
private final static long PROGRESS_BAR_TIMEOUT = 180000;
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
|
||||
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
||||
public void test(String lookAndFeel) throws Exception {
|
||||
UIManager.setLookAndFeel(lookAndFeel);
|
||||
new ClassReference(ProgressBarDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2018, 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
|
||||
@ -25,6 +25,7 @@ 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.*;
|
||||
import javax.swing.UIManager;
|
||||
import org.testng.annotations.Test;
|
||||
import org.netbeans.jemmy.ClassReference;
|
||||
import org.netbeans.jemmy.operators.JFrameOperator;
|
||||
@ -49,8 +50,9 @@ import org.testng.annotations.Listeners;
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class ScrollPaneDemoTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
||||
public void test(String lookAndFeel) throws Exception {
|
||||
UIManager.setLookAndFeel(lookAndFeel);
|
||||
|
||||
new ClassReference(ScrollPaneDemo.class.getName()).startApplication();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2018, 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
|
||||
@ -25,6 +25,7 @@ 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;
|
||||
import javax.swing.UIManager;
|
||||
import static org.testng.AssertJUnit.*;
|
||||
import org.testng.annotations.Test;
|
||||
import org.netbeans.jemmy.ClassReference;
|
||||
@ -54,8 +55,9 @@ public class SpinnerDemoTest {
|
||||
private static final int SPINNERS_COUNT = 9;
|
||||
private static final DecimalFormat decimalFormat = new DecimalFormat();
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
||||
public void test(String lookAndFeel) throws Exception {
|
||||
UIManager.setLookAndFeel(lookAndFeel);
|
||||
new ClassReference(SpinnerDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2018, 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
|
||||
@ -26,6 +26,7 @@ import com.sun.swingset3.demos.tabbedpane.TabbedPaneDemo;
|
||||
import static com.sun.swingset3.demos.tabbedpane.TabbedPaneDemo.*;
|
||||
import static org.jemmy2ext.JemmyExt.getLabeledContainerOperator;
|
||||
import static org.testng.AssertJUnit.*;
|
||||
import javax.swing.UIManager;
|
||||
import org.testng.annotations.Test;
|
||||
import org.netbeans.jemmy.ClassReference;
|
||||
import org.netbeans.jemmy.operators.ContainerOperator;
|
||||
@ -52,8 +53,9 @@ import org.testng.annotations.Listeners;
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class TabbedPaneDemoTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
||||
public void test(String lookAndFeel) throws Exception {
|
||||
UIManager.setLookAndFeel(lookAndFeel);
|
||||
new ClassReference(TabbedPaneDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
|
||||
|
@ -33,6 +33,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
import org.netbeans.jemmy.ClassReference;
|
||||
@ -104,8 +105,9 @@ public class TableDemoTest {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
||||
public void test(String lookAndFeel) throws Exception {
|
||||
UIManager.setLookAndFeel(lookAndFeel);
|
||||
|
||||
new ClassReference(TableDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2018, 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
|
||||
@ -28,6 +28,7 @@ import com.sun.swingset3.demos.togglebutton.LayoutControlPanel;
|
||||
import com.sun.swingset3.demos.togglebutton.ToggleButtonDemo;
|
||||
import static com.sun.swingset3.demos.togglebutton.ToggleButtonDemo.*;
|
||||
import java.util.function.BiFunction;
|
||||
import javax.swing.UIManager;
|
||||
import org.jemmy2ext.JemmyExt.ByClassChooser;
|
||||
import static org.jemmy2ext.JemmyExt.EXACT_STRING_COMPARATOR;
|
||||
import static org.jemmy2ext.JemmyExt.getBorderTitledJPanelOperator;
|
||||
@ -65,8 +66,9 @@ import org.testng.annotations.Listeners;
|
||||
@Listeners(GuiTestListener.class)
|
||||
public class ToggleButtonDemoTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
||||
public void test(String lookAndFeel) throws Exception {
|
||||
UIManager.setLookAndFeel(lookAndFeel);
|
||||
new ClassReference(ToggleButtonDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
JFrameOperator mainFrame = new JFrameOperator(ToggleButtonDemo.class.getAnnotation(DemoProperties.class).value());
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2018, 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
|
||||
@ -25,6 +25,7 @@ import com.sun.swingset3.demos.tree.TreeDemo;
|
||||
import static com.sun.swingset3.demos.tree.TreeDemo.DEMO_TITLE;
|
||||
|
||||
import java.awt.Component;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import org.jtregext.GuiTestListener;
|
||||
@ -68,14 +69,16 @@ public class TreeDemoTest {
|
||||
public boolean checkComponent(Component comp) {
|
||||
return tree.getRowCount() == count;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "A tree to have " + count + " rows";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
||||
public void test(String lookAndFeel) throws Exception {
|
||||
UIManager.setLookAndFeel(lookAndFeel);
|
||||
|
||||
new ClassReference(TreeDemo.class.getCanonicalName()).startApplication();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user