8198335: java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java fails in headless mode
Reviewed-by: prr
--- a/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java Fri Mar 30 10:24:51 2018 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java Fri Mar 30 13:57:19 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,7 @@
import sun.awt.AWTAutoShutdown;
import sun.awt.AWTPermissions;
import sun.awt.AppContext;
+import sun.awt.DisplayChangedListener;
import sun.awt.LightweightFrame;
import sun.awt.SunToolkit;
import sun.awt.util.ThreadGroupUtils;
@@ -802,9 +803,10 @@
public native int getMaximumCursorColors();
static void paletteChanged() {
- ((Win32GraphicsEnvironment)GraphicsEnvironment
- .getLocalGraphicsEnvironment())
- .paletteChanged();
+ Object lge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ if (lge instanceof DisplayChangedListener) {
+ ((DisplayChangedListener) lge).paletteChanged();
+ }
}
/*
@@ -816,9 +818,10 @@
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
- ((Win32GraphicsEnvironment)GraphicsEnvironment
- .getLocalGraphicsEnvironment())
- .displayChanged();
+ Object lge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ if (lge instanceof DisplayChangedListener) {
+ ((DisplayChangedListener) lge).displayChanged();
+ }
}
});
}
--- a/test/jdk/ProblemList.txt Fri Mar 30 10:24:51 2018 -0700
+++ b/test/jdk/ProblemList.txt Fri Mar 30 13:57:19 2018 -0700
@@ -171,7 +171,6 @@
java/awt/EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java 6990210 generic-all
java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.html 4931413 windows-all
java/awt/FullScreen/FullScreenInsets/FullScreenInsets.java 7019055 windows-all
-java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java 8198335 windows-all
java/awt/Focus/8013611/JDK8013611.java 8175366 windows-all,macosx-all
java/awt/Focus/6378278/InputVerifierTest.java 8198616 macosx-all
java/awt/Focus/6382144/EndlessLoopTest.java 8198617 macosx-all
--- a/test/jdk/java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java Fri Mar 30 10:24:51 2018 -0700
+++ b/test/jdk/java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java Fri Mar 30 13:57:19 2018 -0700
@@ -23,12 +23,13 @@
/**
* @test
- * @bug 6358034 6568560 8198613
+ * @bug 6358034 6568560 8198613 8198335
* @key headful
* @summary Tests that no exception is thrown when display mode is changed
* externally
* @compile UninitializedDisplayModeChangeTest.java DisplayModeChanger.java
* @run main/othervm UninitializedDisplayModeChangeTest
+ * @run main/othervm -Djava.awt.headless=true UninitializedDisplayModeChangeTest
*/
import java.awt.EventQueue;