<AWT Dev> Patch for LayoutExtraGaps

Man Wong mwong at redhat.com
Tue Jun 16 07:49:50 PDT 2009


    I was looking over one of the failures for a jtreg test on openjdk and the test case did not make sense to me, which led me to make changes to the test case.

    First of all, the test was in java/awt/GridLayout/LayoutExtraGaps.java. The test currently under the openjdk I believe was trying to test whether a GridLayout object centre its component properly (based on the message printed by the exception). It tested that by checking if the origin coordinate of the first component (each component is a rectangle, and there are 29 rectangles in a panel and there are 4 panels in the main window) is (0,0). If both x and y are 0 for any of the panels, then the test fails. I also think that the reason why they chose (0,0) as the failing point because base on the values they passed in, x and y cannot both be at (0,0). This is not valid because the error that was output states, "Test failed. GridLayout doesn't center component.", but the components are in fact centred, since all opposite boarders have equal dimension.

    When I looked at the gui generated, there are boarders between the rectangles and its parent panel. And the boarder changes as the gui window resizes (not sure if that is another problem in java or if it was intentional). Not surprisingly, two of the panels were initialized such that there is no boarder between itself and the rectangles, causing the test to fail. Which the test should not have failed because everything was centred properly.

    I created a fix to the test case (attached to this email) that checks if the boarder at the right equals the boarder at the left, and if the boarder at the top equals the boarder at the bottom. Instead of checking whether the origin coordinate of the first component is (0,0).  

Thanks for looking things over, and hope to hear from you soon.

Man Lung Wong
-------------- next part --------------
A non-text attachment was scrubbed...
Name: icedtea-jtreg-layoutextragaps.patch
Type: text/x-patch
Size: 5739 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20090616/c471fd5d/icedtea-jtreg-layoutextragaps.patch 

More information about the awt-dev mailing list