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 Alexander T. Simbirtsev
19: * @version $Revision$
20: */package javax.swing.plaf.basic;
21:
22: import java.awt.Dimension;
23: import javax.swing.JButton;
24: import javax.swing.JSeparator;
25: import javax.swing.SwingConstants;
26:
27: public class BasicPopupMenuSeparatorUITest extends BasicSeparatorUITest {
28: @Override
29: protected void setUp() throws Exception {
30: super .setUp();
31: ui = new BasicPopupMenuSeparatorUI();
32: }
33:
34: @Override
35: protected void tearDown() throws Exception {
36: super .tearDown();
37: }
38:
39: /*
40: * Test method for 'javax.swing.plaf.basic.BasicSeparatorUI.getPreferredSize(JComponent)'
41: */
42: @Override
43: public void testGetSizes() {
44: JSeparator separator1 = new JSeparator(
45: SwingConstants.HORIZONTAL);
46: JSeparator separator2 = new JSeparator(SwingConstants.VERTICAL);
47: assertNull(ui.getMinimumSize(new JButton()));
48: separator1.setUI(ui);
49: assertEquals(new Dimension(0, 2), ui
50: .getPreferredSize(separator1));
51: separator2.setUI(ui);
52: assertEquals(new Dimension(0, 2), ui
53: .getPreferredSize(separator2));
54: assertNull(ui.getMaximumSize(new JButton()));
55: }
56:
57: /*
58: * Test method for 'javax.swing.plaf.basic.BasicPopupMenuSeparatorUI.createUI(JComponent)'
59: */
60: @Override
61: public void testCreateUI() {
62: assertNotNull("created UI is not null",
63: BasicPopupMenuSeparatorUI.createUI(new JButton()));
64: assertTrue(
65: "created UI is of the proper class",
66: BasicPopupMenuSeparatorUI.createUI(null) instanceof BasicPopupMenuSeparatorUI);
67: assertNotSame("created UI is of unique",
68: BasicPopupMenuSeparatorUI.createUI(null),
69: BasicPopupMenuSeparatorUI.createUI(null));
70: }
71: }
|