On Tue, 14 Sep 2021 18:37:49 GMT, Alexey Ivanov <[email protected]> wrote:

> Is it possible to complete the test as soon as either OK or Cancel button is 
> clicked on the Print dialog?

The `init()` method is run on main thread. It's the thread which creates the 
Print Dialog. If the user clicks Cancel, the `job.printDialog()` returns 
`false` and the test should fail.

Then if the `job.getCopies() == 1`, the test also fails with the message that 
the number of copies wasn't increased.

If `job.getCopies() > 1`, the test passes automatically.


There's one thing though… I don't have a real printer installed but I have a 
PDF printer which doesn't allow increasing the number of copies. What should 
the test do in this case? If I click OK without modifying the number of copies, 
the test will fail; if I click Cancel, the test will also fail. However, this 
particular case falls into a category where the prerequisites aren't met.

Probably, the standard machinery with `Sysout` is an overkill for this simple 
scenario. You could show the instruction frame with only the text area which 
contains the instruction text.

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

PR: https://git.openjdk.java.net/jdk/pull/4850

Reply via email to