test/jdk/javax/swing/JComboBox/6632953/bug6632953.java
author serb
Fri, 16 Feb 2018 12:24:38 -0800
changeset 49090 82c1fe23c469
parent 47216 71c04702a3d5
permissions -rw-r--r--
8196196: Headful tests should not be run in headless mode Reviewed-by: prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6649
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
     1
/*
49090
82c1fe23c469 8196196: Headful tests should not be run in headless mode
serb
parents: 47216
diff changeset
     2
 * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
6649
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
     4
 *
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
     8
 *
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    13
 * accompanied this code).
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    14
 *
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    18
 *
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    21
 * questions.
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    22
 */
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    23
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    24
/* @test
30495
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    25
 * @bug 6632953 8078614
6649
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    26
 * @summary MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    27
 * @author Alexander Potochkin
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    28
 */
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    29
import javax.swing.JComboBox;
30495
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    30
import javax.swing.SwingUtilities;
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    31
import javax.swing.UIManager;
49090
82c1fe23c469 8196196: Headful tests should not be run in headless mode
serb
parents: 47216
diff changeset
    32
import javax.swing.UnsupportedLookAndFeelException;
6649
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    33
import javax.swing.plaf.metal.MetalComboBoxUI;
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    34
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    35
public class bug6632953 {
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    36
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    37
    public static void main(String... args) throws Exception {
30495
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    38
        SwingUtilities.invokeAndWait(new Runnable() {
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    39
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    40
            @Override
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    41
            public void run() {
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    42
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    43
                for (UIManager.LookAndFeelInfo lafInfo
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    44
                        : UIManager.getInstalledLookAndFeels()) {
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    45
                    try {
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    46
                        UIManager.setLookAndFeel(lafInfo.getClassName());
49090
82c1fe23c469 8196196: Headful tests should not be run in headless mode
serb
parents: 47216
diff changeset
    47
                    } catch (UnsupportedLookAndFeelException ignored) {
82c1fe23c469 8196196: Headful tests should not be run in headless mode
serb
parents: 47216
diff changeset
    48
                        continue;
30495
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    49
                    } catch (Exception e) {
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    50
                        throw new RuntimeException(e);
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    51
                    }
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    52
                    MetalComboBoxUI ui = new MetalComboBoxUI();
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    53
                    ui.installUI(new JComboBox());
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    54
                    ui.getBaseline(new JComboBox(), 0, 0);
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    55
                    ui.getBaseline(new JComboBox(), 1, 1);
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    56
                    ui.getBaseline(new JComboBox(), 2, 2);
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    57
                    ui.getBaseline(new JComboBox(), 3, 3);
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    58
                    ui.getBaseline(new JComboBox(), 4, 4);
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    59
                }
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    60
            }
ab8287b4c789 8078614: WindowsClassicLookAndFeel MetalComboBoxUI.getbaseLine fails with IllegalArgumentException
alexsch
parents: 6649
diff changeset
    61
        });
6649
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    62
    }
3a9910603ab2 6632953: MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
alexp
parents:
diff changeset
    63
}