On Thu, 5 Oct 2023 14:51:47 GMT, Alexey Ivanov <[email protected]> wrote:

>> 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
>
>> 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
> 
> It is okay, yet I think it would be clearer and cleaner if the flow was like 
> this:
> 
> 1. Complete the first case, steps 1–5 above;
> 2. Click the menu to close it;
> 3. Drag the mouse.
> 
> The comment in the code says, “Drag the mouse”… but before it does so, it 
> once retrieves the coordinates once again, then closes the menu and only now 
> it starts dragging the mouse.
> 
> If you store the coordinates to `menuLocation` and `itemLocation` when 
> performing the first test, the code becomes cleaner: one clearly sees the 
> coordinates are re-used. (They're re-used either way but retrieved twice.) 
> Then the sequence of the operations will become clearer too: first case (open 
> menu, click greyed out item); close the menu; now start the second case 
> (click the centre of the menu, which opens the menu again, drag the mouse to 
> the greyed out item, release mouse).
> 
> Both @prrace and I interpreted closing the menu as an unexpected thing but it 
> is intentional, the test needs to close the menu before it can verify the 
> second case.

But 1st case uses center coordinates via Util.getCenterPoint whereas 2nd case 
uses getLocationOnScreen+10 so it's not exactly the same.
I guess we can do away with Util class and make it use 
SwingUtilities.invokeAndWait but I guess we can do it at later point..

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15677#discussion_r1347591167

Reply via email to