JDK-8215105 : java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java: Wrong Pixel Color
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8,10,11,12
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2018-12-05
  • Updated: 2023-08-07
  • Resolved: 2019-03-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 8 Other
11.0.6-oracleFixed 13 b15Fixed 8u301Fixed openjdk8u382Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
$ uname -a
Darwin unit 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64

JDK under test: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)


A DESCRIPTION OF THE PROBLEM :
The test java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java fails on MacOSX, Windows. This failure was also observed on Kubuntu (KDE)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
$ jtreg -ignore:quiet -v -a -xml  -testjdk:/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/ java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java

ACTUAL -
#section:main
----------messages:(5/270)----------
command: main -Dsun.java2d.uiScale=1 ScreenCaptureTest
reason: User specified action: run main/othervm -Dsun.java2d.uiScale=1 ScreenCaptureTest 
Mode: othervm [/othervm specified]
Additional options from @modules: --add-modules java.desktop
elapsed time (seconds): 1.55
----------configuration:(3/40)----------
Boot Layer
  add modules: java.desktop

----------System.out:(0/0)----------
----------System.err:(13/849)----------
java.lang.RuntimeException: Wrong Pixel Color! Expected GREEN
	at ScreenCaptureTest.main(ScreenCaptureTest.java:93)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115)
	at java.base/java.lang.Thread.run(Thread.java:834)

JavaTest Message: Test threw exception: java.lang.RuntimeException: Wrong Pixel Color! Expected GREEN
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.RuntimeException: Wrong Pixel Color! Expected GREEN

---------- BEGIN SOURCE ----------
http://hg.openjdk.java.net/jdk/jdk11/file/1ddf9a99e4ad/test/jdk/java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java
---------- END SOURCE ----------

FREQUENCY : always



Comments
Fix request (8u) Mostly clean backport, the usage of "new" API was removed in the test. Backported for parity with 8u301-oracle. The fix was verified by the test. all other "java_desktop" tests are green Review 8u-dev: https://github.com/openjdk/jdk8u-dev/pull/297
14-04-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk8u-dev/pull/297 Date: 2023-04-04 05:32:40 +0000
04-04-2023

11u Fix Request: I would like to backport this patch to 11u, as it is in Oracle's 11u backport. The original patch applies cleanly in 11u.
18-10-2019

URL: http://hg.openjdk.java.net/jdk/jdk/rev/9727e63dff13 User: psadhukhan Date: 2019-04-03 08:46:47 +0000
03-04-2019

URL: http://hg.openjdk.java.net/jdk/client/rev/9727e63dff13 User: serb Date: 2019-03-29 23:10:47 +0000
29-03-2019

I have tested macOS 10.12/13/14 the only constant which works on all is a kCGColorSpaceSRGB + Display Profile "sRGB IEC 61966-2.1". So we can: - Change nothing and skip "support" of 10.13.6 where "kCGColorSpaceGenericRGB" + "Generic RGB Profiles" does not work. - Apply the current fix, but then we need to change the requirement to the test systems(macos 10.12/10.14) to use "sRGB IEC 61966-2.1" But since "kCGColorSpaceGenericRGB is available only for legacy reasons." it make sense to use kCGColorSpaceSRGB https://developer.apple.com/documentation/coregraphics/kcgcolorspacegenericrgb
07-03-2019

The new "kCGColorSpaceSRGB" constant should be used instead of "kCGColorSpaceGenericRGB", it also has a good side effect, the "Generic RGB Profiles" for our tests are not necessary anymore.
18-12-2018

I am not sure the root cause of this bug, but on my local system some amount of the tests which uses this API start to fail. I guess the reason is deprecation of "kCGColorSpaceGenericRGB". https://developer.apple.com/documentation/coregraphics/kcgcolorspacegenericrgb We need to replace it by some other native API.
18-12-2018

Test failed on Mac OS 10.13.6 with JDK 12 internal build.
11-12-2018

The test failed when checked in mac OS X 10.13.6 for reported version 11.0.1. $ ./jtreg -ignore:quiet -v -a -xml -testjdk:/Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home/ /Users/tester/workspace/jdk12/test/jdk/java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java XML output to /Users/RAPALLAT/pardeep/workspace/jtreg/bin/JTwork runner starting test: java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java runner finished test: java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Wrong Pixel Color! Expected GREEN Test results: failed: 1 Results: ========== JDK 10: Fail JDK 11.0.1: Fail JDK 12: Fail
10-12-2018