Mercurial > hg > jdk9-shenandoah > jdk
changeset 12776:600f0e7f6dd5
8039467: [TEST_BUG] Test java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java lefts keystrokes in a keyboard buffer on Windows
Reviewed-by: serb, alexsch
Contributed-by: Ambarish Rapte <ambarish.rapte@oracle.com>
author | alexsch |
---|---|
date | Mon, 14 Sep 2015 18:54:04 +0400 |
parents | 79d93ad73030 |
children | 298cca968b4f |
files | test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java |
diffstat | 1 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java Fri Sep 11 17:58:31 2015 +0300 +++ b/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java Mon Sep 14 18:54:04 2015 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015 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 @@ -23,7 +23,7 @@ /* @test - @bug 6566434 + @bug 6566434 8039467 @library ../../regtesthelpers @build Util Sysout AbstractTest @summary Choice in unfocusable window responds to keyboard @@ -63,6 +63,18 @@ w.setLayout(new FlowLayout()); w.setSize(200, 200); + // Note that Window w is non focusable. Key press events will not be + // consumed by w, but by any previously focused window & this can + // disturb the environment. So creating tempFrameToHoldFocus frame, + // to consume key press events. + Frame tempFrameToHoldFocus = new Frame(); + tempFrameToHoldFocus.setVisible(true); + Util.waitForIdle(robot); + + tempFrameToHoldFocus.requestFocus(); + Util.clickOnComp(tempFrameToHoldFocus, robot); + Util.waitForIdle(robot); + ch.addKeyListener(new KeyAdapter(){ public void keyTyped(KeyEvent e){ traceEvent("keytyped", e); @@ -94,6 +106,10 @@ testKeys(); Util.waitForIdle(robot); + + tempFrameToHoldFocus.dispose(); + w.dispose(); + f.dispose(); } private static void testKeys(){