mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-19 23:48:50 +00:00
6732647: isAttributeValueSupported() is not consistant with getSupportedValues() for Copies, TEXT flavor
Reviewed-by: tdv, prr
This commit is contained in:
parent
118a4cdb15
commit
2549cb015c
@ -487,28 +487,26 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
|
||||
/* Test if the flavor is compatible with the category */
|
||||
if ((category == Copies.class) ||
|
||||
(category == CopiesSupported.class)) {
|
||||
CopiesSupported cs = new CopiesSupported(1, MAXCOPIES);
|
||||
AttributeClass attribClass = (getAttMap != null) ?
|
||||
(AttributeClass)getAttMap.get(cs.getName()) : null;
|
||||
if (attribClass != null) {
|
||||
int[] range = attribClass.getIntRangeValue();
|
||||
cs = new CopiesSupported(range[0], range[1]);
|
||||
if (flavor == null ||
|
||||
!(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
|
||||
flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) {
|
||||
CopiesSupported cs = new CopiesSupported(1, MAXCOPIES);
|
||||
AttributeClass attribClass = (getAttMap != null) ?
|
||||
(AttributeClass)getAttMap.get(cs.getName()) : null;
|
||||
if (attribClass != null) {
|
||||
int[] range = attribClass.getIntRangeValue();
|
||||
cs = new CopiesSupported(range[0], range[1]);
|
||||
}
|
||||
return cs;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return cs;
|
||||
} else if (category == Chromaticity.class) {
|
||||
if (flavor == null ||
|
||||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
|
||||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
|
||||
flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
|
||||
flavor.equals(DocFlavor.URL.GIF) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
|
||||
flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
|
||||
flavor.equals(DocFlavor.URL.JPEG) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
|
||||
flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
|
||||
flavor.equals(DocFlavor.URL.PNG)) {
|
||||
|
||||
!isIPPSupportedImages(flavor.getMimeType())) {
|
||||
Chromaticity[]arr = new Chromaticity[1];
|
||||
arr[0] = Chromaticity.COLOR;
|
||||
return (arr);
|
||||
@ -1220,7 +1218,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
|
||||
}
|
||||
|
||||
|
||||
public boolean isAttributeValueSupported(Attribute attr,
|
||||
public boolean isAttributeValueSupported(Attribute attr,
|
||||
DocFlavor flavor,
|
||||
AttributeSet attributes) {
|
||||
if (attr == null) {
|
||||
@ -1249,21 +1247,18 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
|
||||
if ((flavor == null) ||
|
||||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
|
||||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
|
||||
flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
|
||||
flavor.equals(DocFlavor.URL.GIF) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
|
||||
flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
|
||||
flavor.equals(DocFlavor.URL.JPEG) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
|
||||
flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
|
||||
flavor.equals(DocFlavor.URL.PNG)) {
|
||||
!isIPPSupportedImages(flavor.getMimeType())) {
|
||||
return attr == Chromaticity.COLOR;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (attr.getCategory() == Copies.class) {
|
||||
return isSupportedCopies((Copies)attr);
|
||||
return (flavor == null ||
|
||||
!(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
|
||||
flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) &&
|
||||
isSupportedCopies((Copies)attr);
|
||||
|
||||
} else if (attr.getCategory() == Destination.class) {
|
||||
if (flavor == null ||
|
||||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
|
||||
|
||||
@ -686,19 +686,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
|
||||
}
|
||||
|
||||
if (category == Chromaticity.class) {
|
||||
if (flavor == null ||
|
||||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
|
||||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
|
||||
flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
|
||||
flavor.equals(DocFlavor.URL.GIF) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
|
||||
flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
|
||||
flavor.equals(DocFlavor.URL.JPEG) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
|
||||
flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
|
||||
flavor.equals(DocFlavor.URL.PNG)) {
|
||||
|
||||
if (flavor == null || isServiceFormattedFlavor(flavor)) {
|
||||
Chromaticity[]arr = new Chromaticity[1];
|
||||
arr[0] = Chromaticity.COLOR;
|
||||
return (arr);
|
||||
@ -730,18 +718,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
|
||||
}
|
||||
return new RequestingUserName(userName, null);
|
||||
} else if (category == OrientationRequested.class) {
|
||||
if (flavor == null ||
|
||||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
|
||||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
|
||||
flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
|
||||
flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
|
||||
flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
|
||||
flavor.equals(DocFlavor.URL.GIF) ||
|
||||
flavor.equals(DocFlavor.URL.JPEG) ||
|
||||
flavor.equals(DocFlavor.URL.PNG)) {
|
||||
if (flavor == null || isServiceFormattedFlavor(flavor)) {
|
||||
OrientationRequested []arr = new OrientationRequested[3];
|
||||
arr[0] = OrientationRequested.PORTRAIT;
|
||||
arr[1] = OrientationRequested.LANDSCAPE;
|
||||
@ -752,7 +729,14 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
|
||||
}
|
||||
} else if ((category == Copies.class) ||
|
||||
(category == CopiesSupported.class)) {
|
||||
return new CopiesSupported(1, MAXCOPIES);
|
||||
if (flavor == null ||
|
||||
!(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
|
||||
flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) {
|
||||
return new CopiesSupported(1, MAXCOPIES);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else if (category == Media.class) {
|
||||
Media []arr = new Media[mediaSizes.length];
|
||||
System.arraycopy(mediaSizes, 0, arr, 0, mediaSizes.length);
|
||||
@ -917,8 +901,10 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
|
||||
}
|
||||
}
|
||||
else if (attr.getCategory() == Copies.class) {
|
||||
return
|
||||
(flavor == null || isServiceFormattedFlavor(flavor)) &&
|
||||
return (flavor == null ||
|
||||
!(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
|
||||
flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
|
||||
flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) &&
|
||||
isSupportedCopies((Copies)attr);
|
||||
} else if (attr.getCategory() == Destination.class) {
|
||||
URI uri = ((Destination)attr).getURI();
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 6527316
|
||||
* @bug 6527316 6732647
|
||||
* @summary Copies isn't supported for PS flavors.
|
||||
* @run main PSCopiesFlavorTest
|
||||
*/
|
||||
@ -50,5 +50,13 @@ public class PSCopiesFlavorTest {
|
||||
if (suppVal || us == null) {
|
||||
throw new RuntimeException("Copies should be unsupported value");
|
||||
}
|
||||
|
||||
Object value = ps.getSupportedAttributeValues(Copies.class, flavor, null);
|
||||
|
||||
//Copies Supported
|
||||
if(value instanceof CopiesSupported) {
|
||||
throw new RuntimeException("Copies should have no supported values.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user