--- old/test/jdk/java/awt/event/KeyEvent/KeyChar/KeyCharTest.java 2018-11-08 15:41:41.000000000 +0530 +++ new/test/jdk/java/awt/event/KeyEvent/KeyChar/KeyCharTest.java 2018-11-08 15:41:41.000000000 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -25,6 +25,7 @@ import java.awt.Frame; import java.awt.Robot; import java.awt.Toolkit; +import java.awt.AWTException; import java.awt.event.AWTEventListener; import java.awt.event.KeyEvent; import java.util.Locale; @@ -32,9 +33,8 @@ /* * @test * @key headful - * @bug 8022401 8160623 + * @bug 8022401 8160623 8213522 * @summary Wrong key char - * @author Alexandr Scherbatiy * @run main KeyCharTest */ public class KeyCharTest { @@ -57,22 +57,23 @@ }, AWTEvent.KEY_EVENT_MASK); } - public static void main(String[] args) throws Exception { - - + public static void main(String[] args) { Frame frame = new Frame(); frame.setSize(300, 300); frame.setVisible(true); - Robot robot = new Robot(); - robot.setAutoDelay(50); - robot.waitForIdle(); - - robot.keyPress(KeyEvent.VK_DELETE); - robot.keyRelease(KeyEvent.VK_DELETE); - robot.waitForIdle(); - - frame.dispose(); + try { + Robot robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.delay(500); + + robot.keyPress(KeyEvent.VK_DELETE); + robot.keyRelease(KeyEvent.VK_DELETE); + } catch (AWTException ex) { + throw new RuntimeException(ex); + } finally { + frame.dispose(); + } if (eventsCount != 3) { throw new RuntimeException("Wrong number of key events: " + eventsCount);