01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: /**
18: * @author Sergey Burlak
19: * @version $Revision$
20: */package javax.swing.plaf.basic;
21:
22: import javax.swing.JToolTip;
23: import javax.swing.SwingTestCase;
24: import javax.swing.UIManager;
25: import javax.swing.UnsupportedLookAndFeelException;
26:
27: public class BasicToolTipUITest extends SwingTestCase {
28: private BasicToolTipUI tooltipUI;
29:
30: private JToolTip tooltip;
31:
32: @Override
33: protected void setUp() throws Exception {
34: super .setUp();
35: try {
36: UIManager.setLookAndFeel(new BasicLookAndFeel() {
37: private static final long serialVersionUID = 1L;
38:
39: @Override
40: public boolean isNativeLookAndFeel() {
41: return true;
42: }
43:
44: @Override
45: public boolean isSupportedLookAndFeel() {
46: return true;
47: }
48:
49: @Override
50: public String getDescription() {
51: return "";
52: }
53:
54: @Override
55: public String getID() {
56: return "";
57: }
58:
59: @Override
60: public String getName() {
61: return "";
62: }
63: });
64: } catch (UnsupportedLookAndFeelException e1) {
65: e1.printStackTrace();
66: }
67: tooltip = new JToolTip();
68: tooltipUI = new BasicToolTipUI();
69: }
70:
71: @Override
72: protected void tearDown() throws Exception {
73: tooltipUI = null;
74: tooltip = null;
75: super .tearDown();
76: }
77:
78: public void testCreateUI() throws Exception {
79: assertNotNull(BasicToolTipUI.createUI(null));
80: assertTrue(BasicToolTipUI.createUI(null) == BasicToolTipUI
81: .createUI(null));
82: }
83:
84: public void testGetSize() throws Exception {
85: assertEquals(tooltipUI.getPreferredSize(tooltip), tooltipUI
86: .getMaximumSize(tooltip));
87: assertEquals(tooltipUI.getPreferredSize(tooltip), tooltipUI
88: .getMinimumSize(tooltip));
89: }
90: }
|