8210055: Enable different look and feel tests in SwingSet3 demo tests

Reviewed-by: serb
This commit is contained in:
Abdul Kolarkunnu 2018-10-05 05:03:15 -07:00 committed by Abdul Kolarkunnu
parent d9731f0c54
commit 99ca4f3497
5 changed files with 21 additions and 18 deletions

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 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
@ -27,6 +27,7 @@ import static com.sun.swingset3.demos.dialog.DialogDemo.*;
import java.awt.Dimension;
import java.awt.Point;
import javax.swing.JDialog;
import javax.swing.UIManager;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.Test;
import static org.jemmy2ext.JemmyExt.isIconified;
@ -61,8 +62,9 @@ public class DialogDemoTest {
private final ComponentChooser jDialogClassChooser = new ByClassChooser(JDialog.class);
@Test
public void test() throws Exception {
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
public void test(String lookAndFeel) throws Exception {
UIManager.setLookAndFeel(lookAndFeel);
new ClassReference(DialogDemo.class.getCanonicalName()).startApplication();
JFrameOperator mainFrame = new JFrameOperator(DIALOG_DEMO_TITLE);
JDialogOperator dialog = new JDialogOperator(DIALOG_TITLE);

View File

@ -27,6 +27,7 @@ import static org.testng.Assert.assertTrue;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.ToolTipManager;
import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel;
import org.jtregext.GuiTestListener;
@ -58,7 +59,7 @@ import org.testng.annotations.Test;
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build SwingSet2
* @run testng SwingSet2DemoTest
* @run testng/timeout=600 SwingSet2DemoTest
*/
@Listeners(GuiTestListener.class)
public class SwingSet2DemoTest {
@ -74,8 +75,9 @@ public class SwingSet2DemoTest {
*
* @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(SwingSet2.class.getCanonicalName()).startApplication();
JFrameOperator frameOperator = new JFrameOperator(SwingSet2.FRAME_TITLE);
@ -192,4 +194,4 @@ public class SwingSet2DemoTest {
}
}
}
}

View File

@ -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.window.WindowDemo;
import static com.sun.swingset3.demos.window.WindowDemo.*;
import static org.jemmy2ext.JemmyExt.*;
import static org.testng.AssertJUnit.*;
import javax.swing.UIManager;
import org.testng.annotations.Test;
import org.netbeans.jemmy.ClassReference;
import org.netbeans.jemmy.operators.JButtonOperator;
@ -53,8 +54,9 @@ import org.testng.annotations.Listeners;
@Listeners(GuiTestListener.class)
public class WindowDemoTest {
@Test
public void test() throws Exception {
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
public void test(String lookAndFeel) throws Exception {
UIManager.setLookAndFeel(lookAndFeel);
new ClassReference(WindowDemo.class.getCanonicalName()).startApplication();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -406,7 +406,7 @@ public class JemmyExt {
Window[] windows = Window.getWindows();
int windowCount = 0;
for (Window w : windows) {
if (w.getClass().equals(JWindow.class)) {
if (w.getClass().equals(JWindow.class) && ((JWindow)w).isShowing()) {
windowCount++;
}
}
@ -427,7 +427,7 @@ public class JemmyExt {
Window[] windows = Window.getWindows();
int windowIndex = 0;
for (Window w : windows) {
if (w.getClass().equals(JWindow.class)) {
if (w.getClass().equals(JWindow.class) && ((JWindow)w).isShowing()) {
if (windowIndex == index) {
return (JWindow) w;
}
@ -565,7 +565,7 @@ public class JemmyExt {
@Override
public boolean checkComponent(Component comp) {
return comp.getClass().equals(clazz);
return comp.getClass().equals(clazz) && comp.isShowing();
}
@Override

View File

@ -323,8 +323,6 @@ public class SwingSet2 extends JPanel {
"FileMenu.exit_accessible_description", new ExitAction(this)
);
// Create these menu items for the first SwingSet only.
if (numSSs == 0) {
// ***** create laf switcher menu
lafMenu = (JMenu) menuBar.add(new JMenu(getString("LafMenu.laf_label")));
lafMenu.setMnemonic(getMnemonic("LafMenu.laf_mnemonic"));
@ -432,7 +430,6 @@ public class SwingSet2 extends JPanel {
"OptionsMenu.dragEnabled_mnemonic",
"OptionsMenu.dragEnabled_accessible_description",
new DragSupportAction());
}
// ***** create the multiscreen menu, if we have multiple screens
GraphicsDevice[] screens = GraphicsEnvironment.
@ -1258,4 +1255,4 @@ public class SwingSet2 extends JPanel {
return className;
}
}
}
}