jdk/test/javax/swing/JDialog/6639507/bug6639507.java
author mfang
Wed, 17 Aug 2011 14:18:26 -0700
changeset 10294 8fcdae2a7ec7
parent 7500 dec4b445efc6
child 46151 5fa789776f7d
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7500
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
     1
/*
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
     2
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
     4
 *
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
     7
 * published by the Free Software Foundation.
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
     8
 *
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    13
 * accompanied this code).
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    14
 *
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    18
 *
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    21
 * questions.
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    22
 */
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    23
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    24
/* @test
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    25
   @bug 6639507
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    26
   @summary Title of javax.swing.JDialog is null while spec says it's empty
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    27
   @author Pavel Porvatov
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    28
*/
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    29
import javax.swing.*;
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    30
import java.awt.*;
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    31
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    32
public class bug6639507 {
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    33
    public static void main(String[] args) {
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    34
        SwingUtilities.invokeLater(new Runnable() {
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    35
            public void run() {
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    36
                assertEmptyTitle(new Dialog((Frame) null), "new Dialog((Frame) null)");
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    37
                assertEmptyTitle(new Dialog((Frame) null, true), "new Dialog((Frame) null, true)");
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    38
                assertEmptyTitle(new Dialog((Dialog) null), "new Dialog((Dialog) null)");
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    39
                assertEmptyTitle(new Dialog((Window) null), "new Dialog((Window) null)");
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    40
                assertEmptyTitle(new Dialog(new Dialog((Window) null), Dialog.ModalityType.APPLICATION_MODAL),
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    41
                        "new Dialog((Window) null), Dialog.ModalityType.APPLICATION_MODAL");
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    42
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    43
                assertEmptyTitle(new JDialog((Frame) null), "new JDialog((Frame) null)");
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    44
                assertEmptyTitle(new JDialog((Frame) null, true), "new JDialog((Frame) null, true)");
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    45
                assertEmptyTitle(new JDialog((Dialog) null), "new JDialog((Dialog) null)");
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    46
                assertEmptyTitle(new JDialog((Dialog) null, true), "new JDialog((Dialog) null, true)");
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    47
                assertEmptyTitle(new JDialog((Window) null), "new JDialog((Window) null)");
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    48
                assertEmptyTitle(new JDialog((Window) null, Dialog.ModalityType.APPLICATION_MODAL),
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    49
                        "new JDialog((Window) null, Dialog.ModalityType.APPLICATION_MODAL)");
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    50
            }
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    51
        });
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    52
    }
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    53
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    54
    private static void assertEmptyTitle(Dialog dialog, String ctr) {
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    55
        String title = dialog.getTitle();
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    56
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    57
        if (title == null || title.length() > 0) {
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    58
            throw new RuntimeException("Title is not empty for constructor " + ctr);
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    59
        }
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    60
    }
dec4b445efc6 6639507: Title of javax.swing.JDialog is null while spec says it's empty
rupashka
parents:
diff changeset
    61
}