harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Pavlenko (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-5215) [classlib][awt] Incorrect mouse modifiers processing
Date Wed, 28 Nov 2007 16:18:42 GMT
[classlib][awt] Incorrect mouse modifiers processing
----------------------------------------------------

                 Key: HARMONY-5215
                 URL: https://issues.apache.org/jira/browse/HARMONY-5215
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: Linux
            Reporter: Andrey Pavlenko
            Assignee: Andrey Pavlenko


Under Linux mouse modifiers are processed incorrectly. The following test demonstrates the
issue.

public void test() throws Exception {
        final Frame f = new Frame();
        final Point l = MouseInfo.getPointerInfo().getLocation();
        final Robot r = new Robot();
        final MouseEvent[] e = new MouseEvent[1];

        f.addMouseListener(new MouseAdapter() {
            public void mouseReleased(final MouseEvent event) {
                synchronized (e) {
                    e[0] = event;
                    e.notify();
                }
            }

            public void mousePressed(final MouseEvent event) {
                synchronized (e) {
                    e[0] = event;
                    e.notify();
                }
            }
        });

        f.setSize(100, 100);
        f.setVisible(true);
        r.mouseMove(f.getX() + 50, f.getY() + 50);

        try {
            synchronized (e) {
                r.mousePress(InputEvent.BUTTON1_MASK);
                e.wait(5000);
                assertEquals(InputEvent.BUTTON1_MASK, e[0].getModifiers());
                assertEquals(InputEvent.BUTTON1_DOWN_MASK,
                    e[0].getModifiersEx());

                r.mouseRelease(InputEvent.BUTTON1_MASK);
                e.wait(5000);
                assertEquals(InputEvent.BUTTON1_MASK, e[0].getModifiers());
                assertEquals(0, e[0].getModifiersEx());

                r.mousePress(InputEvent.BUTTON1_MASK);
                e.wait(5000);
                r.mousePress(InputEvent.BUTTON2_MASK);
                e.wait(5000);
                assertEquals(InputEvent.BUTTON2_MASK, e[0].getModifiers());
                assertEquals(InputEvent.BUTTON1_DOWN_MASK
                    | InputEvent.BUTTON2_DOWN_MASK, e[0].getModifiersEx());

                r.mouseRelease(InputEvent.BUTTON2_MASK);
                e.wait(5000);
                assertEquals(InputEvent.BUTTON2_MASK, e[0].getModifiers());
                assertEquals(InputEvent.BUTTON1_DOWN_MASK,
                    e[0].getModifiersEx());

                r.mousePress(InputEvent.BUTTON2_MASK);
                e.wait(5000);
                r.mousePress(InputEvent.BUTTON3_MASK);
                e.wait(5000);
                assertEquals(InputEvent.BUTTON3_MASK, e[0].getModifiers());
                assertEquals(InputEvent.BUTTON1_DOWN_MASK
                    | InputEvent.BUTTON2_DOWN_MASK
                    | InputEvent.BUTTON3_DOWN_MASK, e[0].getModifiersEx());

                r.mouseRelease(InputEvent.BUTTON3_MASK);
                e.wait(5000);
                assertEquals(InputEvent.BUTTON3_MASK, e[0].getModifiers());
                assertEquals(InputEvent.BUTTON1_DOWN_MASK
                    | InputEvent.BUTTON2_DOWN_MASK, e[0].getModifiersEx());
            }
        } finally {
            r.mouseRelease(InputEvent.BUTTON1_MASK);
            r.mouseRelease(InputEvent.BUTTON2_MASK);
            r.mouseRelease(InputEvent.BUTTON3_MASK);
            r.mouseMove(l.x, l.y);
            f.dispose();
        }
    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message