changeset 52105:26c3104c936d

8210055: Enable different look and feel tests in SwingSet3 demo tests Reviewed-by: serb Contributed-by: abdul.kolarkunnu@oracle.com
author akolarkunnu
date Fri, 05 Oct 2018 05:03:15 -0700
parents ec4f2762b234
children fc52ccf451cd
files test/jdk/sanity/client/SwingSet/src/DialogDemoTest.java test/jdk/sanity/client/SwingSet/src/SwingSet2DemoTest.java test/jdk/sanity/client/SwingSet/src/WindowDemoTest.java test/jdk/sanity/client/lib/Extensions/src/org/jemmy2ext/JemmyExt.java test/jdk/sanity/client/lib/SwingSet2/src/SwingSet2.java
diffstat 5 files changed, 21 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/sanity/client/SwingSet/src/DialogDemoTest.java	Wed Oct 10 16:25:40 2018 -0400
+++ b/test/jdk/sanity/client/SwingSet/src/DialogDemoTest.java	Fri Oct 05 05:03:15 2018 -0700
@@ -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 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 @@
 
     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);
--- a/test/jdk/sanity/client/SwingSet/src/SwingSet2DemoTest.java	Wed Oct 10 16:25:40 2018 -0400
+++ b/test/jdk/sanity/client/SwingSet/src/SwingSet2DemoTest.java	Fri Oct 05 05:03:15 2018 -0700
@@ -27,6 +27,7 @@
 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 @@
  *          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 @@
      *
      * @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 @@
         }
     }
 
-}
\ No newline at end of file
+}
--- a/test/jdk/sanity/client/SwingSet/src/WindowDemoTest.java	Wed Oct 10 16:25:40 2018 -0400
+++ b/test/jdk/sanity/client/SwingSet/src/WindowDemoTest.java	Fri Oct 05 05:03:15 2018 -0700
@@ -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 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 @@
 @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();
 
--- a/test/jdk/sanity/client/lib/Extensions/src/org/jemmy2ext/JemmyExt.java	Wed Oct 10 16:25:40 2018 -0400
+++ b/test/jdk/sanity/client/lib/Extensions/src/org/jemmy2ext/JemmyExt.java	Fri Oct 05 05:03:15 2018 -0700
@@ -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 @@
                 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 @@
                 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 @@
 
         @Override
         public boolean checkComponent(Component comp) {
-            return comp.getClass().equals(clazz);
+            return comp.getClass().equals(clazz) && comp.isShowing();
         }
 
         @Override
--- a/test/jdk/sanity/client/lib/SwingSet2/src/SwingSet2.java	Wed Oct 10 16:25:40 2018 -0400
+++ b/test/jdk/sanity/client/lib/SwingSet2/src/SwingSet2.java	Fri Oct 05 05:03:15 2018 -0700
@@ -323,8 +323,6 @@
                        "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 @@
                 "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 @@
             return className;
         }
     }
-}
\ No newline at end of file
+}