Clover Coverage Report - FEST Swing 1.2
Coverage timestamp: Tue Jun 1 2010 15:19:25 PDT
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
7   137   7   1
0   34   1   7
7     1  
1    
 
  WindowFixture       Line # 39 7 0% 7 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on Feb 16, 2007
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5    * in compliance with the License. You may obtain a copy of the License at
6    *
7    * http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software distributed under the License
10    * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11    * or implied. See the License for the specific language governing permissions and limitations under
12    * the License.
13    *
14    * Copyright @2007-2010 the original author or authors.
15    */
16    package org.fest.swing.fixture;
17   
18    import static org.fest.swing.core.BasicRobot.robotWithCurrentAwtHierarchy;
19   
20    import java.awt.Dimension;
21    import java.awt.Window;
22   
23    import org.fest.swing.core.BasicRobot;
24    import org.fest.swing.core.Robot;
25    import org.fest.swing.exception.ComponentLookupException;
26    import org.fest.swing.lock.ScreenLock;
27   
28    /**
29    * Understands functional testing of <code>{@link Window}</code>s:
30    * <ul>
31    * <li>user input simulation</li>
32    * <li>state verification</li>
33    * <li>property value query</li>
34    * </ul>
35    * @param <T> the type of window handled by this fixture.
36    *
37    * @author Alex Ruiz
38    */
 
39    public abstract class WindowFixture<T extends Window> extends ContainerFixture<T> implements CommonComponentFixture,
40    WindowLikeContainerFixture, JPopupMenuInvokerFixture {
41   
42    /**
43    * Creates a new <code>{@link WindowFixture}</code>. This constructor creates a new <code>{@link Robot}</code>
44    * containing the current AWT hierarchy.
45    * @param type the type of <code>Window</code> to find using the created <code>Robot</code>.
46    * @throws NullPointerException if the given <code>Window</code> type is <code>null</code>.
47    * @throws ComponentLookupException if a <code>Window</code> having a matching type could not be found.
48    * @throws ComponentLookupException if more than one <code>Window</code> having a matching type is found.
49    * @see BasicRobot#robotWithCurrentAwtHierarchy()
50    */
 
51  1 toggle public WindowFixture(Class<? extends T> type) {
52  1 this(robotWithCurrentAwtHierarchy(), type);
53    }
54   
55    /**
56    * Creates a new <code>{@link WindowFixture}</code>.
57    * @param robot performs simulation of user events on a <code>Window</code>.
58    * @param type the type of <code>Window</code> to find using the given <code>Robot</code>.
59    * @throws NullPointerException if the given robot is <code>null</code>.
60    * @throws NullPointerException if the given <code>Window</code> type is <code>null</code>.
61    * @throws ComponentLookupException if a <code>Window</code> having a matching type could not be found.
62    * @throws ComponentLookupException if more than one <code>Window</code> having a matching type is found.
63    */
 
64  2 toggle public WindowFixture(Robot robot, Class<? extends T> type) {
65  2 super(robot, type);
66    }
67   
68    /**
69    * Creates a new <code>{@link WindowFixture}</code>. This constructor creates a new
70    * <code>{@link Robot}</code> containing the current AWT hierarchy.
71    * @param name the name of the <code>Window</code> to find.
72    * @param type the type of <code>Window</code> to find using the created <code>Robot</code>.
73    * @throws NullPointerException if the given <code>Window</code> type is <code>null</code>.
74    * @throws ComponentLookupException if a <code>Window</code> having a matching name could not be found.
75    * @throws ComponentLookupException if more than one <code>Window</code> having a matching name is found.
76    * @see BasicRobot#robotWithCurrentAwtHierarchy()
77    */
 
78  3 toggle public WindowFixture(String name, Class<? extends T> type) {
79  3 this(robotWithCurrentAwtHierarchy(), name, type);
80    }
81   
82    /**
83    * Creates a new <code>{@link WindowFixture}</code>.
84    * @param robot performs simulation of user events on a <code>Window</code>.
85    * @param name the name of the <code>Window</code> to find using the given <code>Robot</code>.
86    * @param type the type of <code>Window</code> to find using the given <code>Robot</code>.
87    * @throws NullPointerException if the given robot is <code>null</code>.
88    * @throws NullPointerException if the given <code>Window</code> type is <code>null</code>.
89    * @throws ComponentLookupException if a <code>Window</code> having a matching name could not be found.
90    * @throws ComponentLookupException if more than one <code>Window</code> having a matching name is found.
91    */
 
92  6 toggle public WindowFixture(Robot robot, String name, Class<? extends T> type) {
93  6 super(robot, name, type);
94    }
95   
96    /**
97    * Creates a new <code>{@link WindowFixture}</code>. This constructor creates a new <code>{@link Robot}</code>
98    * containing the current AWT hierarchy.
99    * @param target the <code>Window</code> to be managed by this fixture.
100    * @throws NullPointerException if the given target <code>Window</code> is <code>null</code>.
101    */
 
102  8 toggle public WindowFixture(T target) {
103  8 this(robotWithCurrentAwtHierarchy(), target);
104    }
105   
106    /**
107    * Creates a new <code>{@link WindowFixture}</code>.
108    * @param robot performs simulation of user events on the given <code>Window</code>.
109    * @param target the <code>Window</code> to be managed by this fixture.
110    * @throws NullPointerException if the given robot is <code>null</code>.
111    * @throws NullPointerException if the given target <code>Window</code> is <code>null</code>.
112    */
 
113  180 toggle public WindowFixture(Robot robot, T target) {
114  180 super(robot, target);
115    }
116   
117    /**
118    * Shows this fixture's <code>{@link Window}</code>.
119    * @return this fixture.
120    */
121    protected abstract WindowFixture<T> show();
122   
123    /**
124    * Shows this fixture's <code>{@link Window}</code>, resized to the given size.
125    * @param size the size to resize this fixture's <code>Window</code> to.
126    * @return this fixture.
127    */
128    protected abstract WindowFixture<T> show(Dimension size);
129   
130    /**
131    * Cleans up any used resources (keyboard, mouse, open windows and <code>{@link ScreenLock}</code>) used by this
132    * robot.
133    */
 
134  12 toggle public final void cleanUp() {
135  12 robot.cleanUp();
136    }
137    }