author | prr |
Fri, 11 Jul 2014 11:12:59 -0700 | |
changeset 25774 | 21b78da4b2df |
permissions | -rw-r--r-- |
25774
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
1 |
/* |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
4 |
* |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
8 |
* |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
13 |
* accompanied this code). |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
14 |
* |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
18 |
* |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
21 |
* questions. |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
22 |
*/ |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
23 |
|
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
24 |
/** |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
25 |
* @test |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
26 |
* @bug 8048328 |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
27 |
* @summary CUPS Printing does not report supported printer resolutions. |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
28 |
* @run main PrintResAttr |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
29 |
*/ |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
30 |
|
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
31 |
/* |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
32 |
* Since there is no guarantee you have any printers that support |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
33 |
* resolution this test can't verify that resolution is being |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
34 |
* reported when supported. But when they are it should test that |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
35 |
* the code behaves reasonably. |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
36 |
*/ |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
37 |
import javax.print.*; |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
38 |
import javax.print.attribute.*; |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
39 |
import javax.print.attribute.standard.*; |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
40 |
|
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
41 |
public class PrintResAttr { |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
42 |
|
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
43 |
public static void main(String args[]) throws Exception { |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
44 |
|
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
45 |
PrintService[] services = |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
46 |
PrintServiceLookup.lookupPrintServices(null,null); |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
47 |
for (int i=0; i<services.length; i++) { |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
48 |
if (services[i].isAttributeCategorySupported(PrinterResolution.class)) { |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
49 |
System.out.println("Testing " + services[i]); |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
50 |
PrinterResolution[] res = (PrinterResolution[]) |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
51 |
services[i].getSupportedAttributeValues(PrinterResolution.class, |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
52 |
null,null); |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
53 |
System.out.println("# supp res= " + res.length); |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
54 |
for (int r=0;r<res.length;r++) System.out.println(res[r]); |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
55 |
} |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
56 |
} |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
57 |
} |
21b78da4b2df
8048328: CUPS Printing does not report supported printer resolutions.
prr
parents:
diff
changeset
|
58 |
} |