jdk/test/sun/java2d/OpenGL/CopyAreaOOB.java
author goetz
Tue, 14 Jun 2016 10:44:59 +0200
changeset 39056 d99e63b6d962
parent 32677 171c6332a2cd
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:
32677
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
     1
/*
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
     4
 *
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
     7
 * published by the Free Software Foundation.
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
     8
 *
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    13
 * accompanied this code).
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    14
 *
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    18
 *
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    21
 * questions.
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    22
 */
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    23
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    24
/*
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    25
 * @test
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 32677
diff changeset
    26
 * @key headful
32677
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    27
 * @bug 6430601
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    28
 * @summary Verifies that copyArea() works properly when the
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    29
 * destination parameters are outside the destination bounds.
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    30
 * @run main/othervm CopyAreaOOB
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    31
 * @run main/othervm -Dsun.java2d.opengl=True CopyAreaOOB
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    32
 * @author campbelc
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    33
 */
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    34
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    35
import java.awt.*;
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    36
import java.awt.image.*;
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    37
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    38
public class CopyAreaOOB extends Canvas {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    39
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    40
    private static boolean done;
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    41
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    42
    public void paint(Graphics g) {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    43
        synchronized (this) {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    44
            if (done) {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    45
                return;
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    46
            }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    47
        }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    48
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    49
        int w = getWidth();
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    50
        int h = getHeight();
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    51
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    52
        Graphics2D g2d = (Graphics2D)g;
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    53
        g2d.setColor(Color.black);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    54
        g2d.fillRect(0, 0, w, h);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    55
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    56
        g2d.setColor(Color.green);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    57
        g2d.fillRect(0, 0, w, 10);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    58
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    59
        g2d.setColor(Color.red);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    60
        g2d.fillRect(0, 10, 50, h-10);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    61
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    62
        // copy the region such that part of it goes below the bottom of the
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    63
        // destination surface
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    64
        g2d.copyArea(0, 10, 50, h-10, 60, 10);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    65
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    66
        Toolkit.getDefaultToolkit().sync();
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    67
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    68
        synchronized (this) {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    69
            done = true;
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    70
            notifyAll();
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    71
        }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    72
    }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    73
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    74
    public Dimension getPreferredSize() {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    75
        return new Dimension(400, 400);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    76
    }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    77
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    78
    private static void testRegion(BufferedImage bi, String name,
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    79
                                   int x1, int y1, int x2, int y2,
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    80
                                   int expected)
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    81
    {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    82
        for (int y = y1; y < y2; y++) {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    83
            for (int x = x1; x < x2; x++) {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    84
                int actual = bi.getRGB(x, y);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    85
                if (actual != expected) {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    86
                    throw new RuntimeException("Test failed for " + name +
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    87
                                                       " region at x="+x+" y="+y+
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    88
                                                       " (expected="+
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    89
                                                       Integer.toHexString(expected) +
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    90
                                                       " actual="+
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    91
                                                       Integer.toHexString(actual) +
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    92
                                                       ")");
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    93
                }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    94
            }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    95
        }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    96
    }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    97
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    98
    public static void main(String[] args) {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
    99
        boolean show = (args.length == 1) && ("-show".equals(args[0]));
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   100
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   101
        CopyAreaOOB test = new CopyAreaOOB();
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   102
        Frame frame = new Frame();
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   103
        frame.setUndecorated(true);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   104
        frame.add(test);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   105
        frame.pack();
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   106
        frame.setLocationRelativeTo(null);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   107
        frame.setVisible(true);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   108
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   109
        // Wait until the component's been painted
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   110
        synchronized (test) {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   111
            while (!done) {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   112
                try {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   113
                    test.wait();
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   114
                } catch (InterruptedException e) {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   115
                    throw new RuntimeException("Failed: Interrupted");
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   116
                }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   117
            }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   118
        }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   119
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   120
        try {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   121
            Thread.sleep(2000);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   122
        } catch (InterruptedException ex) {}
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   123
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   124
        // Grab the screen region
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   125
        BufferedImage capture = null;
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   126
        try {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   127
            Robot robot = new Robot();
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   128
            Point pt1 = test.getLocationOnScreen();
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   129
            Rectangle rect = new Rectangle(pt1.x, pt1.y, 400, 400);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   130
            capture = robot.createScreenCapture(rect);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   131
        } catch (Exception e) {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   132
            throw new RuntimeException("Problems creating Robot");
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   133
        } finally {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   134
            if (!show) {
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   135
                frame.dispose();
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   136
            }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   137
        }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   138
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   139
        // Test pixels
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   140
        testRegion(capture, "green",          0,   0, 400,  10, 0xff00ff00);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   141
        testRegion(capture, "original red",   0,  10,  50, 400, 0xffff0000);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   142
        testRegion(capture, "background",    50,  10,  60, 400, 0xff000000);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   143
        testRegion(capture, "in-between",    60,  10, 110,  20, 0xff000000);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   144
        testRegion(capture, "copied red",    60,  20, 110, 400, 0xffff0000);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   145
        testRegion(capture, "background",   110,  10, 400, 400, 0xff000000);
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   146
    }
171c6332a2cd 7131835: [TEST_BUG] Test does not consider that the rounded edges of the window in Mac OS 10.7
serb
parents:
diff changeset
   147
}