Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8015886: java/awt/Focus/DeiconifiedFrameLoosesFocus/DeiconifiedFrameL…
…oosesFocus.java sometimes failed on ubuntu

Reviewed-by: kizune, serb
  • Loading branch information
Alexander Zvegintsev committed Jul 24, 2021
1 parent 8adf008 commit 049b2ad4dfbc13d21fd58467a0975097a17e8681
Showing with 12 additions and 3 deletions.
  1. +12 −3 test/jdk/java/awt/Focus/DeiconifiedFrameLoosesFocus/DeiconifiedFrameLoosesFocus.java
@@ -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 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!");

1 comment on commit 049b2ad

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 049b2ad Jul 24, 2021

Please sign in to comment.