Skip to content
This repository has been archived by the owner. It is now read-only.

8015886: java/awt/Focus/DeiconifiedFrameLoosesFocus/DeiconifiedFrameLoosesFocus.java sometimes failed on ubuntu #272

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

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) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2021, 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
@@ -31,7 +31,9 @@
@run main DeiconifiedFrameLoosesFocus
*/

import java.awt.*;
import java.awt.Frame;
import java.awt.Robot;
import java.awt.Toolkit;
import test.java.awt.regtesthelpers.Util;

public class DeiconifiedFrameLoosesFocus {
@@ -41,7 +43,11 @@ public class DeiconifiedFrameLoosesFocus {
public static void main(String[] args) {
DeiconifiedFrameLoosesFocus app = new DeiconifiedFrameLoosesFocus();
app.init();
app.start();
try {
app.start();
} finally {
frame.dispose();
}
}

public void init() {
@@ -61,6 +67,7 @@ public void start() {
frame.setVisible(true);

Util.waitForIdle(robot);
robot.delay(1000);

if (!frame.isFocused()) {
Util.clickOnTitle(frame, robot);
@@ -79,10 +86,12 @@ void test() {
frame.setExtendedState(Frame.ICONIFIED);

Util.waitForIdle(robot);
robot.delay(500);

frame.setExtendedState(Frame.NORMAL);

Util.waitForIdle(robot);
robot.delay(500);

if (!frame.isFocused()) {
throw new TestFailedException("the Frame didn't regain focus after restoring!");