On Thu, 5 Mar 2026 12:26:19 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
>> Is it possible to close the dialog by sending `VK_ENTER`? If it is and the
>> test is stable, it can be automatic.
>
> I did try that but it seems to timeout in macox-aarch64 consistenly in CI
> although the test passes locally
>
>
> public class TestPrintNoException {
>
> public static void main(String[] args) throws Exception {
> Robot robot = new Robot();
> Thread t = new Thread (() -> {
> robot.delay(5000);
> robot.keyPress(KeyEvent.VK_ENTER);
> robot.keyRelease(KeyEvent.VK_ENTER);
> robot.waitForIdle();
> });
> Toolkit tk = Toolkit.getDefaultToolkit();
> PrintJob pj = null;
>
> int[][] pageRange = new int[][]{new int[]{1,1}};
> JobAttributes ja = new JobAttributes(1,
> java.awt.JobAttributes.DefaultSelectionType.ALL,
> JobAttributes.DestinationType.PRINTER,
> JobAttributes.DialogType.NATIVE,
> null, Integer.MAX_VALUE, 1,
>
> JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES,
> pageRange, "", JobAttributes.SidesType.ONE_SIDED);
>
> Frame testFrame = new Frame("print");
> try {
> if (tk != null) {
> t.start();
> pj = tk.getPrintJob(testFrame, null, ja, null);
> }
> } finally {
> testFrame.dispose();
> }
> }
> }
Thank you for exploring whether automation is possible. Let's leave it as a
manual test.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29874#discussion_r2890219604