From 48ccb8cd005121dffd2676b78808b1f3bdfb32f6 Mon Sep 17 00:00:00 2001 From: Abhihsek Kumar Date: Thu, 5 Sep 2024 16:01:38 +0530 Subject: [PATCH 1/7] Test instructions change --- test/jdk/javax/swing/JColorChooser/Test4887836.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/jdk/javax/swing/JColorChooser/Test4887836.java b/test/jdk/javax/swing/JColorChooser/Test4887836.java index 4043dbdd88ae6..16fd468c71b3c 100644 --- a/test/jdk/javax/swing/JColorChooser/Test4887836.java +++ b/test/jdk/javax/swing/JColorChooser/Test4887836.java @@ -40,14 +40,16 @@ public class Test4887836 { public static void main(String[] args) throws Exception { String instructions = """ If you do not see white area under the \"Swatches\" tab, - then test passed, otherwise it failed."""; + then test passed, otherwise it failed. + + NOTE: There is no Swatches tab for GTK Look and Feel, Press Pass."""; PassFailJFrame.builder() .title("Test4759306") .instructions(instructions) .rows(5) .columns(40) - .testTimeOut(10) + .testTimeOut(5) .testUI(Test4887836::createColorChooser) .build() .awaitAndCheck(); From e18f940f748156b593c766b932f50fb9a4f711d6 Mon Sep 17 00:00:00 2001 From: Abhihsek Kumar Date: Fri, 6 Sep 2024 11:25:54 +0530 Subject: [PATCH 2/7] Whitespace error fix --- test/jdk/javax/swing/JColorChooser/Test4887836.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jdk/javax/swing/JColorChooser/Test4887836.java b/test/jdk/javax/swing/JColorChooser/Test4887836.java index 16fd468c71b3c..631d5072c5711 100644 --- a/test/jdk/javax/swing/JColorChooser/Test4887836.java +++ b/test/jdk/javax/swing/JColorChooser/Test4887836.java @@ -41,7 +41,7 @@ public static void main(String[] args) throws Exception { String instructions = """ If you do not see white area under the \"Swatches\" tab, then test passed, otherwise it failed. - + NOTE: There is no Swatches tab for GTK Look and Feel, Press Pass."""; PassFailJFrame.builder() From 56bb68d95bd0fbb39d5f0cdece4119def1601d1f Mon Sep 17 00:00:00 2001 From: Abhihsek Kumar Date: Fri, 6 Sep 2024 12:35:42 +0530 Subject: [PATCH 3/7] Restrict test programatically for GTK L&F --- .../javax/swing/JColorChooser/Test4887836.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/jdk/javax/swing/JColorChooser/Test4887836.java b/test/jdk/javax/swing/JColorChooser/Test4887836.java index 631d5072c5711..1d33150e3a8ee 100644 --- a/test/jdk/javax/swing/JColorChooser/Test4887836.java +++ b/test/jdk/javax/swing/JColorChooser/Test4887836.java @@ -26,10 +26,12 @@ import javax.swing.JColorChooser; import javax.swing.UIManager; +import jtreg.SkippedException; + /* * @test * @bug 4887836 - * @library /java/awt/regtesthelpers + * @library /java/awt/regtesthelpers /test/lib * @build PassFailJFrame * @summary Checks for white area under the JColorChooser Swatch tab * @run main/manual Test4887836 @@ -38,11 +40,17 @@ public class Test4887836 { public static void main(String[] args) throws Exception { + + // ColorChooser UI design is different for GTK L&F. + // There is no Swatches tab available for GTK L&F, skip the testing. + if (UIManager.getLookAndFeel().getName().contains("GTK")) { + System.out.println("Test skipped for " + UIManager.getLookAndFeel().getName()); + throw new SkippedException("Test not applicable for GTK L&F"); + } + String instructions = """ If you do not see white area under the \"Swatches\" tab, - then test passed, otherwise it failed. - - NOTE: There is no Swatches tab for GTK Look and Feel, Press Pass."""; + then test passed, otherwise it failed."""; PassFailJFrame.builder() .title("Test4759306") From 7f9848729e624408a38cf81daf3a7b3f7a2c0971 Mon Sep 17 00:00:00 2001 From: Abhihsek Kumar Date: Fri, 6 Sep 2024 15:58:08 +0530 Subject: [PATCH 4/7] Open source test --- .../plaf/basic/BasicSliderUI/bug4419255.java | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java diff --git a/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java b/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java new file mode 100644 index 0000000000000..dd707a05ddaf1 --- /dev/null +++ b/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2001, 2024, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import javax.swing.JColorChooser; +import javax.swing.UIManager; + +import jtreg.SkippedException; + +/* + * @test + * @bug 4419255 + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame + * @summary Tests if Metal Slider's thumb isn't clipped + * @run main/manual bug4419255 + */ + +public class bug4419255 { + + public static void main(String[] args) throws Exception { + + // ColorChooser UI design is different for GTK L&F. + // There is no RGB tab available for GTK L&F, skip the testing. + if (UIManager.getLookAndFeel().getName().contains("GTK")) { + System.out.println("Test skipped for " + UIManager.getLookAndFeel().getName()); + throw new SkippedException("Test not applicable for GTK L&F"); + } + String instructions = """ + Choose RGB tab. If sliders' thumbs are painted correctly + (top is not clipped, black line is visible), + then test passed. Otherwise it failed."""; + + PassFailJFrame.builder() + .title("bug4419255") + .instructions(instructions) + .rows(5) + .columns(40) + .testTimeOut(5) + .testUI(bug4419255::createColorChooser) + .build() + .awaitAndCheck(); + } + + private static JColorChooser createColorChooser() { + JColorChooser chooser = new JColorChooser(Color.BLUE); + return chooser; + } +} From 677cb0e9452239dd8b026bf7abfeb96a76533161 Mon Sep 17 00:00:00 2001 From: Abhihsek Kumar Date: Fri, 6 Sep 2024 17:01:43 +0530 Subject: [PATCH 5/7] Remove print statement --- test/jdk/javax/swing/JColorChooser/Test4887836.java | 1 - test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java | 1 - 2 files changed, 2 deletions(-) diff --git a/test/jdk/javax/swing/JColorChooser/Test4887836.java b/test/jdk/javax/swing/JColorChooser/Test4887836.java index 1d33150e3a8ee..a15b3a0af7a6d 100644 --- a/test/jdk/javax/swing/JColorChooser/Test4887836.java +++ b/test/jdk/javax/swing/JColorChooser/Test4887836.java @@ -44,7 +44,6 @@ public static void main(String[] args) throws Exception { // ColorChooser UI design is different for GTK L&F. // There is no Swatches tab available for GTK L&F, skip the testing. if (UIManager.getLookAndFeel().getName().contains("GTK")) { - System.out.println("Test skipped for " + UIManager.getLookAndFeel().getName()); throw new SkippedException("Test not applicable for GTK L&F"); } diff --git a/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java b/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java index dd707a05ddaf1..0470815f707c2 100644 --- a/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java +++ b/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java @@ -43,7 +43,6 @@ public static void main(String[] args) throws Exception { // ColorChooser UI design is different for GTK L&F. // There is no RGB tab available for GTK L&F, skip the testing. if (UIManager.getLookAndFeel().getName().contains("GTK")) { - System.out.println("Test skipped for " + UIManager.getLookAndFeel().getName()); throw new SkippedException("Test not applicable for GTK L&F"); } String instructions = """ From 38093f2126b65766656564e9f7afc1864fe7f7fa Mon Sep 17 00:00:00 2001 From: Abhihsek Kumar Date: Wed, 9 Oct 2024 10:26:13 +0530 Subject: [PATCH 6/7] Review comment fix --- test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java b/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java index 0470815f707c2..f87aabc5869eb 100644 --- a/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java +++ b/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java @@ -62,7 +62,6 @@ public static void main(String[] args) throws Exception { } private static JColorChooser createColorChooser() { - JColorChooser chooser = new JColorChooser(Color.BLUE); - return chooser; + return new JColorChooser(Color.BLUE); } } From 12bf501a19615fa7121fa906e3a62e72609f376f Mon Sep 17 00:00:00 2001 From: Abhihsek Kumar Date: Wed, 9 Oct 2024 10:32:46 +0530 Subject: [PATCH 7/7] PassFailJFrame default timeout and row count removed --- test/jdk/javax/swing/JColorChooser/Test4887836.java | 2 -- test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java | 2 -- 2 files changed, 4 deletions(-) diff --git a/test/jdk/javax/swing/JColorChooser/Test4887836.java b/test/jdk/javax/swing/JColorChooser/Test4887836.java index a15b3a0af7a6d..82a09c460853b 100644 --- a/test/jdk/javax/swing/JColorChooser/Test4887836.java +++ b/test/jdk/javax/swing/JColorChooser/Test4887836.java @@ -54,9 +54,7 @@ public static void main(String[] args) throws Exception { PassFailJFrame.builder() .title("Test4759306") .instructions(instructions) - .rows(5) .columns(40) - .testTimeOut(5) .testUI(Test4887836::createColorChooser) .build() .awaitAndCheck(); diff --git a/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java b/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java index f87aabc5869eb..eb23901f60d4b 100644 --- a/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java +++ b/test/jdk/javax/swing/plaf/basic/BasicSliderUI/bug4419255.java @@ -53,9 +53,7 @@ public static void main(String[] args) throws Exception { PassFailJFrame.builder() .title("bug4419255") .instructions(instructions) - .rows(5) .columns(40) - .testTimeOut(5) .testUI(bug4419255::createColorChooser) .build() .awaitAndCheck();