Patch for LayoutExtraGaps

Man Wong mwong at redhat.com
Tue Jun 16 07:36:53 PDT 2009


Hi,

    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



More information about the distro-pkg-dev mailing list