You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Andrey Pavlenko (JIRA)" <ji...@apache.org> on 2006/12/15 17:23:24 UTC

[jira] Commented: (HARMONY-2469) [classlib][awt]Windows is not focused when WindowsAdapter.windowOpened(WindowEvent e) is occurred

    [ http://issues.apache.org/jira/browse/HARMONY-2469?page=comments#action_12458835 ] 
            
Andrey Pavlenko commented on HARMONY-2469:
------------------------------------------

I can't reproduce the issue.
Is the following test correct?

public void test() throws InterruptedException {
        final Frame frame = new Frame();
        final WindowOpenedListener l = new WindowOpenedListener();

        frame.addWindowListener(l);
        frame.pack();
        frame.setVisible(true);
        Thread.sleep(1000);

        System.out.println(l.e.getWindow().isActive());
        System.out.println(l.e.getWindow().isFocused());

        try {
            assertTrue(l.e.getWindow().isActive());
            assertTrue(l.e.getWindow().isFocused());
        } finally {
            frame.dispose();
        }
    }

    static class WindowOpenedListener extends WindowAdapter {
        WindowEvent e;

        public void windowOpened(final WindowEvent e) {
            this.e = e;
        }
    }

Output:
true
true

> [classlib][awt]Windows is not focused when WindowsAdapter.windowOpened(WindowEvent e) is occurred
> -------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2469
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2469
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>            Priority: Minor
>
> There is no mention in java spec about 
> that if window has been opened with WindowsAdapter.windowOpened(WindowEvent e) 
> and became the focused.
> On RI a windows became  the focused but on Harmony does not.
> Test for bug reproducing:
> import java.awt.*;
> import java.awt.event.*;
> public class Test {
>         public static void main(String argv[]) throws Exception {
>         Frame frame = new Frame();
>         frame.addWindowListener(new WindowAdapter() {
>             public void windowOpened(WindowEvent e) {
> //                        public void windowActivated(WindowEvent e) {
>                     System.out.println(e.paramString());
>                                 if (!e.getWindow().isActive() &&
> !e.getWindow().isFocused()) {
>                     System.out.println("FAILED\n" + e.getWindow().isActive()
> +"\n"+ e.getWindow().isFocused());
>                                 } else {
>                                         System.out.println("PASSED");
>                                 }
>             }
>         });
>         frame.pack();
>         frame.setVisible(true);
>         try {
>             Thread.sleep(1000);
>         } catch (InterruptedException e1) {            
>             e1.printStackTrace();
>         }
>         frame.dispose();
>         }
> }       
> Output on RI:
> $ jj Test
> WINDOW_OPENED,opposite=null,oldState=0,newState=0
> PASSED
> Output on Harmony:
> $
> /cygdrive/z/binaries/builds/combined/20060914/drl_20060914_win_ia32_0002_icl_r_complete_DEV/bin/java
> Test
> WINDOW_OPENED,opposite=null,oldState=0,newState=0
> FAILED
> false
> false
> Failing tests:
> unitHarmony_java_awt_WinWindowRTest
> Test output:
> Time: 3.717
> There was 1 failure:
> 1) testSetVisible(java.awt.WinWindowRTest)junit.framework.AssertionFailedError:
> window is focused before opened
>         at java.awt.WinWindowRTest$1.windowOpened(WinWindowRTest.java:45)
>         at java.awt.Window.processWindowEvent(Window.java:1072)
>         at java.awt.Window.processEvent(Window.java:1038)
>         at java.awt.Component.dispatchEvent(Component.java:3582)
>         at java.awt.EventQueueCore.dispatchEventImpl(EventQueueCore.java:141)
>         at java.awt.EventQueue.dispatchEvent(EventQueue.java:143)
>         at
> java.awt.EventDispatchThread.runModalLoop(EventDispatchThread.java:67)
>         at java.awt.EventDispatchThread.run(EventDispatchThread.java:46)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira