test/jdk/java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.java
author jdv
Wed, 15 May 2019 10:10:53 +0530
branchmetal-prototype-branch
changeset 57357 f3beca8f19fc
parent 52739 7199c4da1a6f
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51165
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
     1
/*
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
     4
 *
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
     7
 * published by the Free Software Foundation.
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
     8
 *
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    13
 * accompanied this code).
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    14
 *
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    18
 *
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    21
 * questions.
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    22
 */
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    23
import java.awt.TrayIcon;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    24
import java.awt.SystemTray;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    25
import java.awt.EventQueue;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    26
import java.awt.Point;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    27
import java.awt.AWTException;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    28
import java.awt.event.MouseEvent;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    29
import java.awt.event.ActionEvent;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    30
import java.awt.event.ActionListener;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    31
import java.awt.event.InputEvent;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    32
import java.awt.event.MouseAdapter;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    33
import java.awt.image.BufferedImage;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    34
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    35
/*
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    36
 * @test
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    37
 * @bug 6271624 8195991
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    38
 * @key headful
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    39
 * @summary Right clicking on TrayIcon shouldn't trigger ActionEvent when balloon is displayed.
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    40
 * @modules java.desktop/java.awt:open
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    41
 * @library /java/awt/patchlib
52739
7199c4da1a6f 8186549: move ExtendedRobot closer to tests
shurailine
parents: 51165
diff changeset
    42
 * @library /lib/client ../
51165
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    43
 * @build java.desktop/java.awt.Helper
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    44
 * @build ExtendedRobot SystemTrayIconHelper
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    45
 * @run main RightClickWhenBalloonDisplayed
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    46
 */
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    47
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    48
public class RightClickWhenBalloonDisplayed {
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    49
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    50
    TrayIcon icon;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    51
    ExtendedRobot robot;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    52
    int actionPerformedCount = -1;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    53
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    54
    public static void main(String[] args) throws Exception {
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    55
        if (!SystemTray.isSupported()) {
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    56
            System.out.println("SystemTray not supported on the platform under test. " +
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    57
                    "Marking the test passed");
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    58
        } else {
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    59
            if (System.getProperty("os.name").toLowerCase().startsWith("win"))
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    60
                System.err.println("Test can fail if the icon hides to a tray icons pool " +
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    61
                        "in Windows 7/10, which is behavior by default.\n" +
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    62
                        "Set \"Right mouse click\" -> \"Customize notification icons\" -> " +
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    63
                        "\"Always show all icons and notifications on the taskbar\" true " +
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    64
                        "to avoid this problem. Or change behavior only for Java SE " +
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    65
                        "tray icon.");
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    66
            new RightClickWhenBalloonDisplayed().doTest();
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    67
        }
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    68
    }
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    69
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    70
    RightClickWhenBalloonDisplayed() throws Exception {
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    71
        robot = new ExtendedRobot();
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    72
        EventQueue.invokeAndWait(this::initializeGUI);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    73
        robot.waitForIdle(1000);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    74
    }
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    75
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    76
    private void initializeGUI() {
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    77
        SystemTray tray = SystemTray.getSystemTray();
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    78
        icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), "Sample Icon");
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    79
        icon.addMouseListener(new MouseAdapter() {
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    80
            public void mousePressed(MouseEvent event) {
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    81
                icon.displayMessage("Sample Icon", "This is a test message for the tray icon", TrayIcon.MessageType.INFO);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    82
            }
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    83
        });
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    84
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    85
        try {
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    86
            tray.add(icon);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    87
        } catch (AWTException e) {
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    88
            throw new RuntimeException(e);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    89
        }
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    90
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    91
        icon.getActionCommand();
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    92
        icon.addActionListener(new ActionListener() {
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    93
            @Override
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    94
            public void actionPerformed(ActionEvent e) {
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    95
                actionPerformedCount++;
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    96
            }
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    97
        });
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    98
    }
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
    99
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   100
    void doTest() throws Exception {
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   101
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   102
        Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   103
        if (iconPosition == null)
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   104
            throw new RuntimeException("Unable to find the icon location!");
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   105
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   106
        // Do left click to start displaying the message
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   107
        robot.delay(50);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   108
        robot.mouseMove(iconPosition.x, iconPosition.y);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   109
        robot.waitForIdle();
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   110
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   111
        robot.delay(50);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   112
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   113
        robot.delay(1000);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   114
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   115
        // Do right click
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   116
        robot.mousePress(InputEvent.BUTTON3_DOWN_MASK);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   117
        robot.delay(50);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   118
        robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   119
        robot.delay(50);
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   120
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   121
        if (actionPerformedCount > 0)
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   122
            throw new RuntimeException("FAIL: ActionEvent triggered when " +
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   123
                    "the tray icon was right clicked and at the same time the tray icon message is displayed");
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   124
    }
6d59a6d025e8 8195991: [TEST_BUG]:Regression manual Test java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed.html fails
sveerabhadra
parents:
diff changeset
   125
}