001 /*
002 * Created on Dec 18, 2007
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
005 * in compliance with the License. You may obtain a copy of the License at
006 *
007 * http://www.apache.org/licenses/LICENSE-2.0
008 *
009 * Unless required by applicable law or agreed to in writing, software distributed under the License
010 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
011 * or implied. See the License for the specific language governing permissions and limitations under
012 * the License.
013 *
014 * Copyright @2007-2010 the original author or authors.
015 */
016 package org.fest.swing.fixture;
017
018 import java.awt.Dimension;
019 import java.awt.Point;
020
021 /**
022 * Understands functional testing of window-like containers (not necessarily subclasses of
023 * <code>{@link java.awt.Window}</code>):
024 * <ul>
025 * <li>user input simulation</li>
026 * <li>state verification</li>
027 * <li>property value query</li>
028 * </ul>
029 *
030 * @author Yvonne Wang
031 * @author Alex Ruiz
032 */
033 public interface WindowLikeContainerFixture {
034
035 /**
036 * Simulates a user closing this fixture's window-like container.
037 */
038 void close();
039
040 /**
041 * Simulates a user resizing horizontally this fixture's window-like container.
042 * @param width the width that this fixture's window-like container should have after being resized.
043 * @return this fixture.
044 */
045 WindowLikeContainerFixture resizeWidthTo(int width);
046
047 /**
048 * Simulates a user resizing vertically this fixture's window-like container.
049 * @param height the height that this fixture's window-like container should have after being resized.
050 * @return this fixture.
051 */
052 WindowLikeContainerFixture resizeHeightTo(int height);
053
054 /**
055 * Simulates a user resizing this fixture's window-like container.
056 * @param size the size that the target window should have after being resized.
057 * @return this fixture.
058 */
059 WindowLikeContainerFixture resizeTo(Dimension size);
060
061 /**
062 * Asserts that the size of this fixture's window-like container is equal to given one.
063 * @param size the given size to match.
064 * @return this fixture.
065 * @throws AssertionError if the size of this fixture's window-like container is not equal to the given size.
066 */
067 WindowLikeContainerFixture requireSize(Dimension size);
068
069 /**
070 * Simulates a user moving this fixture's window-like container to the given point.
071 * @param p the point to move this fixture's window-like container to.
072 * @return this fixture.
073 */
074 WindowLikeContainerFixture moveTo(Point p);
075
076
077 /**
078 * Brings this fixture's window-like component to the front.
079 * @return this fixture.
080 */
081 WindowLikeContainerFixture moveToFront();
082
083 /**
084 * Sends this fixture's window-like component to the back.
085 * @return this fixture.
086 */
087 WindowLikeContainerFixture moveToBack();
088 }