< prev index next >

test/java/awt/print/PrinterJob/BannerTest.java

Print this page

        

*** 20,30 **** * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test ! * @bug 6575247 * @summary Verifies if Banner page is printed * @requires (os.family == "linux" | os.family == "solaris") * @run main/manual BannerTest */ --- 20,30 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test ! * @bug 6575247 8170579 * @summary Verifies if Banner page is printed * @requires (os.family == "linux" | os.family == "solaris") * @run main/manual BannerTest */
*** 37,46 **** --- 37,49 ---- import java.awt.print.Printable; import static java.awt.print.Printable.NO_SUCH_PAGE; import static java.awt.print.Printable.PAGE_EXISTS; import java.awt.print.PrinterException; import java.awt.print.PrinterJob; + import javax.print.PrintService; + import javax.print.attribute.standard.JobSheets; + import javax.print.attribute.standard.SheetCollate; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.SwingUtilities;
*** 48,59 **** --- 51,72 ---- public class BannerTest implements Printable { private static Thread mainThread; private static boolean testPassed; private static boolean testGeneratedInterrupt; + private static volatile PrinterJob job; public static void main(String[] args) throws Exception { + job = PrinterJob.getPrinterJob(); + PrintService prtSrv = job.getPrintService(); + if (job.getPrintService() == null) { + System.out.println("No printers. Test cannot continue"); + return; + } + if (!prtSrv.isAttributeCategorySupported(JobSheets.class)) { + return; + } SwingUtilities.invokeAndWait(() -> { doTest(BannerTest::printTest); }); mainThread = Thread.currentThread(); try {
*** 67,81 **** throw new RuntimeException("user has not executed the test"); } } private static void printTest() { ! PrinterJob job = PrinterJob.getPrinterJob(); ! if (job.getPrintService() == null) { ! System.out.println("No printers. Test cannot continue"); ! return; ! } job.setPrintable(new BannerTest()); if(job.printDialog()) { try { job.print(); } catch (PrinterException e) { --- 80,90 ---- throw new RuntimeException("user has not executed the test"); } } private static void printTest() { ! job.setPrintable(new BannerTest()); if(job.printDialog()) { try { job.print(); } catch (PrinterException e) {
< prev index next >