< prev index next >

test/java/awt/PrintJob/PrinterException.java

Print this page
rev 14989 : 8160974: [TESTBUG] Mark more headful tests with @key headful.


   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  * @test

  25  * @bug 7161283 8158520
  26  * @summary  Toolkit.getPrintJob throws NPE if no printer available
  27  * @run main PrinterException
  28  */
  29 import java.awt.Frame;
  30 import java.awt.JobAttributes;
  31 import java.awt.PrintJob;
  32 import java.awt.Toolkit;
  33 import java.awt.Robot;
  34 import java.awt.event.KeyEvent;
  35 
  36 public class PrinterException {
  37 
  38     public static void main(String[] args) throws Exception {
  39         Robot robot = new Robot();
  40         Thread t = new Thread (() -> {
  41             robot.waitForIdle();
  42             robot.delay(2000);
  43             robot.keyPress(KeyEvent.VK_ESCAPE);
  44             robot.keyRelease(KeyEvent.VK_ESCAPE);




   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  * @test
  25  * @key headful
  26  * @bug 7161283 8158520
  27  * @summary  Toolkit.getPrintJob throws NPE if no printer available
  28  * @run main PrinterException
  29  */
  30 import java.awt.Frame;
  31 import java.awt.JobAttributes;
  32 import java.awt.PrintJob;
  33 import java.awt.Toolkit;
  34 import java.awt.Robot;
  35 import java.awt.event.KeyEvent;
  36 
  37 public class PrinterException {
  38 
  39     public static void main(String[] args) throws Exception {
  40         Robot robot = new Robot();
  41         Thread t = new Thread (() -> {
  42             robot.waitForIdle();
  43             robot.delay(2000);
  44             robot.keyPress(KeyEvent.VK_ESCAPE);
  45             robot.keyRelease(KeyEvent.VK_ESCAPE);


< prev index next >