Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8253274: The CycleDMImagetest brokes the system #222

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -63,7 +63,7 @@
boolean earlyExit = false;
Image rImage = null, wImage = null, bImage = null;
int imgSize = 10;
Robot robot = null;
static Robot robot = null;
volatile static boolean done = false;
static String errorMessage = null;

@@ -106,15 +106,6 @@ static void delay(long ms) {
}

public boolean checkResult(DisplayMode dm) {
if (robot == null) {
try {
robot = new Robot();
}
catch (Exception e) {
errorMessage = "Problems creating Robot";
return false;
}
}
Rectangle bounds = getGraphicsConfiguration().getBounds();
int pixels[] = new int[imgSize * 4];
BufferedImage clientPixels =
@@ -175,6 +166,7 @@ public void run() {
gd.setFullScreenWindow((Window) getParent());
// First, delay a bit just to let the fullscreen window
// settle down before switching display modes
robot.waitForIdle();
delay(1000);

if (!gd.isDisplayChangeSupported()) {
@@ -197,10 +189,12 @@ public void run() {
boolean skip = false;
for (final DisplayMode dmUnique : dmSubset) {
int bitDepth = dm.getBitDepth();
if (bitDepth == 24 ||
(dmUnique.getWidth() == dm.getWidth() &&
dmUnique.getHeight() == dm.getHeight() &&
dmUnique.getBitDepth() == dm.getBitDepth())) {
int width = dm.getWidth();
int height = dm.getHeight();
if (bitDepth == 24 || width <= 800 || height <= 600 ||
(dmUnique.getWidth() == width &&
dmUnique.getHeight() == height &&
dmUnique.getBitDepth() == bitDepth)) {
skip = true;
break;
}
@@ -265,7 +259,8 @@ public void keyPressed(KeyEvent e) {
public void keyReleased(KeyEvent e) {
}

public static void main(String args[]) {
public static void main(String args[]) throws Exception {
robot = new Robot();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
for (final GraphicsDevice gd: ge.getScreenDevices()) {
if (!gd.isFullScreenSupported()) {
@@ -274,6 +269,7 @@ public static void main(String args[]) {
continue;
}
done = false;
DisplayMode currentDM = gd.getDisplayMode();
Frame frame = new Frame(gd.getDefaultConfiguration());
try {
frame.setSize(400, 400);
@@ -292,14 +288,16 @@ public static void main(String args[]) {
}
}
} finally {
gd.setDisplayMode(currentDM);
gd.setFullScreenWindow(null);
frame.dispose();
}
if (errorMessage != null) {
throw new RuntimeException(errorMessage);
}
// delay a bit just to let the fullscreen window disposing complete
// before switching to next display
delay(4000);
delay(10000);

This comment has been minimized.

@mrserb

mrserb Sep 17, 2020
Author Member

Will sleep long enough to let the display mode switch occur.

}
}
}