< prev index next >

test/java/awt/print/PrinterJob/TestCheckSystemDefaultBannerOption.java

Print this page

        

*** 20,30 **** * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test ! * @bug 8165947 * @summary Verifies System default banner page option is honoured by jdk * @requires (os.family == "linux" | os.family == "solaris") * @run main/manual TestCheckSystemDefaultBannerOption */ import java.awt.BorderLayout; --- 20,30 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test ! * @bug 8165947 8170579 * @summary Verifies System default banner page option is honoured by jdk * @requires (os.family == "linux" | os.family == "solaris") * @run main/manual TestCheckSystemDefaultBannerOption */ import java.awt.BorderLayout;
*** 36,45 **** --- 36,46 ---- 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.swing.JButton; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.JTextArea;
*** 54,67 **** private static PrinterJob job = null; public static void main (String[] args) throws Exception { job = PrinterJob.getPrinterJob(); ! if (job.getPrintService() == null) { System.out.println("No printers. Test cannot continue"); return; } // check system default banner option and let user know what to expect JobSheets js = (JobSheets)job.getPrintService(). getDefaultAttributeValue(JobSheets.class); if (js != null && js.equals(JobSheets.NONE)) { noJobSheet = true; --- 55,73 ---- private static PrinterJob job = null; public static void main (String[] args) throws Exception { job = PrinterJob.getPrinterJob(); ! PrintService prtSrv = job.getPrintService(); ! if (prtSrv == null) { System.out.println("No printers. Test cannot continue"); return; } + // do not run the test if JobSheet category is not supported + if (!prtSrv.isAttributeCategorySupported(JobSheets.class)) { + return; + } // check system default banner option and let user know what to expect JobSheets js = (JobSheets)job.getPrintService(). getDefaultAttributeValue(JobSheets.class); if (js != null && js.equals(JobSheets.NONE)) { noJobSheet = true;
< prev index next >