< prev index next >

test/jdk/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.java

Print this page


   1 /*
   2  * Copyright (c) 2013, 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 /*
  25   test

  26   @bug 8029565
  27   @summary Conversion of a URI list to File list fails
  28   @author Petr Pchelko <petr.pchelko@oracle.com>
  29   @library ../../regtesthelpers
  30   @library ../../regtesthelpers/process
  31   @build Util
  32   @build ProcessResults ProcessCommunicator
  33   @run applet/othervm URIListToFileListBetweenJVMsTest.html
  34  */
  35 
  36 /**
  37  * URIListToFileListBetweenJVMsTest.java
  38  *
  39  * summary: DnD of File-List across JVM adds two empty items to the list
  40  */
  41 
  42 import test.java.awt.regtesthelpers.Util;
  43 import test.java.awt.regtesthelpers.process.ProcessCommunicator;
  44 import test.java.awt.regtesthelpers.process.ProcessResults;
  45 
  46 import java.applet.Applet;
  47 import java.awt.*;
  48 import java.awt.event.InputEvent;
  49 
  50 import static java.lang.Thread.sleep;
  51 
  52 public class URIListToFileListBetweenJVMsTest extends Applet {
  53 
  54     // information related to the test in common
  55     static int VISIBLE_RAWS_IN_LIST=15;
  56 
  57     public void init() {
  58         setLayout(new BorderLayout());
  59     }
  60 
  61     public void start() {
  62 
  63         SourceFileListFrame sourceFrame = new SourceFileListFrame();
  64 
  65         Util.waitForIdle(null);
  66 
  67         String [] args = new String [] {
  68                 String.valueOf(sourceFrame.getNextLocationX()),
  69                 String.valueOf(sourceFrame.getNextLocationY()),
  70                 String.valueOf(sourceFrame.getDragSourcePointX()),
  71                 String.valueOf(sourceFrame.getDragSourcePointY()),
  72                 String.valueOf(sourceFrame.getSourceFilesNumber())
  73         };
  74 
  75         ProcessResults processResults = ProcessCommunicator.executeChildProcess(this.getClass(), args);
  76 
  77         verifyTestResults(processResults);
  78 
  79     }
  80 


 110         sleep(100);
 111         robot.mouseRelease(InputEvent.BUTTON1_MASK);
 112         sleep(100);
 113 
 114         Util.drag(robot, dragSourcePoint, targetFrame.getDropTargetPoint(), InputEvent.BUTTON1_MASK);
 115 
 116     }
 117 
 118     enum InterprocessArguments {
 119         TARGET_FRAME_X_POSITION_ARGUMENT,
 120         TARGET_FRAME_Y_POSITION_ARGUMENT,
 121         DRAG_SOURCE_POINT_X_ARGUMENT,
 122         DRAG_SOURCE_POINT_Y_ARGUMENT,
 123         FILES_IN_THE_LIST_NUMBER_ARGUMENT;
 124 
 125         int extract (String [] args) {
 126             return Integer.parseInt(args[this.ordinal()]);
 127         }
 128     }
 129 
 130     public static void main (String [] args) throws Exception {




 131         Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extract(args),
 132                 InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extract(args));
 133         Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extract(args),
 134                 InterprocessArguments.TARGET_FRAME_Y_POSITION_ARGUMENT.extract(args));
 135         int transferredFilesNumber = InterprocessArguments.FILES_IN_THE_LIST_NUMBER_ARGUMENT.extract(args);
 136 
 137         new URIListToFileListBetweenJVMsTest(targetFrameLocation, dragSourcePoint, transferredFilesNumber);
 138     }
 139 }
   1 /*
   2  * Copyright (c) 2013, 2018, 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 /*
  25   @test
  26   @key headful
  27   @bug 8029565
  28   @summary Conversion of a URI list to File list fails

  29   @library ../../regtesthelpers
  30   @library ../../regtesthelpers/process
  31   @build Util
  32   @build ProcessResults ProcessCommunicator
  33   @run main/othervm URIListToFileListBetweenJVMsTest main






  34  */
  35 
  36 import test.java.awt.regtesthelpers.Util;
  37 import test.java.awt.regtesthelpers.process.ProcessCommunicator;
  38 import test.java.awt.regtesthelpers.process.ProcessResults;
  39 

  40 import java.awt.*;
  41 import java.awt.event.InputEvent;
  42 
  43 import static java.lang.Thread.sleep;
  44 
  45 public class URIListToFileListBetweenJVMsTest {
  46 
  47     // information related to the test in common
  48     static int VISIBLE_RAWS_IN_LIST=15;
  49 




  50     public void start() {
  51 
  52         SourceFileListFrame sourceFrame = new SourceFileListFrame();
  53 
  54         Util.waitForIdle(null);
  55 
  56         String [] args = new String [] {
  57                 String.valueOf(sourceFrame.getNextLocationX()),
  58                 String.valueOf(sourceFrame.getNextLocationY()),
  59                 String.valueOf(sourceFrame.getDragSourcePointX()),
  60                 String.valueOf(sourceFrame.getDragSourcePointY()),
  61                 String.valueOf(sourceFrame.getSourceFilesNumber())
  62         };
  63 
  64         ProcessResults processResults = ProcessCommunicator.executeChildProcess(this.getClass(), args);
  65 
  66         verifyTestResults(processResults);
  67 
  68     }
  69 


  99         sleep(100);
 100         robot.mouseRelease(InputEvent.BUTTON1_MASK);
 101         sleep(100);
 102 
 103         Util.drag(robot, dragSourcePoint, targetFrame.getDropTargetPoint(), InputEvent.BUTTON1_MASK);
 104 
 105     }
 106 
 107     enum InterprocessArguments {
 108         TARGET_FRAME_X_POSITION_ARGUMENT,
 109         TARGET_FRAME_Y_POSITION_ARGUMENT,
 110         DRAG_SOURCE_POINT_X_ARGUMENT,
 111         DRAG_SOURCE_POINT_Y_ARGUMENT,
 112         FILES_IN_THE_LIST_NUMBER_ARGUMENT;
 113 
 114         int extract (String [] args) {
 115             return Integer.parseInt(args[this.ordinal()]);
 116         }
 117     }
 118 
 119     public static void main(final String [] args) throws Exception {
 120         if (args.length > 0 && args[0].equals("main")) {
 121             new URIListToFileListBetweenJVMsTest().start();
 122             return;
 123         }
 124         Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extract(args),
 125                 InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extract(args));
 126         Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extract(args),
 127                 InterprocessArguments.TARGET_FRAME_Y_POSITION_ARGUMENT.extract(args));
 128         int transferredFilesNumber = InterprocessArguments.FILES_IN_THE_LIST_NUMBER_ARGUMENT.extract(args);
 129 
 130         new URIListToFileListBetweenJVMsTest(targetFrameLocation, dragSourcePoint, transferredFilesNumber);
 131     }
 132 }
< prev index next >