RFR: 8315986: javax/swing/JMenuItem/4654927/bug4654927.java: component must be showing on the screen to determine its location [v4]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Wed Oct 4 14:01:40 UTC 2023
On Wed, 4 Oct 2023 11:01:09 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>>
>> jcheck
>
> test/jdk/javax/swing/JMenuItem/4654927/bug4654927.java line 1:
>
>> 1: /*
>
> I looked at the test code more thoroughly. I guess it can be improved.
>
> Since GitHub doesn't allow adding comments to lines which weren't modified, I'll add my comment here.
>
> **The first case** is straightforward:
>
> 1. Click the menu on the menu bar to open it,
> 2. Click the greyed out menu item.
>
> The test saves the location of menu into `point`, then replaces it with location of the menu item. Yet it does request the same positions later in the test where it saves them into `menuLocation` and `itemLocation` correspondingly. Why not do it right away? The positions shouldn't change. Anyway the test relies on this fact because it saves the positions before the menu gets hidden.
>
> **The second case** tests mouse drag. It simulates clicking the menu to open its popup and then dragging the mouse to the menu item and then releasing the mouse button.
>
> Here it's more confusing… If you save the values in the first case above, you can clean up the code.
>
> Then closing the menu could be done *before* entering the block of code for dragging mouse. In my opinion, it will make the test code clearer.
I guess menu is closed before mouse is dragged, no?
The sequence as I see is
1. Move mouse to center of menu
2. Press to open the menu
3. Move mouse to center of menuitem which is greyed
4. Press mouse button
5. Check if menuItem is closed, if it is fail the test
6. Now 2nd part of the test, Move mouse to center of menu
7. Press mouse to close the menu which was open during 1st part of the test
8. Press mouse to open the menu and Drag mouse from center of menu to center of menuitem and release the mouse
9. Check if menuitem is closed, if it is fail the test
So, I think pt 7 "close menu" is happening before pt 8 "drag mouse"....Yes, "point" is being reused but I guess it's ok
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15677#discussion_r1345847336
More information about the client-libs-dev
mailing list