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.Icon;
23: import javax.swing.SwingTestCase;
24:
25: public class BasicIconFactoryTest extends SwingTestCase {
26: public void testGetRadioButtonIcon() {
27: checkIcon(BasicIconFactory.getRadioButtonIcon(), 13, 13);
28: assertSame(BasicIconFactory.getRadioButtonIcon(),
29: BasicIconFactory.getRadioButtonIcon());
30: }
31:
32: public void testGetMenuArrowIcon() {
33: checkIcon(BasicIconFactory.getMenuArrowIcon(), 8, 4);
34: assertSame(BasicIconFactory.getMenuArrowIcon(),
35: BasicIconFactory.getMenuArrowIcon());
36: }
37:
38: public void testGetMenuItemArrowIcon() {
39: checkIcon(BasicIconFactory.getMenuItemArrowIcon(), 8, 4);
40: assertSame(BasicIconFactory.getMenuItemArrowIcon(),
41: BasicIconFactory.getMenuItemArrowIcon());
42: }
43:
44: public void testCreateEmptyFrameIcon() {
45: checkIcon(BasicIconFactory.createEmptyFrameIcon(), 16, 14);
46: assertSame(BasicIconFactory.createEmptyFrameIcon(),
47: BasicIconFactory.createEmptyFrameIcon());
48: }
49:
50: public void testGetCheckBoxIcon() {
51: checkIcon(BasicIconFactory.getCheckBoxIcon(), 13, 13);
52: assertSame(BasicIconFactory.getCheckBoxIcon(), BasicIconFactory
53: .getCheckBoxIcon());
54: }
55:
56: public void testGetCheckBoxMenuItemIcon() {
57: checkIcon(BasicIconFactory.getCheckBoxMenuItemIcon(), 9, 9);
58: assertSame(BasicIconFactory.getCheckBoxMenuItemIcon(),
59: BasicIconFactory.getCheckBoxMenuItemIcon());
60: }
61:
62: public void testGetMenuItemCheckIcon() {
63: checkIcon(BasicIconFactory.getMenuItemCheckIcon(), 9, 9);
64: assertSame(BasicIconFactory.getMenuItemCheckIcon(),
65: BasicIconFactory.getMenuItemCheckIcon());
66: }
67:
68: public void testGetRadioButtonMenuItemIcon() {
69: checkIcon(BasicIconFactory.getRadioButtonMenuItemIcon(), 6, 6);
70: assertSame(BasicIconFactory.getRadioButtonMenuItemIcon(),
71: BasicIconFactory.getRadioButtonMenuItemIcon());
72: }
73:
74: private void checkIcon(final Icon icon, final int height,
75: final int width) {
76: assertNotNull(icon);
77: assertEquals(height, icon.getIconHeight());
78: assertEquals(width, icon.getIconWidth());
79: }
80: }
|