<Swing Dev> [9] Review Request: 8144166 [macosx] Test java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java fails
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Thu Mar 10 20:35:04 UTC 2016
Hello.
Please review the fix for jdk9.
Problem description:
- CompEventOnHiddenComponent test was written not according the
specification but according an assumption(performance related) - "the
component should not post move/resize events if no listeners were
registered". The test creates a JInternalFrame and adds
ComponentListener to it. No events should come to the listeners, because
the frame is not resized or moved by the test(except initial layout).
Initial move/resize events are skipped usually, because during
initialization there are no any listeners. But this is not the case in
Aqua. AquaInternalFrameDockIconUI adds a listeners to the JInternalFrame
during initialization -> move/resize events are posted -> the test adds
own listeners -> events dispatched -> the test listeners called -> boom.
According above description the bug could be closed as not a defect. But
I found another related problem in the AquaInternalFrameDockIconUI.
- These component listeners in AquaInternalFrameDockIconUI are used to
maintain the cache of image for the dock(the icon which is used when the
internal frame is minimized). The logic is next:
* Before the frame will be minimized it draws to the special
ImageIcon which will be used as an icon for the dock.
* After the frame is minimized and dock is showing the saved image
will be used(and placed to the cache)
* If the frame will be resized/show the cache will be reset.
* When in the next time the same frame will be minimized the cached
image will be used.
The bug is in the last step. When the frame will be minimized in the
second time, it can have another content. But minimized icon will show
the miniature from the previous minimization. Note this is the only step
where the cache is used.
Solution:
As a solution all cache related stuff were dropped. The new test was added.
Bug: https://bugs.openjdk.java.net/browse/JDK-8144166
Webrev can be found at: http://cr.openjdk.java.net/~serb/8144166/webrev.01
--
Best regards, Sergey.
More information about the swing-dev
mailing list