jdk/test/javax/swing/JWindow/ShapedAndTranslucentWindows/TranslucentJComboBox.java
author hseigel
Wed, 01 Mar 2017 08:00:02 -0500
changeset 46194 5596e6f63072
parent 39056 d99e63b6d962
permissions -rw-r--r--
8172307: Remove ununsed JVM API JVM_GetModuleByPackageName() Summary: Remove get_module_by_package_name() etc., and unneeded test. Reviewed-by: sspitsyn, gtriantafill
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26601
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
     1
/*
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 26601
diff changeset
     2
 * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
26601
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
     4
 *
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
     8
 *
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    13
 * accompanied this code).
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    14
 *
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    18
 *
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    21
 * questions.
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    22
 */
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    23
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    24
import javax.swing.*;
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    25
import java.awt.*;
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    26
import java.awt.event.MouseAdapter;
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    27
import java.awt.event.MouseEvent;
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    28
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    29
/*
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    30
 * @test
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 26601
diff changeset
    31
 * @key headful
26601
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    32
 * @bug 8024627
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    33
 * @summary Check if a JComboBox present in a window set with opacity less than
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    34
 *          1.0 shows a translucent drop down
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    35
 * Test Description: Check if TRANSLUCENT translucency type is supported on the
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    36
 *      current platform. Proceed if supported. Show a window which contains an
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    37
 *      JComboBox and set with opacity less than 1.0. Another Window having a canvas
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    38
 *      component drawn with an image can be used as the background for the test
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    39
 *      window. Click on the ComboBox to show the drop down. Check if the drop down
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    40
 *      appears translucent. Repeat this for JWindow, JDialog and JFrame
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    41
 * Expected Result: If TRANSLUCENT Translucency type is supported, the drop down
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    42
 *      should appear translucent.
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    43
 * @author mrkam
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    44
 * @library ../../../../lib/testlibrary
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    45
 * @build Common ExtendedRobot
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    46
 * @run main TranslucentJComboBox
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    47
 */
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    48
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    49
public class TranslucentJComboBox extends Common {
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    50
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    51
    JComponent south;
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    52
    JComponent center;
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    53
    JPanel north;
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    54
    volatile boolean southClicked = false;
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    55
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    56
    public static void main(String[] args) throws Exception {
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    57
        if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.TRANSLUCENT))
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    58
            for (Class<Window> windowClass: WINDOWS_TO_TEST)
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    59
                new TranslucentJComboBox(windowClass).doTest();
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    60
    }
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    61
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    62
    public TranslucentJComboBox(Class windowClass) throws Exception {
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    63
        super(windowClass, 0.3f, 1.0f, false);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    64
    }
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    65
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    66
    @Override
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    67
    public void initBackgroundFrame() {
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    68
        super.initBackgroundFrame();
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    69
    }
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    70
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    71
    @Override
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    72
    public void createSwingComponents() {
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    73
        Container contentPane = RootPaneContainer.class.cast(window).getContentPane();
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    74
        window.setLayout(new BorderLayout());
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    75
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    76
        north = new JPanel();
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    77
        contentPane.add(north, BorderLayout.NORTH);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    78
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    79
        center = new JList(new String [] { "Center" });
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    80
        contentPane.add(center, BorderLayout.CENTER);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    81
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    82
        JComboBox jComboBox = new JComboBox();
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    83
        for(int i = 0; i < 20; i++) {
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    84
            jComboBox.addItem("item " + i);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    85
        }
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    86
        south = jComboBox;
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    87
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    88
        south.addMouseListener(new MouseAdapter() {
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    89
            @Override
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    90
            public void mouseClicked(MouseEvent e) {
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    91
                southClicked = true;
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    92
            }
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    93
        });
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    94
        contentPane.add(south, BorderLayout.SOUTH);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    95
    }
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    96
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    97
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    98
    @Override
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
    99
    public void doTest() throws Exception {
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   100
        robot.waitForIdle(delay);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   101
        // Make window an active
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   102
        Point ls = north.getLocationOnScreen();
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   103
        robot.mouseMove(ls.x + north.getWidth()/2, ls.y + north.getHeight()/2);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   104
        robot.click();
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   105
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   106
        // Invoke list
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   107
        ls = south.getLocationOnScreen();
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   108
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   109
        Point p1 = new Point(
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   110
                (int) (ls.x + south.getWidth() * 0.75),
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   111
                ls.y + south.getHeight() * 3);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   112
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   113
        Point p2 = new Point(
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   114
                (int) (ls.x + south.getWidth() * 0.75),
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   115
                ls.y - south.getHeight() * 2);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   116
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   117
        Color c1 = robot.getPixelColor(p1.x, p1.y);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   118
        Color c2 = robot.getPixelColor(p2.x, p2.y);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   119
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   120
        int x = ls.x + south.getWidth()/2;
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   121
        int y = ls.y + south.getHeight()/2;
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   122
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   123
        System.out.println("Trying to click point "+x+", "+y+
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   124
                ", looking for flag to trigger.");
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   125
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   126
        robot.mouseMove(x, y);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   127
        robot.waitForIdle(delay);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   128
        robot.click();
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   129
        robot.waitForIdle(delay);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   130
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   131
        if (!southClicked)
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   132
            throw new RuntimeException("Flag is not triggered for point "+x+", "+y+"!");
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   133
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   134
        robot.waitForIdle();
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   135
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   136
        Color c1b = robot.getPixelColor(p1.x, p1.y);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   137
        Color c2b = robot.getPixelColor(p2.x, p2.y);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   138
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   139
        if (!c1.equals(c1b) && !south.getBackground().equals(c1b))
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   140
            throw new RuntimeException(
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   141
                    "Check for opaque drop down failed at point " + p1 +
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   142
                            ". Before click: " + c1 + ", after click: " + c1b +
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   143
                            ", expected is " + south.getBackground());
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   144
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   145
        if (!c2.equals(c2b) && !south.getBackground().equals(c2b))
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   146
            throw new RuntimeException(
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   147
                    "Check for opaque drop down failed at point " + p2 +
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   148
                            ". Before click: " + c2 + ", after click: " + c2b +
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   149
                            ", expected is " + south.getBackground());
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   150
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   151
        EventQueue.invokeAndWait(this::dispose);
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   152
    }
2713482c0fd3 8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff changeset
   153
}