On Mon, 13 May 2024 19:46:08 GMT, Phil Race <p...@openjdk.org> wrote:

> Why can't we have an automated test that just calls the APIs 
> service.isAttributeCategorySupported(OutputBin.class) and 
> service.getSupportedAttributeValues(OutputBin.class, null, null);
> 
> for all printers ?

I prepared a simple 
[ListOutputBins](https://cr.openjdk.org/~alexsch/8314070/java/ListOutputBins.java)
 program which checks the following PrintService methods for OutputBin class: 
`isAttributeCategorySupported(...)`, `getDefaultAttributeValue(...)`, 
`isAttributeValueSupported(...)`, `getSupportedAttributeValues(...)`  
> 
> Why is service.isAttributeCategorySupported(OutputBin.class) returning true 
> on my printer which does not support it ?

This was because output bins were retrieved through cups on MacOS and the 
`service.isAttributeCategorySupported(OutputBin.class)` method checked the 
`output-bin-supported` key through ipp.

In the latest changes the Linux uses ipp to retrieve the list of supported 
output bins so it should just work.
This is the `ListOutputBins` output for the `Kyocera ECOSYS M8130cidn` printer 
on Linux:

PrintService: IPP Printer : Kyocera-ECOSYS-M8130cidn-2
OutputBin is supported attribute category: true
OutputBin is included into the supported attribte categories list: true
OutputBin default attribute value: top
Is defalut top output bin supported: true
OutputBin supported attribute values: (size: 2) values: [top, stacker-1]
Is top output bin supported: true
Is stacker-1 output bin supported: true


And ipp returns one output bin even for printers which does not support output 
bins.
For example for the `Generic CUPS PDF Printer` `ListOutputBins` shows:

PrintService: IPP Printer : Generic-CUPS-PDF-Printer
CUPS or IPP output bins: 1
CUPS or IPP output bin name: face-down, choice: face-down
OutputBin is supported attribute category: true
OutputBin is included into the supported attribte categories list: true
OutputBin default attribute value: face-down
Is defalut face-down output bin supported: true
OutputBin supported attribute values: (size: 1) values: [face-down]
Is face-down output bin supported: true


I updated the common print dialog to select and disable an output bin if there 
is only one.

> 
> Why is the print dialog showing an "enabled" empty combo box ? If there are 
> no items or the attribute is not supported it should be disabled.

For MacOS the fix is updated to return false from 
`service.getSupportedAttributeValues(OutputBin.class, null, null)` and 
`service.isAttributeCategorySupported(OutputBin.class)` methods if there are 
zero output bins returned from cups.

The `ListOutputBins` output on MacOS for 
`Secure Air Print`:

PrintService: IPP Printer : Kyocera ECOSYS M8130cidn
OutputBin is supported attribute category: true
OutputBin is included into the supported attribte categories list: true
OutputBin default attribute value: top
OutputBin supported attribute values: (size: 2) values: [Top, Stacker 1]

`Kyocera Classic Universal Printer Driver (KPDL)`

PrintService: IPP Printer : Kyocera ECOSYS M8130cidn
OutputBin is supported attribute category: true
OutputBin is included into the supported attribte categories list: true
OutputBin default attribute value: none
Is defalut none output bin supported: true
OutputBin supported attribute values: (size: 4) values: [Printer settings, 
Inner tray, Separator tray, Finisher (face-down)]
Is Printer settings output bin supported: true
Is Inner tray output bin supported: true
Is Separator tray output bin supported: true
Is Finisher (face-down) output bin supported: true

`HP Ink Tank 110 series` which returns zero output bins from cups:

PrintService: IPP Printer : HP Ink Tank 110 series
OutputBin is supported attribute category: false
OutputBin is included into the supported attribte categories list: false
OutputBin default attribute value: null
OutputBin supported attribute values are null!

-------------

PR Comment: https://git.openjdk.org/jdk/pull/16166#issuecomment-2123405182

Reply via email to