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 Vadim L. Bogdanov
19: * @version $Revision$
20: */package javax.swing.plaf.basic;
21:
22: import java.awt.Color;
23: import java.awt.Dimension;
24: import java.awt.Insets;
25: import java.awt.Point;
26: import javax.swing.JFrame;
27: import javax.swing.JToolBar;
28: import javax.swing.SwingConstants;
29: import javax.swing.SwingTestCase;
30:
31: public class BasicToolBarUI$DragWindowTest extends SwingTestCase {
32: private JToolBar toolBar;
33:
34: private BasicToolBarUI ui;
35:
36: private BasicToolBarUI.DragWindow dragWindow;
37:
38: @Override
39: protected void setUp() throws Exception {
40: super .setUp();
41: ui = new BasicToolBarUI();
42: toolBar = new JToolBar();
43: toolBar.setUI(ui);
44: JFrame frame = new JFrame();
45: frame.getContentPane().add(toolBar);
46: dragWindow = ui.createDragWindow(toolBar);
47: }
48:
49: @Override
50: protected void tearDown() throws Exception {
51: super .tearDown();
52: }
53:
54: public BasicToolBarUI$DragWindowTest(final String name) {
55: super (name);
56: }
57:
58: public void testGetInsets() {
59: assertEquals(new Insets(1, 1, 1, 1), dragWindow.getInsets());
60: }
61:
62: public void testSetGetBorderColor() {
63: dragWindow.setBorderColor(Color.red);
64: assertSame(Color.red, dragWindow.getBorderColor());
65: }
66:
67: public void testSetGetOffset() {
68: Point offset = new Point(1, 2);
69: dragWindow.setOffset(offset);
70: assertSame(offset, dragWindow.getOffset());
71: }
72:
73: public void testSetOrientation() {
74: dragWindow.setSize(1, 2);
75: dragWindow.setOrientation(SwingConstants.VERTICAL);
76: assertEquals(new Dimension(1, 2), dragWindow.getSize());
77: }
78:
79: public void testPaint() {
80: // Note: painting code, cannot test
81: }
82: }
|