8211443: Enable different look and feels in SwingSet3 demo test SplitPaneDemoTest
authorsveerabhadra
Fri, 26 Oct 2018 13:52:08 +0530
changeset 52521 7335ac58f32b
parent 52520 39720384f74a
child 52522 e57405e79cd7
8211443: Enable different look and feels in SwingSet3 demo test SplitPaneDemoTest Reviewed-by: serb Contributed-by: gauri.patil@oracle.com
test/jdk/sanity/client/SwingSet/src/SplitPaneDemoTest.java
--- a/test/jdk/sanity/client/SwingSet/src/SplitPaneDemoTest.java	Thu Oct 25 13:09:58 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/SplitPaneDemoTest.java	Fri Oct 26 13:52:08 2018 +0530
@@ -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
@@ -27,6 +27,7 @@
 import java.awt.Component;
 import java.awt.event.KeyEvent;
 import javax.swing.JSplitPane;
+import javax.swing.UIManager;
 
 import static org.jemmy2ext.JemmyExt.*;
 
@@ -59,13 +60,14 @@
  *          java.logging
  * @build org.jemmy2ext.JemmyExt
  * @build com.sun.swingset3.demos.splitpane.SplitPaneDemo
- * @run testng SplitPaneDemoTest
+ * @run testng/timeout=600 SplitPaneDemoTest
  */
 @Listeners(GuiTestListener.class)
 public class SplitPaneDemoTest {
 
-    @Test
-    public void test() throws Exception {
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
 
         new ClassReference(SplitPaneDemo.class.getCanonicalName()).startApplication();
 
@@ -73,21 +75,29 @@
 
         JSplitPaneOperator splitPane = new JSplitPaneOperator(frame);
 
-        // Toggle OneTouch Expandable
-        checkOneTouch(frame, splitPane, true);
-        checkOneTouch(frame, splitPane, false);
+        // OneTouch feature is not available in GTK L&F
+        if(!"GTK".equals(UIManager.getLookAndFeel().getID())) {
+            // Toggle OneTouch Expandable
+            checkOneTouch(frame, splitPane, true);
+            checkOneTouch(frame, splitPane, false);
+        }
 
         // Check changing divider size to minimum and maximum values
         changeDividerSize(frame, splitPane, 50);
         changeDividerSize(frame, splitPane, 6);
 
-        // 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);
+        // TODO Skipping this code for Motif L&F as the fix for "CODETOOLS-7902324"
+        // is deferred now
+        if(!("Motif".equals(UIManager.getLookAndFeel().getID()))) {
+            // 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