Hi Sergey,

I think the current behavior is intentionally implemented in awt in Windows. I 
don't know how JDK-4902933 is marked as resolved, but there is a linked issue 
JDK-7171412. Here is the link to the patch that was pushed as fix for this 
issue, and we can see that there is an explicit suppression of event 
propagation in case of same index being selected again. Pasting the current 
code for reference:
MsgRouting AwtChoice::WmNotify(UINT notifyCode)
{
    if (notifyCode == CBN_SELCHANGE) {
        int selectedIndex = (int)SendMessage(CB_GETCURSEL);

        JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
        jobject target = GetTarget(env);
        int previousIndex = env->GetIntField(target, selectedIndexID);

        if (selectedIndex != CB_ERR && selectedIndex != previousIndex){
            DoCallback("handleAction", "(I)V", selectedIndex);
        }

This is the reason why the test is failing.

Hope this clarifies.

Thanks,
Krishna

-----Original Message-----
From: Sergey Bylokhov 
Sent: Tuesday, May 29, 2018 8:48 PM
To: Krishna Addepalli <krishna.addepa...@oracle.com>; awt-dev@openjdk.java.net
Subject: Re: <AWT Dev> [11][JDK-8197810]RFR: Test 
java/awt/Choice/SelectCurrentItemTest/SelectCurrentItemTest.html fails on 
Windows

Hi, Krishna.
On 08/05/2018 02:59, Krishna Addepalli wrote:
> The basic problem is that, the Robot mouse move is moving to position 
> where item 0 is located (which is already selected), and selecting it.
> Since this item is already selected, there is no new item selection 
> event generated, which is why the test fails.
As far as I understand the usecase which your describe was implemented 
intentionally in this test to verify the bug:
https://bugs.openjdk.java.net/browse/JDK-4902933

Did you check what is the reason of behavior change?


--
Best regards, Sergey.

Reply via email to