< prev index next >

test/javax/swing/JInternalFrame/8160248/JInternalFrameDraggingTest.java

Print this page
rev 17561 : 8185500: [TESTBUG] Add keywords headful/printer in java/awt and javax tests.
Summary: Add new keyword 'printer'. Some minor test fixes to show headless exception. Add some @requires windows.
   1 /*
   2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.BorderLayout;
  25 import java.awt.Color;
  26 import java.awt.Point;
  27 import java.awt.Rectangle;
  28 import java.awt.Robot;
  29 import java.awt.event.InputEvent;
  30 import java.awt.image.BufferedImage;
  31 import javax.swing.JDesktopPane;
  32 import javax.swing.JFrame;
  33 import javax.swing.JInternalFrame;
  34 import javax.swing.SwingUtilities;
  35 
  36 /**
  37  * @test

  38  * @bug 8160248 8160332
  39  * @summary Dragged internal frame leaves artifacts for floating point ui scale
  40  * @run main/othervm -Dsun.java2d.uiScale=1.2 JInternalFrameDraggingTest
  41  * @run main/othervm -Dsun.java2d.uiScale=1.5 JInternalFrameDraggingTest
  42  * @run main/othervm -Dsun.java2d.uiScale=1 JInternalFrameDraggingTest
  43  * @run main/othervm -Dsun.java2d.uiScale=2.5 JInternalFrameDraggingTest
  44  */

  45 public class JInternalFrameDraggingTest {
  46 
  47     private static JFrame frame;
  48     private static JDesktopPane desktopPane;
  49     private static JInternalFrame internalFrame;
  50     private static int FRAME_SIZE = 500;
  51     private static Color BACKGROUND_COLOR = Color.ORANGE;
  52 
  53     public static void main(String[] args) throws Exception {
  54 
  55         Robot robot = new Robot();
  56         robot.setAutoDelay(20);
  57         SwingUtilities.invokeAndWait(JInternalFrameDraggingTest::createAndShowGUI);
  58         robot.waitForIdle();
  59 
  60         final int translate = FRAME_SIZE / 4;
  61         moveFrame(robot, translate, translate / 2, translate / 2);
  62         robot.waitForIdle();
  63 
  64         Point p = getDesktopPaneLocation();


   1 /*
   2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.BorderLayout;
  25 import java.awt.Color;
  26 import java.awt.Point;
  27 import java.awt.Rectangle;
  28 import java.awt.Robot;
  29 import java.awt.event.InputEvent;
  30 import java.awt.image.BufferedImage;
  31 import javax.swing.JDesktopPane;
  32 import javax.swing.JFrame;
  33 import javax.swing.JInternalFrame;
  34 import javax.swing.SwingUtilities;
  35 
  36 /**
  37  * @test
  38  * @key headful
  39  * @bug 8160248 8160332
  40  * @summary Dragged internal frame leaves artifacts for floating point ui scale
  41  * @run main/othervm -Dsun.java2d.uiScale=1.2 JInternalFrameDraggingTest
  42  * @run main/othervm -Dsun.java2d.uiScale=1.5 JInternalFrameDraggingTest
  43  * @run main/othervm -Dsun.java2d.uiScale=1 JInternalFrameDraggingTest
  44  * @run main/othervm -Dsun.java2d.uiScale=2.5 JInternalFrameDraggingTest
  45  */
  46 
  47 public class JInternalFrameDraggingTest {
  48 
  49     private static JFrame frame;
  50     private static JDesktopPane desktopPane;
  51     private static JInternalFrame internalFrame;
  52     private static int FRAME_SIZE = 500;
  53     private static Color BACKGROUND_COLOR = Color.ORANGE;
  54 
  55     public static void main(String[] args) throws Exception {
  56 
  57         Robot robot = new Robot();
  58         robot.setAutoDelay(20);
  59         SwingUtilities.invokeAndWait(JInternalFrameDraggingTest::createAndShowGUI);
  60         robot.waitForIdle();
  61 
  62         final int translate = FRAME_SIZE / 4;
  63         moveFrame(robot, translate, translate / 2, translate / 2);
  64         robot.waitForIdle();
  65 
  66         Point p = getDesktopPaneLocation();


< prev index next >