RFR: 8285698: Create a test to check the focus stealing of JPopupMenu from JComboBox [v2]

Manukumar V S mvs at openjdk.java.net
Tue May 10 11:02:46 UTC 2022


On Mon, 9 May 2022 18:08:55 GMT, Phil Race <prr at openjdk.org> wrote:

>> Manukumar V S has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review comment fixed: Removed finally block and added the call to disposeFrame() before the exception is thrown
>
> test/jdk/javax/swing/JPopupMenu/JPopupMenuFocusStealTest.java line 104:
> 
>> 102:                 SwingUtilities
>> 103:                         .invokeAndWait(JPopupMenuFocusStealTest::disposeFrame);
>> 104:             }
> 
> I know it'll work but similarly to another review (https://github.com/openjdk/jdk/pull/8477/files)
> it seems to me that you can recode as
>  SwingUtilities.invokeAndWait(
>                          () -> isFocusOwner.set(comboBox.isFocusOwner()));
> SwingUtilities
>                          .invokeAndWait(JPopupMenuFocusStealTest::disposeFrame);
>  if (isFocusOwner.get()) {
>                      System.out.println("Test Passed for " + laf);
>                  } else {
>                      throw new RuntimeException("Test Failed for " + laf);
>                  }
> 
> and don't need the finally block

Changed it.

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

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



More information about the client-libs-dev mailing list