diff --git a/test/jdk/java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java b/test/jdk/java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java index 1277a24b112..fa16e90bb24 100644 --- a/test/jdk/java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java +++ b/test/jdk/java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,42 +21,58 @@ * questions. */ -/** +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.lang.reflect.InvocationTargetException; + +/* * @test * @bug 6581756 + * @library ../../../regtesthelpers + * @build PassFailJFrame * @summary Test printing of images which need to have src area clipped - * @run main/manual=yesno PrintARGBImage + * @run main/manual PrintARGBImage */ -import java.awt.*; -import java.awt.image.*; -import java.awt.print.*; - public class PrintARGBImage implements Printable { - static String[] text = { - "This is a manual test which needs a printer installed", - "If you have no printer installed you CANNOT use this test", - "It runs automatically and sends one page to the default printer", - "It passes if the text shows through the rectangular image", - }; + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + if (PrinterJob.lookupPrintServices().length > 0) { - public static void main( String[] args ) { - - for (int i=0;i