<AWT Dev> [10][JDK-8027154] [TESTBUG] Test java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java fails

Sergey Bylokhov sergey.bylokhov at oracle.com
Tue Aug 1 20:48:12 UTC 2017


Ok, looks fine. 
Thank you for clarification. 

----- krishna.addepalli at oracle.com wrote: 
> 
> 
> 

Hi Sergey, 



Based on our conversation, could you provide your review comments for the fix? 



Pasting the mail exchange below for reference: 





The intent of the test is not modified by my changes. By having the second frame register a mouse move callback, it is made more explicit - when the mouse position should be queried, and what is the expected position it should contain. Also, since Frame2 has observed a mouse move, consequently, Frame1 should not report any mouse position. 





-----Original Message----- 

From: Sergey Bylokhov 

Sent: Tuesday, August 1, 2017 2:13 AM 

To: Krishna Addepalli < krishna.addepalli at oracle.com > 

Cc: Ambarish Rapte < ambarish.rapte at oracle.com >; Ajit Ghaisas < ajit.ghaisas at oracle.com >; Prem Balakrishnan < prem.balakrishnan at oracle.com >; Praveen Srivastava < praveen.s.srivastava at oracle.com >; Prasanta Sadhukhan ( prasanta.sadhukhan at oracle.com ) < prasanta.sadhukhan at oracle.com > 

Subject: Re: awt-dev Digest, Vol 123, Issue 9 



You can modify the test as you wish to make it stable, just make sure that initial use case is covered. 



On 27.07.2017 4:29, Krishna Addepalli wrote: 

> Hi Sergey, 

> 

> I have tested the modified test that you provided on Windows and Linux. 

> It was working fine on Windows without the sleep, but on Linux, the 

> behavior is a bit random. If I removed the sleep, it is crashing 

> always, but occasionally it crashed even for a 2 second sleep time. 

> 

> I think, it is better not to rely on sleep, and instead, let frame2 

> have a mouse move callback registered, and then perform the required 

> checks, which guarantees a deterministic behavior, and also holds the 

> spirit of the intended test. 

> 

> Could you review the patch that I submitted and let me know? 

> 

> Thanks, 

> 

> Krishna 

> 

> *From:* Krishna Addepalli 

> *Sent:* Tuesday, July 25, 2017 8:41 PM 

> *To:* Sergey Bylokhov < sergey.bylokhov at oracle.com > 

> *Cc:* Ambarish Rapte < ambarish.rapte at oracle.com >; Ajit Ghaisas 

> < ajit.ghaisas at oracle.com >; Prem Balakrishnan 

> < prem.balakrishnan at oracle.com >; Praveen Srivastava 

> < praveen.s.srivastava at oracle.com > 

> *Subject:* RE: awt-dev Digest, Vol 123, Issue 9 

> 

> Hi Sergey, 

> 

> Thanks for your clarifications. That explains the reasons for 

> Util.waitForIdle() not working in earlier versions. 

> 

> So to summarize, the intent of the test is to create a new frame 

> (“Popup 

> Frame”) for the MouseMove callback, and then have the new frame report 

> the expected mouse position, while the underlying frame should report 

> that mouse position is null, since it is no longer the active frame. 

> 

> I have one more question: 

> 

> In your code, you are sleeping for 2 seconds, after making the frame2 

> visible. Is this necessary? I have seen that, once we set frame2 

> visible, the mouse position can be immediately queried without the 

> need to wait. Is it done to make sure that the test works on older builds? 

> 

> Out of curiosity, I wanted to know if you could see the same 

> failure(“Exception in thread "AWT-EventQueue-2" 

> java.lang.RuntimeException: Not implemented”)that was reported in the 

> original bug? 

> 

> Thanks, 

> 

> Krishna 

> 

> *From:* Sergey Bylokhov 

> *Sent:* Tuesday, July 25, 2017 7:04 AM 

> *To:* Krishna Addepalli <krishna.addepalli at oracle.com 

> < mailto:krishna.addepalli at oracle.com >> 

> *Cc:* Ambarish Rapte <ambarish.rapte at oracle.com 

> < mailto:ambarish.rapte at oracle.com >>; Ajit Ghaisas 

> < ajit.ghaisas at oracle.com <mailto:ajit.ghaisas at oracle.com >>; Prem 

> Balakrishnan <prem.balakrishnan at oracle.com 

> < mailto:prem.balakrishnan at oracle.com >>; Praveen Srivastava 

> <praveen.s.srivastava at oracle.com 

> < mailto:praveen.s.srivastava at oracle.com >> 

> *Subject:* Re: awt-dev Digest, Vol 123, Issue 9 

> 

> Hi, Krishna. 

> Here is my observation. 

> When 8012026 bug was fixed the robot.waitForIdle() does not work 

> properly, but the test uses Util.waitForIdle(). When the robot was 

> fixed the implementation of Util.waitForIdle() was reworked. 

> So if you use the old jdk and a new utils+test you will need to add 

> some delays. 

> Another issue is for coordinates. When this bug was fixed we do not 

> get a mouse move event for the first mouseMove(149,149). But this bug 

> was fixed on osx long time ago. 

> 

> I have attached an updated version of the test which fails on b109 and 

> pass on 110. For the current version of jdk delays/sleeps are not 

> necessary since waitForIdle should work. 

> The steps which are tested: 

> - Show frame1 

> - Move the mouse over frame1 

> - Show frame2 under the mouse 

> - Check the mouse position reported by frame2 

> - Check the mouse position reported by frame1 

> 

> ----- krishna.addepalli at oracle.com 

> < mailto:krishna.addepalli at oracle.com > 

> wrote: 

>> 

> 

>> 

> 

>> 

> 

> Hi Sergey, 

> 

> Any comments/concerns on the observations I sent? 

> 

> Thanks, 

> 

> Krishna 

> 

>> 

> 

> *From:*Krishna Addepalli 

>> *Sent:* Wednesday, July 19, 2017 3:40 PM 

>> *To:* Sergey Bylokhov <sergey.bylokhov at oracle.com 

> < mailto:sergey.bylokhov at oracle.com >> 

>> *Cc:* Praveen Srivastava ( praveen.s.srivastava at oracle.com 

> < mailto:praveen.s.srivastava at oracle.com >) 

> <praveen.s.srivastava at oracle.com 

> < mailto:praveen.s.srivastava at oracle.com >>; Prem Kumar Balakrishnan 

> ( prem.balakrishnan at oracle.com < mailto:prem.balakrishnan at oracle.com >) 

> < prem.balakrishnan at oracle.com <mailto:prem.balakrishnan at oracle.com >>; 

> Ambarish Rajeshwar Rapte ( ambarish.rapte at oracle.com 

> < mailto:ambarish.rapte at oracle.com >) <ambarish.rapte at oracle.com 

> < mailto:ambarish.rapte at oracle.com >>; Ajit Haribhau Ghaisas 

> ( ajit.ghaisas at oracle.com < mailto:ajit.ghaisas at oracle.com >) 

> < ajit.ghaisas at oracle.com <mailto:ajit.ghaisas at oracle.com >> 

>> *Subject:* RE: awt-dev Digest, Vol 123, Issue 9 

> 

> Hi Sergey, 

> 

> I have tried to reproduce the failure of the test in Mac, by 

> installing the jdk_1.8.0_b84 

> ( http://jre.us.oracle.com/java/re/jdk/8/promoted/all/b84/bundles/macos 

> x-x86_64 

> ) that was mentioned in the parent bug (8012026). 

> 

> Below are my observations: 

> 

> *OS* 

> 

> 

> 

> *Test Type* 

> 

> 

> 

> *Result* 

> 

> 

> 

> *Remarks* 

> 

> Mac 

> 

> 

> 

> Original Test 

> 

> 

> 

> Failure (Mouse position should be null) 

> 

> 

> 

> 1.It is not the expected failure though. It is supposed to fail with 

> "NotImpementedError". 

> 

> 2.Also, looks like the "r.waitForIdle()" is not properly working, 

> which is why the check for mouse position seems to be going through. 

> 

> Mac 

> 

> 

> 

> Modified Test 

> 

> (Added a delay between the two mouse move events) 

> 

> 

> 

> Failure (Wrong position reported. Should be [30,30] but was [29,29] 

> 

> 

> 

> 1.This is because, the logic of the test seems wrong. 

> 

> 2.Since a delay was added between mouse events, this is allowing the 

> events to be processed in sequential order. 

> 

> Mac 

> 

> 

> 

> Proposed Fix 

> 

> 

> 

> Pass 

> 

> 

> 

> Mac 

> 

> 

> 

> Applet attached with Bug 8012026 

> 

> 

> 

> Pass 

> 

> 

> 

> There is no failure ("NotImplementedError") observed in this case as well. 

> 

> Windows/Linux 

> 

> 

> 

> Original Test 

> 

> 

> 

> Failure (Wrong position reported. Should be [30,30] but was [29,29] 

> 

> 

> 

> This is because, the logic of the test seems wrong. 

> 

> Windows/Linus 

> 

> 

> 

> Proposed Fix 

> 

> 

> 

> Pass 

> 

> 

> 

> Based on the above, I have some comments about the test: 

> 

> 1.The test in current form, does not logically make sense, since 

> either the mouse position check should be [29,29], or frame2 should 

> register a mouse callback, in which case the check makes sense. 

> 

> 2.The original failure mentioned in the bug is not reproducible. 

> 

> 3.Since the original failure is reported with applet, should the test 

> also have to be based on applet? 

> 

> 4.Since the original bug is reported for mac, is the test intended to 

> run on Linux/Windows? 

> 

> 5.Robot.waitForIdle() does not seem to work properly on Mac. 

> 

> Could you suggest the course of action from here? 

> 

> Thanks, 

> 

> Krishna 

> 

> -----Original Message----- 

> 

> From: awt-dev-request at openjdk.java.net 

> < mailto:awt-dev-request at openjdk.java.net > 

> [ mailto:awt-dev-request at openjdk.java.net ] 

> 

> Sent: Tuesday, July 18, 2017 5:30 PM 

> 

> To: awt-dev at openjdk.java.net < mailto:awt-dev at openjdk.java.net > 

> 

> Subject: awt-dev Digest, Vol 123, Issue 9 

> 

> Send awt-dev mailing list submissions to 

> 

> awt-dev at openjdk.java.net < mailto:awt-dev at openjdk.java.net > 

> 

> To subscribe or unsubscribe via the World Wide Web, visit 

> 

> http://mail.openjdk.java.net/mailman/listinfo/awt-dev 

> 

> or, via email, send a message with subject or body 'help' to 

> 

> awt-dev-request at openjdk.java.net 

> < mailto:awt-dev-request at openjdk.java.net > 

> 

> You can reach the person managing the list at 

> 

> awt-dev-owner at openjdk.java.net < mailto:awt-dev-owner at openjdk.java.net > 

> 

> When replying, please edit your Subject line so it is more specific 

> than 

> "Re: Contents of awt-dev digest..." 

> 

> Today's Topics: 

> 

> 1. Re: [10][JDK-8027154] [TESTBUG] Test 

> 

> 

> java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java 

> 

> fails (Sergey Bylokhov) 

> 

> ---------------------------------------------------------------------- 

> 



Thanks, 

Krishna 



> 

From: Sergey Bylokhov 
> Sent: Tuesday, July 18, 2017 6:11 AM 
> To: Krishna Addepalli <krishna.addepalli at oracle.com> 
> Cc: awt-dev at openjdk.java.net; Ajit Ghaisas <ajit.ghaisas at oracle.com>; Praveen Srivastava <praveen.s.srivastava at oracle.com> 
> Subject: Re: [10][JDK-8027154] [TESTBUG] Test java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java fails 




Hi, Krishna. 
> Can you please confirm that the initial bug JDK-8012026 can be reproduced by the updated test? 
> The updated test should fail before JDK-8012026 was fixed, and works after. 
> 
> ----- krishna.addepalli at oracle.com wrote: 
> > 


Hi All, 



Please review the fix for test bug: 

Bug : JDK-8027154 <https://bugs.openjdk.java.net/browse/JDK-8027154> 

JDK 10 Webrev: http://cr.openjdk.java.net/~pkbalakr/Krishna/8027154/webrev00/ 

Summary: 

The test intends to check the mouse move on Frame2, which is drawn in the MouseMove callback for Frame1. 
> > 

However, the code wrongly asserts for the expected mouse position on Frame2, which was just created. 
> > 

Also, Frame2 has no callback registered for MouseMove, which is leading to different behaviors on different platforms. 

On Windows and Linux, the assertion is thrown for Mouse Position whereas on Mac, a NullPointerException is thrown. 
> > 

After moving the code into the callback for Frame2, the test passes on all the platforms. 
> > 

Thanks, 

Krishna 
> > 


> >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20170801/f5c7c040/attachment-0001.html>


More information about the awt-dev mailing list