From 1e76e1fdfa67c28ce20b0dc7fb0253670be54554 Mon Sep 17 00:00:00 2001 From: Alisen Chung Date: Mon, 1 Apr 2024 06:22:11 +0000 Subject: [PATCH] 8328403: Remove applet usage from JColorChooser tests Test6977726 Reviewed-by: tr, honkar --- .../swing/JColorChooser/Test6977726.html | 31 ------------ .../swing/JColorChooser/Test6977726.java | 48 +++++++++++++------ 2 files changed, 34 insertions(+), 45 deletions(-) delete mode 100644 test/jdk/javax/swing/JColorChooser/Test6977726.html diff --git a/test/jdk/javax/swing/JColorChooser/Test6977726.html b/test/jdk/javax/swing/JColorChooser/Test6977726.html deleted file mode 100644 index 866332236fc..00000000000 --- a/test/jdk/javax/swing/JColorChooser/Test6977726.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - -If you don't see the preview panel, then test failed, otherwise it passed. - - - - - diff --git a/test/jdk/javax/swing/JColorChooser/Test6977726.java b/test/jdk/javax/swing/JColorChooser/Test6977726.java index bb42cee5b26..a79931c93eb 100644 --- a/test/jdk/javax/swing/JColorChooser/Test6977726.java +++ b/test/jdk/javax/swing/JColorChooser/Test6977726.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -21,22 +21,42 @@ * questions. */ -/* - * @test - * @bug 6977726 - * @summary Checks if JColorChooser.setPreviewPanel removes the old one - * @author Sergey Malenkov - * @run applet/manual=yesno Test6977726.html - */ - -import javax.swing.JApplet; +import java.awt.Color; import javax.swing.JColorChooser; import javax.swing.JLabel; -public class Test6977726 extends JApplet { - public void init() { - JColorChooser chooser = new JColorChooser(); +/* + * @test + * @bug 6977726 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Checks if JColorChooser.setPreviewPanel(JLabel) doesn't remove the preview panel but + * removes the content of the default preview panel + * @run main/manual Test6977726 + */ + +public class Test6977726 { + + public static void main(String[] args) throws Exception { + String instructions = """ + Check that there is a panel with "Text Preview Panel" text + and with title "Preview" in the JColorChooser. + Test passes if the panel is as described, test fails otherwise."""; + + PassFailJFrame.builder() + .title("Test6977726") + .instructions(instructions) + .rows(5) + .columns(40) + .testTimeOut(2) + .testUI(Test6977726::createColorChooser) + .build() + .awaitAndCheck(); + } + + private static JColorChooser createColorChooser() { + JColorChooser chooser = new JColorChooser(Color.BLUE); chooser.setPreviewPanel(new JLabel("Text Preview Panel")); - getContentPane().add(chooser); + return chooser; } }