< prev index next >

test/java/awt/print/PrinterJob/PrintAttributeUpdateTest.java

Print this page

        

@@ -21,30 +21,36 @@
  * questions.
  */
 
  /*
   @test
-  @bug 8042713
+  @bug 8042713 8170578
   @summary  Print Dialog does not update attribute set with page range
   @run main/manual PrintAttributeUpdateTest
  */
 import java.awt.Component;
 import java.awt.Graphics;
 import java.awt.print.PageFormat;
 import java.awt.print.Pageable;
 import java.awt.print.Printable;
 import java.awt.print.PrinterJob;
+import javax.print.PrintService;
 import javax.print.attribute.Attribute;
 import javax.print.attribute.HashPrintRequestAttributeSet;
 import javax.print.attribute.standard.DialogTypeSelection;
 import javax.print.attribute.standard.PageRanges;
 import javax.swing.JOptionPane;
 import javax.swing.SwingUtilities;
 
 public class PrintAttributeUpdateTest implements Pageable, Printable {
 
     public static void main(String args[]) throws Exception {
+        PrintService prtSrv = PrinterJob.getPrinterJob().getPrintService();
+        if (prtSrv == null) {
+            System.out.println("No Printers. Test cannot continue");
+            return;
+        }
         String[] instructions
                 = {
                     "Select Pages Range From instead of All in print dialog. ",
                     "Then select Print"
                 };
< prev index next >