Hi, Pavel,

the test seems to be correct - at least, in JDK7. It conforms to JavaSE 7 specification (Window.setLocationRelativeTo() method), which is slightly different than in JavaSE 6:

     * <li>If the component is {...@code null}, or the {...@code
     * GraphicsConfiguration} associated with this component is
     * {...@code null}, the window is placed in the center of the
     * screen. The center point can be obtained with the {...@link
     * GraphicsEnvironment#getCenterPoint
     * GraphicsEnvironment.getCenterPoint} method.
     *
     * <li>If the component is not {...@code null}, but it is not
     * currently showing, the window is placed in the center of
     * the target screen defined by the {...@code
     * GraphicsConfiguration} associated with this component.
     *
     * <li>If the component is not {...@code null} and is shown on
     * the screen, then the window is located in such a way that
     * the center of the window coincides with the center of the
     * component.

Is your change targeted to OpenJDK6? If yes, it looks fine.

Thanks,

Artem

On 1/25/2010 7:54 PM, Pavel Tisnovsky wrote:
Hi,

please review changes made in regression test
/java/awt/Multiscreen/LocationRelativeToTest/LocationRelativeToTest.java

Webrev is available at
http://cr.openjdk.java.net/~ptisnovs/LocationRelativeToTest/

I changed only minor part of test code utilized to check, if frame is
placed at the center of the screen. The test should (IMHO, of course)
use Point returned by GraphicsEnvironment.getCenterPoint() in this case,
not coordinates computed from selected GraphicsConfiguration's bound.

According to JavaSE 6 documentation:
"If the component is not currently showing (*** our case ***), or c is
null, the window is placed at the center of the screen. The center point
can be determined with GraphicsEnvironment.getCenterPoint"

Tested on:
Fedora 10 with multi-screen configuration (laptop screen+external LCD)
RHEL 5 x86_64 with virtual framebuffer
(this tests fails on these machines before being patched)

Thanks in advance
Pavel Tisnovsky
Red Hat QA

Reply via email to