From 0c47835ce95f2ec267ff107aeabdd01eb980f2de Mon Sep 17 00:00:00 2001 From: Sreeprakash Sreedharan Date: Thu, 15 Jun 2017 17:13:33 +0530 Subject: [PATCH] 8181782: [TESTBUG] [Macosx] JTextAreaEmojiTest is not executed Reviewed-by: psadhukhan, aniyogi --- .../JTextArea/8148555/JTextAreaEmojiTest.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/jdk/test/javax/swing/JTextArea/8148555/JTextAreaEmojiTest.java b/jdk/test/javax/swing/JTextArea/8148555/JTextAreaEmojiTest.java index 5b16e3c53e3..d94a3f6c5d1 100644 --- a/jdk/test/javax/swing/JTextArea/8148555/JTextAreaEmojiTest.java +++ b/jdk/test/javax/swing/JTextArea/8148555/JTextAreaEmojiTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, 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 @@ -33,12 +33,15 @@ import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.SwingUtilities; import static javax.swing.WindowConstants.EXIT_ON_CLOSE; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; /* @test - * @bug 8148555 + * @key headful + * @bug 8148555 8181782 * @summary verifies JTextArea emoji enter exception. Emoji is not supported. * @requires (os.family=="mac") - * @run main JTextAreaEmojiTest + * @run main/manual JTextAreaEmojiTest */ public class JTextAreaEmojiTest implements ActionListener { @@ -55,10 +58,16 @@ public class JTextAreaEmojiTest implements private static JButton failButton; private static JFrame mainFrame; + private static final CountDownLatch testRunLatch = new CountDownLatch(1); public static void main(String[] args) throws Exception { JTextAreaEmojiTest test = new JTextAreaEmojiTest(); + boolean status = testRunLatch.await(5, TimeUnit.MINUTES); + + if (!status) { + throw new RuntimeException("Test timed out"); + } } public JTextAreaEmojiTest() throws Exception { @@ -143,7 +152,6 @@ public class JTextAreaEmojiTest implements public void actionPerformed(ActionEvent evt) { if (evt.getSource() instanceof JButton) { JButton btn = (JButton) evt.getSource(); - cleanUp(); switch (btn.getActionCommand()) { case "Pass": @@ -151,10 +159,13 @@ public class JTextAreaEmojiTest implements case "Fail": throw new AssertionError("Test case has failed!"); } + + cleanUp(); } } private static void cleanUp() { mainFrame.dispose(); + testRunLatch.countDown(); } }