RFR: 8333403: Write a test to check various components events are triggered properly [v7]

Ravi Gupta rgupta at openjdk.org
Tue Sep 17 16:11:48 UTC 2024


On Wed, 4 Sep 2024 15:04:25 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Ravi Gupta has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8333403: Review comments fixed
>
> test/jdk/java/awt/event/ComponentEvent/ComponentEventTest.java line 157:
> 
>> 155:         EventQueue.invokeAndWait(() -> {
>> 156:             compAt = components[9].getLocationOnScreen();
>> 157:             compSize = components[9].getSize();
> 
> Why did you change it from 0 to 9?
> 
> The number 9 looks like a magic number, it may change if anything changes in the `components` array.

now i used frame to ensure that its gain foucs

> test/jdk/java/awt/event/ComponentEvent/ComponentEventTest.java line 201:
> 
>> 199:         System.err.println();
>> 200:         throw new RuntimeException("FAIL: " + errorMsg);
>> 201:     }
> 
> So you're collecting a list of events to print them if iconify or deiconify generates an unexpected list of events.
> 
> In all other cases `events` isn't used at all.
> 
> Given that all the generated events are printed as they're come, I see no reason why `events` is needed at all. By printing messages that you're about to test iconifying frame and deiconifying frame you separate the cases, the list of events will be printed between these messages.

removed the events  , now list of events will be printed by using ComponentListener

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19521#discussion_r1763511677
PR Review Comment: https://git.openjdk.org/jdk/pull/19521#discussion_r1763515115


More information about the client-libs-dev mailing list