Merge
authorpsadhukhan
Wed, 24 Jul 2019 12:49:44 +0530
changeset 57926 70865ef2afc7
parent 57925 e28ccaff2f84 (current diff)
parent 57526 8538b1f28a71 (diff)
child 57927 b0aaa82a1b03
Merge
--- a/test/jdk/sanity/client/SwingSet/src/ColorChooserDemoTest.java	Wed Jul 24 12:21:36 2019 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/ColorChooserDemoTest.java	Wed Jul 24 12:49:44 2019 +0530
@@ -68,261 +68,262 @@
 @Listeners(GuiTestListener.class)
 public class ColorChooserDemoTest {
 
-private static final String OK_BUTTON_TITLE = "OK";
-private static final String CANCEL_BUTTON_TITLE = "Cancel";
-private static final String RESET_BUTTON_TITLE = "Reset";
-private static final String HSV = "HSV";
-private static final String RGB = "RGB";
-private static final String HSL = "HSL";
-private static final String CMYK = "CMYK";
-private static final int HSV_NUMBER_OF_SLIDERS_AND_SPINNERS = 4;
-private static final int RGB_NUMBER_OF_SLIDERS_AND_SPINNERS = 4;
-private static final int HSL_NUMBER_OF_SLIDERS_AND_SPINNERS = 4;
-private static final int CMYK_NUMBER_OF_SLIDERS_AND_SPINNERS = 5;
-private static final int HSV_HUE_INDEX = 0;
-private static final int HSV_SATURATION_INDEX = 1;
-private static final int HSV_VALUE_INDEX = 2;
-private static final int HSV_TRANSPARENCY_INDEX = 3;
-private static final int HSL_HUE_INDEX = 0;
-private static final int HSL_SATURATION_INDEX = 1;
-private static final int HSL_LIGHTNESS_INDEX = 2;
-private static final int HSL_TRANSPARENCY_INDEX = 3;
-private static final int RGB_RED_INDEX = 0;
-private static final int RGB_GREEN_INDEX = 1;
-private static final int RGB_BLUE_INDEX = 2;
-private static final int RGB_ALPHA_INDEX = 3;
-private static final int RGB_COLORCODE_TEXT_FIELD_INDEX = 4;
-private static final int CMYK_CYAN_INDEX = 0;
-private static final int CMYK_MAGENTA_INDEX = 1;
-private static final int CMYK_YELLOW_INDEX = 2;
-private static final int CMYK_BLACK_INDEX = 3;
-private static final int CMYK_ALPHA_INDEX = 4;
+    private static final String OK_BUTTON_TITLE = "OK";
+    private static final String CANCEL_BUTTON_TITLE = "Cancel";
+    private static final String RESET_BUTTON_TITLE = "Reset";
+    private static final String HSV = "HSV";
+    private static final String RGB = "RGB";
+    private static final String HSL = "HSL";
+    private static final String CMYK = "CMYK";
+    private static final int HSV_NUMBER_OF_SLIDERS_AND_SPINNERS = 4;
+    private static final int RGB_NUMBER_OF_SLIDERS_AND_SPINNERS = 4;
+    private static final int HSL_NUMBER_OF_SLIDERS_AND_SPINNERS = 4;
+    private static final int CMYK_NUMBER_OF_SLIDERS_AND_SPINNERS = 5;
+    private static final int HSV_HUE_INDEX = 0;
+    private static final int HSV_SATURATION_INDEX = 1;
+    private static final int HSV_VALUE_INDEX = 2;
+    private static final int HSV_TRANSPARENCY_INDEX = 3;
+    private static final int HSL_HUE_INDEX = 0;
+    private static final int HSL_SATURATION_INDEX = 1;
+    private static final int HSL_LIGHTNESS_INDEX = 2;
+    private static final int HSL_TRANSPARENCY_INDEX = 3;
+    private static final int RGB_RED_INDEX = 0;
+    private static final int RGB_GREEN_INDEX = 1;
+    private static final int RGB_BLUE_INDEX = 2;
+    private static final int RGB_ALPHA_INDEX = 3;
+    private static final int RGB_COLORCODE_TEXT_FIELD_INDEX = 4;
+    private static final int CMYK_CYAN_INDEX = 0;
+    private static final int CMYK_MAGENTA_INDEX = 1;
+    private static final int CMYK_YELLOW_INDEX = 2;
+    private static final int CMYK_BLACK_INDEX = 3;
+    private static final int CMYK_ALPHA_INDEX = 4;
+
+    private final Color resetColor = new Color(125, 125, 125);
 
-private final Color resetColor = new Color(125, 125, 125);
+    private JDialogOperator colorChooserDialog;
+    private JButtonOperator okButton;
+    private JButtonOperator cancelButton;
+    private JButtonOperator resetButton;
+    private JColorChooserOperator colorChooser;
+    private JButtonOperator backgroundButton;
+    private JButtonOperator gradient1Button;
+    private JButtonOperator gradient2Button;
+    private JButtonOperator perimeterButton;
+    private JTabbedPaneOperator tabOperator;
+    private JComponentOperator bezierAnimationPanel;
+    private JSliderOperator[] sliders = new JSliderOperator[5];
+    private JSpinnerOperator[] spinners = new JSpinnerOperator[5];
+    private JButtonOperator lastFocusedButton;
+
+    @Test
+    public void test() throws Exception {
+        new ClassReference(ColorChooserDemo.class.getCanonicalName()).startApplication();
+        JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
+        bezierAnimationPanel = new JComponentOperator(frame, new ByClassChooser(BezierAnimationPanel.class));
+        initializePanelButtons(frame);
+        checkBackgroundColorChooser();
+        checkGradient1ColorChooser();
+        checkGradient2ColorChooser();
+        checkPerimeterColorChooser();
+    }
+
+    private void checkBackgroundColorChooser() throws Exception {
+        basicCheck(backgroundButton, BezierColor.BACKGROUND);
+        checkAllColorChoosers(backgroundButton);
+    }
 
-private JDialogOperator colorChooserDialog;
-private JButtonOperator okButton;
-private JButtonOperator cancelButton;
-private JButtonOperator resetButton;
-private JColorChooserOperator colorChooser;
-private JButtonOperator backgroundButton;
-private JButtonOperator gradient1Button;
-private JButtonOperator gradient2Button;
-private JButtonOperator perimeterButton;
-private JTabbedPaneOperator tabOperator;
-private JComponentOperator bezierAnimationPanel;
-private JSliderOperator[] sliders = new JSliderOperator[5];
-private JSpinnerOperator[] spinners = new JSpinnerOperator[5];
-private JButtonOperator lastFocusedButton;
+    private void checkGradient1ColorChooser() throws Exception {
+        basicCheck(gradient1Button, BezierColor.GRADIENT_A);
+    }
+
+    private void checkGradient2ColorChooser() throws Exception {
+        basicCheck(gradient2Button, BezierColor.GRADIENT_B);
+    }
+
+    private void checkPerimeterColorChooser() throws Exception {
+        basicCheck(perimeterButton, BezierColor.OUTER);
+    }
+
+    private void pushButtonAndInitialize(JButtonOperator jbo) throws InterruptedException {
+        // Wait for focus to return to last focused button
+        lastFocusedButton.waitHasFocus();
+        jbo.pushNoBlock();
+        lastFocusedButton = jbo;
+        // Wait till the ColorChooserDemo Dialog Opens
+        new DialogWaiter().waitDialog(CHOOSER_TITLE, false, false);
+        initializeDialog();
+    }
+
+    private void initializePanelButtons(JFrameOperator frame) {
+        backgroundButton = new JButtonOperator(frame, BACKGROUND);
+        gradient1Button = new JButtonOperator(frame, GRADIENT_1);
+        gradient2Button = new JButtonOperator(frame, GRADIENT_2);
+        perimeterButton = new JButtonOperator(frame, PERIMETER);
+        lastFocusedButton = backgroundButton;
+    }
 
-@Test
-public void test() throws Exception {
-new ClassReference(ColorChooserDemo.class.getCanonicalName()).startApplication();
-JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
-bezierAnimationPanel = new JComponentOperator(frame, new ByClassChooser(BezierAnimationPanel.class));
-initializePanelButtons(frame);
-checkBackgroundColorChooser();
-checkGradient1ColorChooser();
-checkGradient2ColorChooser();
-checkPerimeterColorChooser();
-}
+    private void initializeDialog() {
+        colorChooserDialog = new JDialogOperator(CHOOSER_TITLE);
+        tabOperator = new JTabbedPaneOperator(colorChooserDialog);
+        colorChooser = new JColorChooserOperator(colorChooserDialog);
+        okButton = new JButtonOperator(colorChooserDialog, OK_BUTTON_TITLE);
+        cancelButton = new JButtonOperator(colorChooserDialog, CANCEL_BUTTON_TITLE);
+        resetButton = new JButtonOperator(colorChooserDialog, RESET_BUTTON_TITLE);
+    }
+
+    private void basicCheck(JButtonOperator jbo, BezierColor bezierColor) throws Exception {
+        Color testColor = new Color(100, 26, 155);
+        Color testColor2 = new Color(10, 40, 50);
+        checkDefaultColorChooser(jbo, testColor, bezierColor);
+        checkCancelButton(jbo, testColor2);
+        checkResetButton(jbo, testColor2);
+    }
 
-private void checkBackgroundColorChooser() throws Exception {
-basicCheck(backgroundButton, BezierColor.BACKGROUND);
-checkAllColorChoosers(backgroundButton);
-}
+    private void checkDefaultColorChooser(JButtonOperator jbo, Color testColor, BezierColor bezierColor)
+            throws Exception {
+        BezierAnimationPanel bezierPanel;
+        pushButtonAndInitialize(jbo);
+        // Check ColorChooser color is being set and used accordingly
+        // in the animation panel
+        setAndWaitColor(testColor);
+        pushButtonAndWaitDialogClosed(okButton);
+        bezierPanel = (BezierAnimationPanel) bezierAnimationPanel.getSource();
+        colorChooser.waitStateOnQueue(jColorChooser -> (bezierPanel.getBezierColor(bezierColor).equals(testColor)));
+    }
+
+    private void checkCancelButton(JButtonOperator jbo, Color testColor) throws Exception {
+        pushButtonAndInitialize(jbo);
+        setAndWaitColor(testColor);
+        pushButtonAndWaitDialogClosed(cancelButton);
+    }
 
-private void checkGradient1ColorChooser() throws Exception {
-basicCheck(gradient1Button, BezierColor.GRADIENT_A);
-}
+    private void checkResetButton(JButtonOperator jbo, Color testColor) throws Exception {
+        pushButtonAndInitialize(jbo);
+        Color initialColor = colorChooser.getColor();
+        setAndWaitColor(testColor);
+        resetButton.push();
+        waitJColorChooserColor(initialColor);
+        pushButtonAndWaitDialogClosed(okButton);
+    }
 
-private void checkGradient2ColorChooser() throws Exception {
-basicCheck(gradient2Button, BezierColor.GRADIENT_B);
-}
+    private void checkAllColorChoosers(JButtonOperator jbo) throws Exception {
+        pushButtonAndInitialize(jbo);
+        checkHSV();
+        checkHSL();
+        checkRGB();
+        checkCMYK();
+        pushButtonAndWaitDialogClosed(okButton);
+    }
 
-private void checkPerimeterColorChooser() throws Exception {
-basicCheck(perimeterButton, BezierColor.OUTER);
-}
+    private void waitJColorChooserColor(Color expectedColor) {
+        colorChooser.waitStateOnQueue(jColorChooser -> colorChooser.getColor().equals(expectedColor));
+    }
+
+    private void setAndWaitColor(Color color) {
+        colorChooser.setColor(color);
+        // Wait for the Color to be set
+        waitJColorChooserColor(color);
+    }
 
-private void pushButtonAndInitialize(JButtonOperator jbo) throws InterruptedException {
-// Wait for focus to return to last focused button
-lastFocusedButton.waitHasFocus();
-jbo.pushNoBlock();
-lastFocusedButton = jbo;
-// Wait till the ColorChooserDemo Dialog Opens
-new DialogWaiter().waitDialog(CHOOSER_TITLE, false, false);
-initializeDialog();
-}
+    private void resetColor() {
+        colorChooser.setColor(resetColor);
+        // Wait for the Color to be reset
+        waitJColorChooserColor(resetColor);
+    }
 
-private void initializePanelButtons(JFrameOperator frame) {
-backgroundButton = new JButtonOperator(frame, BACKGROUND);
-gradient1Button = new JButtonOperator(frame, GRADIENT_1);
-gradient2Button = new JButtonOperator(frame, GRADIENT_2);
-perimeterButton = new JButtonOperator(frame, PERIMETER);
-lastFocusedButton = backgroundButton;
-}
+    private void checkHSV() {
+        tabOperator.selectPage(HSV);
+        initializeSliderAndSpinner(HSV_NUMBER_OF_SLIDERS_AND_SPINNERS);
+        resetColor();
+        setAndCheckSlider(sliders[HSV_SATURATION_INDEX], 50, new Color(125, 62, 62));
+        setAndCheckSlider(sliders[HSV_VALUE_INDEX], 80, new Color(204, 102, 102));
+        setAndCheckSlider(sliders[HSV_HUE_INDEX], 50, new Color(204, 187, 102));
+        setAndCheckSlider(sliders[HSV_TRANSPARENCY_INDEX], 50, new Color(204, 187, 102, 127));
+        setAndCheckSpinner(spinners[HSV_SATURATION_INDEX], 25, new Color(204, 195, 153, 127));
+        setAndCheckSpinner(spinners[HSV_VALUE_INDEX], 40, new Color(102, 97, 76, 127));
+        setAndCheckSpinner(spinners[HSV_HUE_INDEX], 25, new Color(102, 87, 76, 127));
+        setAndCheckSpinner(spinners[HSV_TRANSPARENCY_INDEX], 100, new Color(102, 87, 76, 0));
+    }
+
+    private void checkHSL() {
+        tabOperator.selectPage(HSL);
+        initializeSliderAndSpinner(HSL_NUMBER_OF_SLIDERS_AND_SPINNERS);
+        resetColor();
+        setAndCheckSlider(sliders[HSL_SATURATION_INDEX], 50, new Color(187, 62, 62));
+        setAndCheckSlider(sliders[HSL_LIGHTNESS_INDEX], 80, new Color(229, 178, 178));
+        setAndCheckSlider(sliders[HSL_HUE_INDEX], 180, new Color(178, 229, 229));
+        setAndCheckSlider(sliders[HSL_TRANSPARENCY_INDEX], 50, new Color(178, 229, 229, 127));
+        setAndCheckSpinner(spinners[HSL_SATURATION_INDEX], 25, new Color(191, 216, 216, 127));
+        setAndCheckSpinner(spinners[HSL_LIGHTNESS_INDEX], 40, new Color(76, 127, 127, 127));
+        setAndCheckSpinner(spinners[HSL_HUE_INDEX], 25, new Color(127, 97, 76, 127));
+        setAndCheckSpinner(spinners[HSL_TRANSPARENCY_INDEX], 50, new Color(127, 97, 76, 127));
+    }
 
-private void initializeDialog() {
-colorChooserDialog = new JDialogOperator(CHOOSER_TITLE);
-tabOperator = new JTabbedPaneOperator(colorChooserDialog);
-colorChooser = new JColorChooserOperator(colorChooserDialog);
-okButton = new JButtonOperator(colorChooserDialog, OK_BUTTON_TITLE);
-cancelButton = new JButtonOperator(colorChooserDialog, CANCEL_BUTTON_TITLE);
-resetButton = new JButtonOperator(colorChooserDialog, RESET_BUTTON_TITLE);
-}
+    private void checkRGB() {
+        String sampleColor = "111111";
+        tabOperator.selectPage(RGB);
+        initializeSliderAndSpinner(RGB_NUMBER_OF_SLIDERS_AND_SPINNERS);
+        JTextFieldOperator colorCode = new JTextFieldOperator(colorChooserDialog, RGB_COLORCODE_TEXT_FIELD_INDEX);
+        resetColor();
+        setAndCheckSlider(sliders[RGB_GREEN_INDEX], 50, new Color(125, 50, 125, 255));
+        setAndCheckSlider(sliders[RGB_BLUE_INDEX], 80, new Color(125, 50, 80, 255));
+        setAndCheckSlider(sliders[RGB_RED_INDEX], 50, new Color(50, 50, 80, 255));
+        setAndCheckSlider(sliders[RGB_ALPHA_INDEX], 125, new Color(50, 50, 80, 125));
+        setAndCheckSpinner(spinners[RGB_GREEN_INDEX], 25, new Color(50, 25, 80, 125));
+        setAndCheckSpinner(spinners[RGB_BLUE_INDEX], 40, new Color(50, 25, 40, 125));
+        setAndCheckSpinner(spinners[RGB_RED_INDEX], 25, new Color(25, 25, 40, 125));
+        setAndCheckSpinner(spinners[RGB_ALPHA_INDEX], 255, new Color(25, 25, 40, 255));
 
-private void basicCheck(JButtonOperator jbo, BezierColor bezierColor) throws Exception {
-Color testColor = new Color(100, 26, 155);
-Color testColor2 = new Color(10, 40, 50);
-checkDefaultColorChooser(jbo, testColor, bezierColor);
-checkCancelButton(jbo, testColor2);
-checkResetButton(jbo, testColor2);
-}
+        colorCode.setText(sampleColor);
+        // Wait for the sampleColor to be set in the color code text field.
+        colorCode.waitText(sampleColor);
+        colorCode.getFocus();
+        colorCode.pressKey(KeyEvent.VK_TAB);
+        // Wait for the color to be set
+        waitJColorChooserColor(new Color(17, 17, 17, 255));
+    }
 
-private void checkDefaultColorChooser(JButtonOperator jbo, Color testColor, BezierColor bezierColor)
-throws Exception {
-BezierAnimationPanel bezierPanel;
-pushButtonAndInitialize(jbo);
-// Check ColorChooser color is being set and used accordingly
-// in the animation panel
-setAndWaitColor(testColor);
-pushButtonAndWaitDialogClosed(okButton);
-bezierPanel = (BezierAnimationPanel) bezierAnimationPanel.getSource();
-colorChooser.waitStateOnQueue(jColorChooser -> (bezierPanel.getBezierColor(bezierColor).equals(testColor)));
-}
+    private void checkCMYK() {
+        tabOperator.selectPage(CMYK);
+        initializeSliderAndSpinner(CMYK_NUMBER_OF_SLIDERS_AND_SPINNERS);
+        resetColor();
+        setAndCheckSlider(sliders[CMYK_MAGENTA_INDEX], 50, new Color(125, 100, 125, 255));
+        setAndCheckSlider(sliders[CMYK_YELLOW_INDEX], 80, new Color(125, 100, 85, 255));
+        setAndCheckSlider(sliders[CMYK_CYAN_INDEX], 50, new Color(100, 100, 85, 255));
+        setAndCheckSlider(sliders[CMYK_BLACK_INDEX], 50, new Color(164, 164, 140, 255));
+        setAndCheckSlider(sliders[CMYK_ALPHA_INDEX], 125, new Color(164, 164, 140, 125));
+        setAndCheckSpinner(spinners[CMYK_MAGENTA_INDEX], 25, new Color(164, 184, 140, 125));
+        setAndCheckSpinner(spinners[CMYK_YELLOW_INDEX], 40, new Color(164, 184, 172, 125));
+        setAndCheckSpinner(spinners[CMYK_CYAN_INDEX], 25, new Color(184, 184, 172, 125));
+        setAndCheckSpinner(spinners[CMYK_BLACK_INDEX], 100, new Color(139, 139, 130, 125));
+        setAndCheckSpinner(spinners[CMYK_ALPHA_INDEX], 255, new Color(139, 139, 130, 255));
+    }
 
-private void checkCancelButton(JButtonOperator jbo, Color testColor) throws Exception {
-pushButtonAndInitialize(jbo);
-setAndWaitColor(testColor);
-pushButtonAndWaitDialogClosed(cancelButton);
+    private void setAndCheckSlider(JSliderOperator slider, int sliderValue, Color expectedColor) {
+        slider.setValue(sliderValue);
+        // Wait for slider to attain the specified value
+        slider.waitStateOnQueue(jSlider -> slider.getValue() == sliderValue);
+        colorChooser.waitStateOnQueue(jColorChooser -> (colorChooser.getColor().equals(expectedColor)));
+    }
+
+    private void setAndCheckSpinner(JSpinnerOperator spinner, int spinnerValue, Color expectedColor) {
+        spinner.setValue(spinnerValue);
+        // Wait for spinner to attain the specified value
+        spinner.waitStateOnQueue(jSpinner -> (int) spinner.getValue() == spinnerValue);
+        colorChooser.waitStateOnQueue(jColorChooser -> (colorChooser.getColor().equals(expectedColor)));
+    }
+
+    private void initializeSliderAndSpinner(int numberOfSlidersAndSpinners) {
+        for (int i = 0; i < numberOfSlidersAndSpinners; i++) {
+            sliders[i] = new JSliderOperator(colorChooserDialog, i);
+            spinners[i] = new JSpinnerOperator(colorChooserDialog, i);
+        }
+    }
+
+    private void pushButtonAndWaitDialogClosed(JButtonOperator button) {
+        button.push();
+        // Wait for the color chooser dialog to close.
+        colorChooserDialog.waitClosed();
+    }
 }
 
-private void checkResetButton(JButtonOperator jbo, Color testColor) throws Exception {
-pushButtonAndInitialize(jbo);
-Color initialColor = colorChooser.getColor();
-setAndWaitColor(testColor);
-resetButton.push();
-waitJColorChooserColor(initialColor);
-pushButtonAndWaitDialogClosed(okButton);
-}
-
-private void checkAllColorChoosers(JButtonOperator jbo) throws Exception {
-pushButtonAndInitialize(jbo);
-checkHSV();
-checkHSL();
-checkRGB();
-checkCMYK();
-pushButtonAndWaitDialogClosed(okButton);
-}
-
-private void waitJColorChooserColor(Color expectedColor) {
-colorChooser.waitStateOnQueue(jColorChooser -> colorChooser.getColor().equals(expectedColor));
-}
-
-private void setAndWaitColor(Color color) {
-colorChooser.setColor(color);
-// Wait for the Color to be set
-waitJColorChooserColor(color);
-}
-
-private void resetColor() {
-colorChooser.setColor(resetColor);
-// Wait for the Color to be reset
-waitJColorChooserColor(resetColor);
-}
-
-private void checkHSV() {
-tabOperator.selectPage(HSV);
-initializeSliderAndSpinner(HSV_NUMBER_OF_SLIDERS_AND_SPINNERS);
-resetColor();
-setAndCheckSlider(sliders[HSV_SATURATION_INDEX], 50, new Color(125, 62, 62));
-setAndCheckSlider(sliders[HSV_VALUE_INDEX], 80, new Color(204, 102, 102));
-setAndCheckSlider(sliders[HSV_HUE_INDEX], 50, new Color(204, 187, 102));
-setAndCheckSlider(sliders[HSV_TRANSPARENCY_INDEX], 50, new Color(204, 187, 102, 127));
-setAndCheckSpinner(spinners[HSV_SATURATION_INDEX], 25, new Color(204, 195, 153, 127));
-setAndCheckSpinner(spinners[HSV_VALUE_INDEX], 40, new Color(102, 97, 76, 127));
-setAndCheckSpinner(spinners[HSV_HUE_INDEX], 25, new Color(102, 87, 76, 127));
-setAndCheckSpinner(spinners[HSV_TRANSPARENCY_INDEX], 100, new Color(102, 87, 76, 0));
-}
-
-private void checkHSL() {
-tabOperator.selectPage(HSL);
-initializeSliderAndSpinner(HSL_NUMBER_OF_SLIDERS_AND_SPINNERS);
-resetColor();
-setAndCheckSlider(sliders[HSL_SATURATION_INDEX], 50, new Color(187, 62, 62));
-setAndCheckSlider(sliders[HSL_LIGHTNESS_INDEX], 80, new Color(229, 178, 178));
-setAndCheckSlider(sliders[HSL_HUE_INDEX], 180, new Color(178, 229, 229));
-setAndCheckSlider(sliders[HSL_TRANSPARENCY_INDEX], 50, new Color(178, 229, 229, 127));
-setAndCheckSpinner(spinners[HSL_SATURATION_INDEX], 25, new Color(191, 216, 216, 127));
-setAndCheckSpinner(spinners[HSL_LIGHTNESS_INDEX], 40, new Color(76, 127, 127, 127));
-setAndCheckSpinner(spinners[HSL_HUE_INDEX], 25, new Color(127, 97, 76, 127));
-setAndCheckSpinner(spinners[HSL_TRANSPARENCY_INDEX], 50, new Color(127, 97, 76, 127));
-}
-
-private void checkRGB() {
-String sampleColor = "111111";
-tabOperator.selectPage(RGB);
-initializeSliderAndSpinner(RGB_NUMBER_OF_SLIDERS_AND_SPINNERS);
-JTextFieldOperator colorCode = new JTextFieldOperator(colorChooserDialog, RGB_COLORCODE_TEXT_FIELD_INDEX);
-resetColor();
-setAndCheckSlider(sliders[RGB_GREEN_INDEX], 50, new Color(125, 50, 125, 255));
-setAndCheckSlider(sliders[RGB_BLUE_INDEX], 80, new Color(125, 50, 80, 255));
-setAndCheckSlider(sliders[RGB_RED_INDEX], 50, new Color(50, 50, 80, 255));
-setAndCheckSlider(sliders[RGB_ALPHA_INDEX], 125, new Color(50, 50, 80, 125));
-setAndCheckSpinner(spinners[RGB_GREEN_INDEX], 25, new Color(50, 25, 80, 125));
-setAndCheckSpinner(spinners[RGB_BLUE_INDEX], 40, new Color(50, 25, 40, 125));
-setAndCheckSpinner(spinners[RGB_RED_INDEX], 25, new Color(25, 25, 40, 125));
-setAndCheckSpinner(spinners[RGB_ALPHA_INDEX], 255, new Color(25, 25, 40, 255));
-
-colorCode.setText(sampleColor);
-// Wait for the sampleColor to be set in the color code text field.
-colorCode.waitText(sampleColor);
-colorCode.getFocus();
-colorCode.pressKey(KeyEvent.VK_TAB);
-// Wait for the color to be set
-waitJColorChooserColor(new Color(17, 17, 17, 255));
-}
-
-private void checkCMYK() {
-tabOperator.selectPage(CMYK);
-initializeSliderAndSpinner(CMYK_NUMBER_OF_SLIDERS_AND_SPINNERS);
-resetColor();
-setAndCheckSlider(sliders[CMYK_MAGENTA_INDEX], 50, new Color(125, 100, 125, 255));
-setAndCheckSlider(sliders[CMYK_YELLOW_INDEX], 80, new Color(125, 100, 85, 255));
-setAndCheckSlider(sliders[CMYK_CYAN_INDEX], 50, new Color(100, 100, 85, 255));
-setAndCheckSlider(sliders[CMYK_BLACK_INDEX], 50, new Color(164, 164, 140, 255));
-setAndCheckSlider(sliders[CMYK_ALPHA_INDEX], 125, new Color(164, 164, 140, 125));
-setAndCheckSpinner(spinners[CMYK_MAGENTA_INDEX], 25, new Color(164, 184, 140, 125));
-setAndCheckSpinner(spinners[CMYK_YELLOW_INDEX], 40, new Color(164, 184, 172, 125));
-setAndCheckSpinner(spinners[CMYK_CYAN_INDEX], 25, new Color(184, 184, 172, 125));
-setAndCheckSpinner(spinners[CMYK_BLACK_INDEX], 100, new Color(139, 139, 130, 125));
-setAndCheckSpinner(spinners[CMYK_ALPHA_INDEX], 255, new Color(139, 139, 130, 255));
-}
-
-private void setAndCheckSlider(JSliderOperator slider, int sliderValue, Color expectedColor) {
-slider.setValue(sliderValue);
-// Wait for slider to attain the specified value
-slider.waitStateOnQueue(jSlider -> slider.getValue() == sliderValue);
-colorChooser.waitStateOnQueue(jColorChooser -> (colorChooser.getColor().equals(expectedColor)));
-}
-
-private void setAndCheckSpinner(JSpinnerOperator spinner, int spinnerValue, Color expectedColor) {
-spinner.setValue(spinnerValue);
-// Wait for spinner to attain the specified value
-spinner.waitStateOnQueue(jSpinner -> (int) spinner.getValue() == spinnerValue);
-colorChooser.waitStateOnQueue(jColorChooser -> (colorChooser.getColor().equals(expectedColor)));
-}
-
-private void initializeSliderAndSpinner(int numberOfSlidersAndSpinners) {
-for (int i = 0; i < numberOfSlidersAndSpinners; i++) {
-sliders[i] = new JSliderOperator(colorChooserDialog, i);
-spinners[i] = new JSpinnerOperator(colorChooserDialog, i);
-}
-}
-
-private void pushButtonAndWaitDialogClosed(JButtonOperator button) {
-button.push();
-// Wait for the color chooser dialog to close.
-colorChooserDialog.waitClosed();
-}
-}
--- a/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/colorchooser/BezierAnimationPanel.java	Wed Jul 24 12:21:36 2019 +0530
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/colorchooser/BezierAnimationPanel.java	Wed Jul 24 12:49:44 2019 +0530
@@ -35,220 +35,221 @@
 import static com.sun.swingset3.demos.colorchooser.BezierAnimationPanel.BezierColor.*;
 
 /**
-* BezierAnimationPanel
-*
-* @author Jim Graham
-* @author Jeff Dinkins (removed dynamic setting changes, made swing friendly)
-* @version 1.16 11/17/05
-*/
+ * BezierAnimationPanel
+ *
+ * @author Jim Graham
+ * @author Jeff Dinkins (removed dynamic setting changes, made swing friendly)
+ * @version 1.16 11/17/05
+ */
 public class BezierAnimationPanel extends JPanel implements Runnable {
-public static enum BezierColor {
-BACKGROUND, OUTER, GRADIENT_A, GRADIENT_B
-}
+    public static enum BezierColor {
+        BACKGROUND, OUTER, GRADIENT_A, GRADIENT_B
+    }
+
+    private final Map<BezierColor, Color> colors = new Hashtable<BezierColor, Color>();
+
+    private GradientPaint gradient = null;
+
+    private static final int NUMPTS = 6;
+
+    private final float[] animpts = new float[NUMPTS * 2];
+
+    private final float[] deltas = new float[NUMPTS * 2];
+
+    private BufferedImage img;
 
-private final Map<BezierColor, Color> colors = new Hashtable<BezierColor, Color>();
+    private Thread anim;
+
+    private final Object lock = new Object();
 
-private GradientPaint gradient = null;
-
-private static final int NUMPTS = 6;
+    /**
+     * BezierAnimationPanel Constructor
+     */
+    public BezierAnimationPanel() {
+        setOpaque(true);
 
-private final float[] animpts = new float[NUMPTS * 2];
+        colors.put(BACKGROUND, new Color(0, 0, 153));
+        colors.put(OUTER, new Color(255, 255, 255));
+        colors.put(GRADIENT_A, new Color(255, 0, 101));
+        colors.put(GRADIENT_B, new Color(255, 255, 0));
 
-private final float[] deltas = new float[NUMPTS * 2];
-
-private BufferedImage img;
+        addHierarchyListener(new HierarchyListener() {
+            public void hierarchyChanged(HierarchyEvent e) {
+                if (isShowing()) {
+                    start();
+                } else {
+                    stop();
+                }
+            }
+        });
+    }
 
-private Thread anim;
-
-private final Object lock = new Object();
+    public Color getBezierColor(BezierColor bezierColor) {
+        return colors.get(bezierColor);
+    }
 
-/**
-* BezierAnimationPanel Constructor
-*/
-public BezierAnimationPanel() {
-setOpaque(true);
+    public void setBezierColor(BezierColor bezierColor, Color value) {
+        if (value != null) {
+            colors.put(bezierColor, value);
+        }
+    }
 
-colors.put(BACKGROUND, new Color(0, 0, 153));
-colors.put(OUTER, new Color(255, 255, 255));
-colors.put(GRADIENT_A, new Color(255, 0, 101));
-colors.put(GRADIENT_B, new Color(255, 255, 0));
+    public void start() {
+        Dimension size = getSize();
+        for (int i = 0; i < animpts.length; i += 2) {
+            animpts[i] = (float) (Math.random() * size.width);
+            animpts[i + 1] = (float) (Math.random() * size.height);
+            deltas[i] = (float) (Math.random() * 4.0 + 2.0);
+            deltas[i + 1] = (float) (Math.random() * 4.0 + 2.0);
+            if (animpts[i] > size.width / 6.0f) {
+                deltas[i] = -deltas[i];
+            }
+            if (animpts[i + 1] > size.height / 6.0f) {
+                deltas[i + 1] = -deltas[i + 1];
+            }
+        }
+        anim = new Thread(this);
+        anim.setPriority(Thread.MIN_PRIORITY);
+        anim.start();
+    }
 
-addHierarchyListener(new HierarchyListener() {
-public void hierarchyChanged(HierarchyEvent e) {
-if (isShowing()) {
-start();
-} else {
-stop();
-}
-}
-});
-}
+    public synchronized void stop() {
+        anim = null;
+        notify();
+    }
+
+    private static void animate(float[] pts, float[] deltas, int index, int limit) {
+        float newpt = pts[index] + deltas[index];
+        if (newpt <= 0) {
+            newpt = -newpt;
+            deltas[index] = (float) (Math.random() * 3.0 + 2.0);
+        } else if (newpt >= (float) limit) {
+            newpt = 2.0f * limit - newpt;
+            deltas[index] = -(float) (Math.random() * 3.0 + 2.0);
+        }
+        pts[index] = newpt;
+    }
+
+    public void run() {
+        Thread me = Thread.currentThread();
+        while (getSize().width <= 0) {
+            try {
+                Thread.sleep(500);
+            } catch (InterruptedException e) {
+                return;
+            }
+        }
 
-public Color getBezierColor(BezierColor bezierColor) {
-return colors.get(bezierColor);
-}
+        Graphics2D g2d = null;
+        Graphics2D bufferG2D = null;
+        BasicStroke solid = new BasicStroke(9.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 9.0f);
+        GeneralPath gp = new GeneralPath(GeneralPath.WIND_NON_ZERO);
+        int rule = AlphaComposite.SRC_OVER;
+        AlphaComposite opaque = AlphaComposite.SrcOver;
+        AlphaComposite blend = AlphaComposite.getInstance(rule, 0.9f);
+        AlphaComposite set = AlphaComposite.Src;
+        Dimension oldSize = getSize();
+        Shape clippath = null;
+        while (anim == me) {
+            Dimension size = getSize();
+            if (size.width != oldSize.width || size.height != oldSize.height) {
+                img = null;
+                clippath = null;
+                if (bufferG2D != null) {
+                    bufferG2D.dispose();
+                    bufferG2D = null;
+                }
+            }
+            oldSize = size;
 
-public void setBezierColor(BezierColor bezierColor, Color value) {
-if (value != null) {
-colors.put(bezierColor, value);
-}
-}
+            if (img == null) {
+                img = (BufferedImage) createImage(size.width, size.height);
+            }
+
+            if (bufferG2D == null) {
+                bufferG2D = img.createGraphics();
+                bufferG2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_DEFAULT);
+                bufferG2D.setClip(clippath);
+            }
+            g2d = bufferG2D;
 
-public void start() {
-Dimension size = getSize();
-for (int i = 0; i < animpts.length; i += 2) {
-animpts[i] = (float) (Math.random() * size.width);
-animpts[i + 1] = (float) (Math.random() * size.height);
-deltas[i] = (float) (Math.random() * 4.0 + 2.0);
-deltas[i + 1] = (float) (Math.random() * 4.0 + 2.0);
-if (animpts[i] > size.width / 6.0f) {
-deltas[i] = -deltas[i];
-}
-if (animpts[i + 1] > size.height / 6.0f) {
-deltas[i + 1] = -deltas[i + 1];
-}
-}
-anim = new Thread(this);
-anim.setPriority(Thread.MIN_PRIORITY);
-anim.start();
-}
+            float[] ctrlpts;
+            for (int i = 0; i < animpts.length; i += 2) {
+                animate(animpts, deltas, i, size.width);
+                animate(animpts, deltas, i + 1, size.height);
+            }
+            ctrlpts = animpts;
+            int len = ctrlpts.length;
+            gp.reset();
+            float prevx = ctrlpts[len - 2];
+            float prevy = ctrlpts[len - 1];
+            float curx = ctrlpts[0];
+            float cury = ctrlpts[1];
+            float midx = (curx + prevx) / 2.0f;
+            float midy = (cury + prevy) / 2.0f;
+            gp.moveTo(midx, midy);
+            for (int i = 2; i <= ctrlpts.length; i += 2) {
+                float x1 = (midx + curx) / 2.0f;
+                float y1 = (midy + cury) / 2.0f;
+                prevx = curx;
+                prevy = cury;
+                if (i < ctrlpts.length) {
+                    curx = ctrlpts[i];
+                    cury = ctrlpts[i + 1];
+                } else {
+                    curx = ctrlpts[0];
+                    cury = ctrlpts[1];
+                }
+                midx = (curx + prevx) / 2.0f;
+                midy = (cury + prevy) / 2.0f;
+                float x2 = (prevx + midx) / 2.0f;
+                float y2 = (prevy + midy) / 2.0f;
+                gp.curveTo(x1, y1, x2, y2, midx, midy);
+            }
+            gp.closePath();
 
-public synchronized void stop() {
-anim = null;
-notify();
-}
+            synchronized (lock) {
+                g2d.setComposite(set);
+                g2d.setBackground(getBezierColor(BACKGROUND));
+                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+
+                // g2d.clearRect(bounds.x-5, bounds.y-5, bounds.x + bounds.width
+                // + 5, bounds.y + bounds.height + 5);
+                g2d.clearRect(0, 0, getWidth(), getHeight());
+
+                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+                g2d.setColor(getBezierColor(OUTER));
+                g2d.setComposite(opaque);
+                g2d.setStroke(solid);
+                g2d.draw(gp);
+                g2d.setPaint(gradient);
+
+                Rectangle bounds = gp.getBounds();
+
+                gradient = new GradientPaint(bounds.x, bounds.y, getBezierColor(GRADIENT_A), bounds.x + bounds.width,
+                        bounds.y + bounds.height, getBezierColor(GRADIENT_B), true);
 
-private static void animate(float[] pts, float[] deltas, int index, int limit) {
-float newpt = pts[index] + deltas[index];
-if (newpt <= 0) {
-newpt = -newpt;
-deltas[index] = (float) (Math.random() * 3.0 + 2.0);
-} else if (newpt >= (float) limit) {
-newpt = 2.0f * limit - newpt;
-deltas[index] = -(float) (Math.random() * 3.0 + 2.0);
-}
-pts[index] = newpt;
-}
+                g2d.setComposite(blend);
+                g2d.fill(gp);
+            }
+
+            repaint();
 
-public void run() {
-Thread me = Thread.currentThread();
-while (getSize().width <= 0) {
-try {
-Thread.sleep(500);
-} catch (InterruptedException e) {
-return;
-}
+            Thread.yield();
+        }
+        if (g2d != null) {
+            g2d.dispose();
+        }
+    }
+
+    public void paint(Graphics g) {
+        synchronized (lock) {
+            Graphics2D g2d = (Graphics2D) g;
+            if (img != null) {
+                g2d.setComposite(AlphaComposite.Src);
+                g2d.drawImage(img, null, 0, 0);
+            }
+        }
+    }
 }
 
-Graphics2D g2d = null;
-Graphics2D bufferG2D = null;
-BasicStroke solid = new BasicStroke(9.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 9.0f);
-GeneralPath gp = new GeneralPath(GeneralPath.WIND_NON_ZERO);
-int rule = AlphaComposite.SRC_OVER;
-AlphaComposite opaque = AlphaComposite.SrcOver;
-AlphaComposite blend = AlphaComposite.getInstance(rule, 0.9f);
-AlphaComposite set = AlphaComposite.Src;
-Dimension oldSize = getSize();
-Shape clippath = null;
-while (anim == me) {
-Dimension size = getSize();
-if (size.width != oldSize.width || size.height != oldSize.height) {
-img = null;
-clippath = null;
-if (bufferG2D != null) {
-bufferG2D.dispose();
-bufferG2D = null;
-}
-}
-oldSize = size;
-
-if (img == null) {
-img = (BufferedImage) createImage(size.width, size.height);
-}
-
-if (bufferG2D == null) {
-bufferG2D = img.createGraphics();
-bufferG2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_DEFAULT);
-bufferG2D.setClip(clippath);
-}
-g2d = bufferG2D;
-
-float[] ctrlpts;
-for (int i = 0; i < animpts.length; i += 2) {
-animate(animpts, deltas, i, size.width);
-animate(animpts, deltas, i + 1, size.height);
-}
-ctrlpts = animpts;
-int len = ctrlpts.length;
-gp.reset();
-float prevx = ctrlpts[len - 2];
-float prevy = ctrlpts[len - 1];
-float curx = ctrlpts[0];
-float cury = ctrlpts[1];
-float midx = (curx + prevx) / 2.0f;
-float midy = (cury + prevy) / 2.0f;
-gp.moveTo(midx, midy);
-for (int i = 2; i <= ctrlpts.length; i += 2) {
-float x1 = (midx + curx) / 2.0f;
-float y1 = (midy + cury) / 2.0f;
-prevx = curx;
-prevy = cury;
-if (i < ctrlpts.length) {
-curx = ctrlpts[i];
-cury = ctrlpts[i + 1];
-} else {
-curx = ctrlpts[0];
-cury = ctrlpts[1];
-}
-midx = (curx + prevx) / 2.0f;
-midy = (cury + prevy) / 2.0f;
-float x2 = (prevx + midx) / 2.0f;
-float y2 = (prevy + midy) / 2.0f;
-gp.curveTo(x1, y1, x2, y2, midx, midy);
-}
-gp.closePath();
-
-synchronized (lock) {
-g2d.setComposite(set);
-g2d.setBackground(getBezierColor(BACKGROUND));
-g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
-
-// g2d.clearRect(bounds.x-5, bounds.y-5, bounds.x + bounds.width
-// + 5, bounds.y + bounds.height + 5);
-g2d.clearRect(0, 0, getWidth(), getHeight());
-
-g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
-g2d.setColor(getBezierColor(OUTER));
-g2d.setComposite(opaque);
-g2d.setStroke(solid);
-g2d.draw(gp);
-g2d.setPaint(gradient);
-
-Rectangle bounds = gp.getBounds();
-
-gradient = new GradientPaint(bounds.x, bounds.y, getBezierColor(GRADIENT_A), bounds.x + bounds.width,
-bounds.y + bounds.height, getBezierColor(GRADIENT_B), true);
-
-g2d.setComposite(blend);
-g2d.fill(gp);
-}
-
-repaint();
-
-Thread.yield();
-}
-if (g2d != null) {
-g2d.dispose();
-}
-}
-
-public void paint(Graphics g) {
-synchronized (lock) {
-Graphics2D g2d = (Graphics2D) g;
-if (img != null) {
-g2d.setComposite(AlphaComposite.Src);
-g2d.drawImage(img, null, 0, 0);
-}
-}
-}
-}
\ No newline at end of file