Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/swing/JDialog/6639507/bug6639507.java
38854 views
/*1* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/* @test24@bug 663950725@summary Title of javax.swing.JDialog is null while spec says it's empty26@author Pavel Porvatov27*/28import javax.swing.*;29import java.awt.*;3031public class bug6639507 {32public static void main(String[] args) {33SwingUtilities.invokeLater(new Runnable() {34public void run() {35assertEmptyTitle(new Dialog((Frame) null), "new Dialog((Frame) null)");36assertEmptyTitle(new Dialog((Frame) null, true), "new Dialog((Frame) null, true)");37assertEmptyTitle(new Dialog((Dialog) null), "new Dialog((Dialog) null)");38assertEmptyTitle(new Dialog((Window) null), "new Dialog((Window) null)");39assertEmptyTitle(new Dialog(new Dialog((Window) null), Dialog.ModalityType.APPLICATION_MODAL),40"new Dialog((Window) null), Dialog.ModalityType.APPLICATION_MODAL");4142assertEmptyTitle(new JDialog((Frame) null), "new JDialog((Frame) null)");43assertEmptyTitle(new JDialog((Frame) null, true), "new JDialog((Frame) null, true)");44assertEmptyTitle(new JDialog((Dialog) null), "new JDialog((Dialog) null)");45assertEmptyTitle(new JDialog((Dialog) null, true), "new JDialog((Dialog) null, true)");46assertEmptyTitle(new JDialog((Window) null), "new JDialog((Window) null)");47assertEmptyTitle(new JDialog((Window) null, Dialog.ModalityType.APPLICATION_MODAL),48"new JDialog((Window) null, Dialog.ModalityType.APPLICATION_MODAL)");49}50});51}5253private static void assertEmptyTitle(Dialog dialog, String ctr) {54String title = dialog.getTitle();5556if (title == null || title.length() > 0) {57throw new RuntimeException("Title is not empty for constructor " + ctr);58}59}60}616263