001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Dmitry A. Durnev
019: * @version $Revision$
020: */package java.awt;
021:
022: import junit.framework.TestCase;
023:
024: public class CardLayoutRTest extends TestCase {
025: Container emptyContainer;
026: Dimension defSize;
027: CardLayout layout;
028: private Dimension maxSize;
029:
030: @Override
031: protected void setUp() throws Exception {
032: super .setUp();
033: emptyContainer = new Container();
034: defSize = new Dimension();
035: maxSize = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
036: layout = new CardLayout();
037: }
038:
039: public void testFirst() {
040: try {
041: layout.first(emptyContainer);
042: } catch (IllegalArgumentException iae) {
043: return;
044: }
045: fail("Expected IllegalArgumentException");
046: }
047:
048: public final void testGetLayoutAlignmentX1() {
049: layout.getLayoutAlignmentX(null);
050: }
051:
052: public final void testGetLayoutAlignmentX2() {
053: layout.getLayoutAlignmentX(emptyContainer);
054: }
055:
056: public final void testGetLayoutAlignmentY1() {
057: layout.getLayoutAlignmentY(null);
058: }
059:
060: public final void testGetLayoutAlignmentY2() {
061: layout.getLayoutAlignmentY(emptyContainer);
062: }
063:
064: public void testLast() {
065: try {
066: layout.last(emptyContainer);
067: } catch (IllegalArgumentException iae) {
068: return;
069: }
070: fail("Expected IllegalArgumentException");
071: }
072:
073: public void testLayoutContainer() {
074: layout.layoutContainer(emptyContainer);
075: }
076:
077: public final void testMaximumLayoutSize1() {
078: assertEquals(maxSize, layout.maximumLayoutSize(null));
079: }
080:
081: public final void testMaximumLayoutSize2() {
082: assertEquals(maxSize, layout.maximumLayoutSize(emptyContainer));
083: }
084:
085: public final void testMinimumLayoutSize() {
086: assertEquals(defSize, layout.minimumLayoutSize(emptyContainer));
087: }
088:
089: public void testNext() {
090: try {
091: layout.next(emptyContainer);
092: } catch (IllegalArgumentException iae) {
093: return;
094: }
095: fail("Expected IllegalArgumentException");
096: }
097:
098: public final void testPreferredLayoutSize() {
099: assertEquals(defSize, layout
100: .preferredLayoutSize(emptyContainer));
101: }
102:
103: public void testPrevious() {
104: try {
105: layout.previous(emptyContainer);
106: } catch (IllegalArgumentException iae) {
107: return;
108: }
109: fail("Expected IllegalArgumentException");
110: }
111:
112: public void testRemoveLayoutComponent() {
113: layout.removeLayoutComponent(emptyContainer);
114: }
115:
116: }
|