jdk/test/java/awt/datatransfer/SystemSelection/SystemSelectionAWTTest.java
author goetz
Tue, 14 Jun 2016 10:44:59 +0200
changeset 39056 d99e63b6d962
parent 25569 2bea87828632
permissions -rw-r--r--
8159690: [TESTBUG] Mark headful tests with @key headful. Reviewed-by: simonis, alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25569
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
     1
/*
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 25569
diff changeset
     2
 * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
25569
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
     4
 *
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    10
 *
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    15
 * accompanied this code).
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    16
 *
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    20
 *
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    23
 * questions.
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    24
 */
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    25
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    26
import java.awt.*;
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    27
import java.awt.datatransfer.Clipboard;
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    28
import java.awt.datatransfer.DataFlavor;
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    29
import java.awt.datatransfer.Transferable;
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    30
import java.awt.event.FocusAdapter;
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    31
import java.awt.event.FocusEvent;
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    32
import java.awt.event.InputEvent;
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    33
import java.util.Properties;
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    34
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    35
/*
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    36
 * @test
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 25569
diff changeset
    37
 * @key headful
25569
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    38
 * @summary To check the functionality of newly added API getSystemSelection & make sure
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    39
 *          that it's mapped to primary clipboard
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    40
 * @author Jitender(jitender.singh@eng.sun.com) area=AWT
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    41
 * @library ../../../../lib/testlibrary
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    42
 * @build ExtendedRobot
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    43
 * @run main SystemSelectionAWTTest
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    44
 */
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    45
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    46
public class SystemSelectionAWTTest {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    47
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    48
    Frame frame;
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    49
    TextField tf1, tf2;
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    50
    Clipboard clip;
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    51
    Transferable t;
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    52
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    53
    public static void main(String[] args) throws Exception {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    54
        new SystemSelectionAWTTest().doTest();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    55
    }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    56
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    57
    SystemSelectionAWTTest() {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    58
        frame = new Frame();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    59
        frame.setSize(200, 200);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    60
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    61
        tf1 = new TextField();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    62
        tf1.addFocusListener( new FocusAdapter() {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    63
            public void focusGained(FocusEvent fe) {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    64
                fe.getSource();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    65
            }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    66
        });
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    67
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    68
        tf2 = new TextField();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    69
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    70
        frame.add(tf2, BorderLayout.NORTH);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    71
        frame.add(tf1, BorderLayout.CENTER);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    72
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    73
        frame.setVisible(true);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    74
        frame.toFront();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    75
        tf1.requestFocus();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    76
        tf1.setText("Selection Testing");
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    77
    }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    78
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    79
    // Check whether Security manager is there
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    80
    public void checkSecurity() {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    81
        SecurityManager sm = System.getSecurityManager();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    82
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    83
        if (sm == null) {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    84
            System.out.println("security manager is not there");
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    85
            getPrimaryClipboard();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    86
        } else {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    87
            try {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    88
                sm.checkPermission(new AWTPermission("accessClipboard"));
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    89
                getPrimaryClipboard();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    90
            } catch(SecurityException e) {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    91
                clip = null;
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    92
                System.out.println("Access to System selection is not allowed");
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    93
            }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    94
        }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    95
    }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    96
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    97
    // Get the contents from the clipboard
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    98
    void getClipboardContent() throws Exception {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
    99
        t = clip.getContents(this);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   100
        if ( (t != null) && (t.isDataFlavorSupported(DataFlavor.stringFlavor) )) {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   101
            tf2.setBackground(Color.red);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   102
            tf2.setForeground(Color.black);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   103
            tf2.setText((String) t.getTransferData(DataFlavor.stringFlavor));
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   104
        }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   105
    }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   106
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   107
    // Get System Selection i.e. Primary Clipboard
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   108
    private void getPrimaryClipboard() {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   109
        Properties ps = System.getProperties();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   110
        String operSys = ps.getProperty("os.name");
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   111
        clip = Toolkit.getDefaultToolkit().getSystemSelection();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   112
        if (clip == null) {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   113
            if ((operSys.substring(0,3)).equalsIgnoreCase("Win") ||
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   114
                    (operSys.substring(0,3)).equalsIgnoreCase("Mac"))
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   115
                System.out.println(operSys + " operating system does not support system selection ");
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   116
            else
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   117
                throw new RuntimeException("Method getSystemSelection() is returning null on X11 platform");
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   118
        }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   119
    }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   120
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   121
    // Compare the selected text with one pasted from the clipboard
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   122
    public void compareText() {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   123
        if ((tf2.getText()).equals(tf1.getSelectedText()) &&
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   124
                System.getProperties().getProperty("os.name").substring(0,3) != "Win") {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   125
            System.out.println("Selected text & clipboard contents are same\n");
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   126
        } else  {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   127
            throw new RuntimeException("Selected text & clipboard contents differs\n");
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   128
        }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   129
    }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   130
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   131
    public void doTest() throws Exception {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   132
        ExtendedRobot robot = new ExtendedRobot();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   133
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   134
        frame.setLocation(100, 100);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   135
        robot.waitForIdle(2000);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   136
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   137
        Point tf1Location = tf1.getLocationOnScreen();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   138
        Dimension tf1Size = tf1.getSize();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   139
        checkSecurity();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   140
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   141
        if (clip != null) {
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   142
            robot.mouseMove(tf1Location.x + 5, tf1Location.y + tf1Size.height / 2);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   143
            robot.waitForIdle(2000);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   144
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   145
            robot.waitForIdle(20);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   146
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   147
            robot.waitForIdle(20);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   148
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   149
            robot.waitForIdle(20);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   150
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   151
            robot.waitForIdle(2000);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   152
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   153
            getClipboardContent();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   154
            compareText();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   155
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   156
            robot.mouseMove(tf1Location.x + tf1Size.width / 2, tf1Location.y + tf1Size.height / 2);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   157
            robot.waitForIdle(2000);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   158
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   159
            robot.waitForIdle(20);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   160
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   161
            robot.waitForIdle(20);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   162
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   163
            robot.waitForIdle(20);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   164
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   165
            robot.waitForIdle(2000);
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   166
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   167
            getClipboardContent();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   168
            compareText();
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   169
        }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   170
    }
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   171
}
2bea87828632 8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff changeset
   172