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 Dmitry A. Durnev
19: * @version $Revision$
20: */package java.awt;
21:
22: import java.awt.Frame.AccessibleAWTFrame;
23:
24: import javax.accessibility.AccessibleContext;
25: import javax.accessibility.AccessibleRole;
26: import javax.accessibility.AccessibleState;
27: import javax.accessibility.AccessibleStateSet;
28:
29: import junit.framework.TestCase;
30:
31: /**
32: * AccessibleAWTFrameTest
33: */
34: public class AccessibleAWTFrameTest extends TestCase {
35:
36: AccessibleContext ac;
37: private Frame frame;
38:
39: @Override
40: protected void setUp() throws Exception {
41: super .setUp();
42: frame = new Frame();
43: ac = frame.getAccessibleContext();
44: }
45:
46: @Override
47: protected void tearDown() throws Exception {
48: super .tearDown();
49: if ((frame != null) && frame.isDisplayable()) {
50: frame.dispose();
51: }
52: }
53:
54: public final void testGetAccessibleRole() {
55: assertSame(AccessibleRole.FRAME, ac.getAccessibleRole());
56: }
57:
58: public final void testGetAccessibleStateSet() {
59: AccessibleStateSet aStateSet = ac.getAccessibleStateSet();
60: assertFalse("accessible frame is active", aStateSet
61: .contains(AccessibleState.ACTIVE));
62: assertTrue("accessible frame is resizable", aStateSet
63: .contains(AccessibleState.RESIZABLE));
64: frame.setResizable(false);
65: aStateSet = ac.getAccessibleStateSet();
66: assertFalse("accessible frame is NOT resizable", aStateSet
67: .contains(AccessibleState.RESIZABLE));
68:
69: }
70:
71: public final void testAccessibleAWTFrame() {
72: assertTrue(ac instanceof AccessibleAWTFrame);
73: }
74: }
|