Hello Robin,
Your bug report has been recorded under id:
JDK-8158178 java.awt.SplashScreen.getSize() returns incorrect size
for high dpi splash screens
https://bugs.openjdk.java.net/browse/JDK-8158178
Thank you for the contribution. The described issue has been fixed in
JDK 9 with the fix
JDK-8145174 HiDPI splash screen support on Linux
http://hg.openjdk.java.net/jdk9/client/jdk/rev/e3fd20ff65cd
But the patch for the test definitely also can be contributed.
I have loaded it to:
http://cr.openjdk.java.net/~alexsch/robin.stevens/8158178/webrev.00
Could you resend the review request with the title "[9] Review
request for BugID bug summary" and links to bug and webrev to the
awt-dev alias?
Thanks,
Alexandr.
On 5/30/2016 8:05 PM, Robin Stevens wrote:
Hello,
the patch for JDK-8043869 (introduced with change
http://cr.openjdk.java.net/~alexsch/8043869/webrev.03/
<http://cr.openjdk.java.net/%7Ealexsch/8043869/webrev.03/>) contains a
bug.
The java.awt.SplashScreen#getSize returns an incorrect height value
when a hi dpi splash screen is shown. There is no bug available yet in
the public JIRA bug tracker, although I submitted a bug report for
this through http://bugs.java.com/ .
The following patch fixes that problem, and updates the test to detect
the problem:
diff --git a/src/share/classes/java/awt/SplashScreen.java
b/src/share/classes/java/awt/SplashScreen.java
--- a/src/share/classes/java/awt/SplashScreen.java
+++ b/src/share/classes/java/awt/SplashScreen.java
@@ -250,7 +250,7 @@
assert scale > 0;
if (scale > 0 && scale != 1) {
bounds.setSize((int) (bounds.getWidth() / scale),
- (int) (bounds.getWidth() / scale));
+ (int) (bounds.getHeight() / scale));
}
return bounds;
}
diff --git
a/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
b/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
---
a/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
+++
b/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
@@ -93,6 +93,15 @@
int screenX = (int) splashBounds.getCenterX();
int screenY = (int) splashBounds.getCenterY();
+ if(splashBounds.width != IMAGE_WIDTH){
+ throw new RuntimeException(
+ "SplashScreen#getBounds has wrong width");
+ }
+ if(splashBounds.height != IMAGE_HEIGHT){
+ throw new RuntimeException(
+ "SplashScreen#getBounds has wrong height");
+ }
+
Robot robot = new Robot();
Color splashScreenColor = robot.getPixelColor(screenX, screenY);
Diff was created against this revision:
http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/rev/4d6c03fb1039
Note that this is my first contribution. I think I followed all the
guidelines from http://openjdk.java.net/contribute/ . Please let me
know if I did anything wrong.
Kind regards,
Robin