8210056: Enable different look and feel tests in SwingSet3 demo test TextFieldDemoTest
authorakolarkunnu
Tue, 11 Sep 2018 22:16:47 -0700
changeset 51749 a0f0da2c2719
parent 51748 13d6be5fbfa5
child 51750 9151fde080e6
8210056: Enable different look and feel tests in SwingSet3 demo test TextFieldDemoTest Reviewed-by: serb Contributed-by: abdul.kolarkunnu@oracle.com
test/jdk/sanity/client/SwingSet/src/TextFieldDemoTest.java
--- a/test/jdk/sanity/client/SwingSet/src/TextFieldDemoTest.java	Fri Sep 14 12:53:07 2018 -0400
+++ b/test/jdk/sanity/client/SwingSet/src/TextFieldDemoTest.java	Tue Sep 11 22:16:47 2018 -0700
@@ -32,6 +32,7 @@
 import java.util.Date;
 import java.util.Locale;
 import javax.swing.JFormattedTextField;
+import javax.swing.UIManager;
 
 import static org.jemmy2ext.JemmyExt.*;
 
@@ -69,9 +70,9 @@
 @Listeners(GuiTestListener.class)
 public class TextFieldDemoTest {
 
-    @Test
-    public void test() throws Exception {
-
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
         new ClassReference(TextFieldDemo.class.getCanonicalName()).startApplication();
 
         JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
@@ -144,11 +145,12 @@
         });
 
         // Check non-matching passwords
+        final Color backgroundColor = UIManager.getColor("TextField.background");
         password2.typeText("passwereertegrs");
         password1.waitState(new ComponentChooser() {
             public boolean checkComponent(Component comp) {
-                return password1.getBackground().equals(Color.white) &&
-                       password2.getBackground().equals(Color.white);
+                return password1.getBackground().equals(backgroundColor) &&
+                       password2.getBackground().equals(backgroundColor);
             }
             public String getDescription() {
                 return "Passwords not to match";