< prev index next >

test/jdk/java/awt/dnd/FileListBetweenJVMsTest/FileListBetweenJVMsTest.java

Print this page


   1 /*
   2  * Copyright (c) 2007, 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 5079469
  27   @summary DnD of File-List across JVM adds two empty items to the list
  28   @author : area=dnd
  29   @run applet FileListBetweenJVMsTest.html



  30 */
  31 
  32 /**
  33  * FileListBetweenJVMsTest.java
  34  *
  35  * summary: DnD of File-List across JVM adds two empty items to the list
  36  */
  37 
  38 import static java.lang.Thread.sleep;
  39 
  40 import test.java.awt.regtesthelpers.process.ProcessCommunicator;
  41 import test.java.awt.regtesthelpers.process.ProcessResults;
  42 import test.java.awt.regtesthelpers.Util;
  43 import java.applet.Applet;
  44 import java.awt.*;
  45 import java.awt.event.InputEvent;
  46 import java.io.*;
  47 
  48 public class FileListBetweenJVMsTest extends Applet {
  49 
  50     // information related to the test in common
  51     static int VISIBLE_RAWS_IN_LIST=15;
  52 
  53     public void init() {
  54         setLayout(new BorderLayout());
  55 
  56     }//End  init()
  57 
  58     public void start() {
  59 
  60         SourceFileListFrame sourceFrame = new SourceFileListFrame();
  61 
  62         Util.waitForIdle(null);
  63 
  64         String [] args = new String [] {
  65                 String.valueOf(sourceFrame.getNextLocationX()),
  66                 String.valueOf(sourceFrame.getNextLocationY()),
  67                 String.valueOf(sourceFrame.getDragSourcePointX()),
  68                 String.valueOf(sourceFrame.getDragSourcePointY()),
  69                 String.valueOf(sourceFrame.getSourceFilesNumber())
  70         };
  71 
  72         ProcessResults processResults =
  73                 ProcessCommunicator.executeChildProcess(this.getClass(), args);
  74 
  75         verifyTestResults(processResults);
  76 
  77     }// start()


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




 134         Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extract(args),
 135                 InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extract(args));
 136         Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extract(args),
 137                 InterprocessArguments.TARGET_FRAME_Y_POSITION_ARGUMENT.extract(args));
 138         int transferredFilesNumber = InterprocessArguments.FILES_IN_THE_LIST_NUMBER_ARGUMENT.extract(args);
 139 
 140         try {
 141             new FileListBetweenJVMsTest(targetFrameLocation, dragSourcePoint, transferredFilesNumber);
 142         } catch (InterruptedException e) {
 143             e.printStackTrace();
 144         }
 145 
 146     }
 147 
 148 
 149 }// class FileListBetweenJVMsTest
   1 /*
   2  * Copyright (c) 2007, 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 5079469
  28   @summary DnD of File-List across JVM adds two empty items to the list
  29   @library ../../regtesthelpers
  30   @library ../../regtesthelpers/process
  31   @build Util
  32   @build ProcessResults ProcessCommunicator
  33   @run main/othervm FileListBetweenJVMsTest main
  34 */
  35 






  36 import static java.lang.Thread.sleep;
  37 
  38 import test.java.awt.regtesthelpers.process.ProcessCommunicator;
  39 import test.java.awt.regtesthelpers.process.ProcessResults;
  40 import test.java.awt.regtesthelpers.Util;

  41 import java.awt.*;
  42 import java.awt.event.InputEvent;

  43 
  44 public class FileListBetweenJVMsTest {
  45 
  46     // information related to the test in common
  47     static int VISIBLE_RAWS_IN_LIST=15;
  48 





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


 104         robot.mouseRelease(InputEvent.BUTTON1_MASK);
 105         sleep(100);
 106 
 107         Util.drag(robot, dragSourcePoint, targetFrame.getDropTargetPoint(),
 108                 InputEvent.BUTTON1_MASK);
 109 
 110     }
 111 
 112     enum InterprocessArguments {
 113         TARGET_FRAME_X_POSITION_ARGUMENT,
 114         TARGET_FRAME_Y_POSITION_ARGUMENT,
 115         DRAG_SOURCE_POINT_X_ARGUMENT,
 116         DRAG_SOURCE_POINT_Y_ARGUMENT,
 117         FILES_IN_THE_LIST_NUMBER_ARGUMENT;
 118 
 119         int extract (String [] args) {
 120             return Integer.parseInt(args[this.ordinal()]);
 121         }
 122     }
 123 
 124     public static void main(final String [] args) {
 125         if (args.length > 0 && args[0].equals("main")) {
 126             new FileListBetweenJVMsTest().start();
 127             return;
 128         }
 129         Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extract(args),
 130                 InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extract(args));
 131         Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extract(args),
 132                 InterprocessArguments.TARGET_FRAME_Y_POSITION_ARGUMENT.extract(args));
 133         int transferredFilesNumber = InterprocessArguments.FILES_IN_THE_LIST_NUMBER_ARGUMENT.extract(args);
 134 
 135         try {
 136             new FileListBetweenJVMsTest(targetFrameLocation, dragSourcePoint, transferredFilesNumber);
 137         } catch (InterruptedException e) {
 138             e.printStackTrace();
 139         }
 140 
 141     }
 142 
 143 
 144 }// class FileListBetweenJVMsTest
< prev index next >