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: * Created on 27.04.2005
21:
22: */package javax.swing.plaf.basic;
23:
24: import javax.swing.JButton;
25: import javax.swing.SwingTestCase;
26:
27: public class BasicToggleButtonUITest extends SwingTestCase {
28: public class MyBasicToggleButtonUI extends BasicToggleButtonUI {
29: @Override
30: public String getPropertyPrefix() {
31: return super .getPropertyPrefix();
32: }
33:
34: @Override
35: public int getTextShiftOffset() {
36: return super .getTextShiftOffset();
37: }
38: };
39:
40: public MyBasicToggleButtonUI ui = null;
41:
42: public static void main(final String[] args) {
43: junit.textui.TestRunner.run(BasicToggleButtonUITest.class);
44: }
45:
46: /*
47: * @see TestCase#setUp()
48: */
49: @Override
50: protected void setUp() throws Exception {
51: super .setUp();
52: ui = new MyBasicToggleButtonUI();
53: }
54:
55: public void testCreateUI() {
56: assertTrue("created UI is not null",
57: null != BasicToggleButtonUI.createUI(new JButton()));
58: assertTrue(
59: "created UI is of the proper class",
60: BasicToggleButtonUI.createUI(null) instanceof BasicToggleButtonUI);
61: assertTrue("created UI is of unique", BasicToggleButtonUI
62: .createUI(null) == BasicToggleButtonUI.createUI(null));
63: }
64:
65: public void testGetPropertyPrefix() {
66: assertEquals("prefix ", "ToggleButton.", ui.getPropertyPrefix());
67: }
68:
69: public void testGetTextShiftOffset() {
70: assertEquals("offset", 0, ui.getTextShiftOffset());
71: }
72: }
|