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   62   6   1.17
0   30   0.86   6
6     1  
1    
 
  ComponentEnabledCondition       Line # 34 7 0% 6 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on Apr 5, 2008
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 @2008-2010 the original author or authors.
15    */
16    package org.fest.swing.driver;
17   
18    import static org.fest.swing.format.Formatting.format;
19    import static org.fest.swing.query.ComponentEnabledQuery.isEnabled;
20    import static org.fest.util.Strings.concat;
21   
22    import java.awt.Component;
23   
24    import org.fest.assertions.Description;
25    import org.fest.swing.edt.GuiLazyLoadingDescription;
26    import org.fest.swing.timing.Condition;
27   
28    /**
29    * Understands a condition that verifies that a component is enabled.
30    * @see Component#isEnabled()
31    *
32    * @author Yvonne Wang
33    */
 
34    class ComponentEnabledCondition extends Condition {
35    private Component c;
36   
 
37  2 toggle static ComponentEnabledCondition untilIsEnabled(Component c) {
38  2 return new ComponentEnabledCondition(c);
39    }
40   
 
41  2 toggle private ComponentEnabledCondition(Component c) {
42  2 super(description(c));
43  2 this.c = c;
44    }
45   
 
46  2 toggle private static Description description(final Component c) {
47  2 return new GuiLazyLoadingDescription() {
 
48  1 toggle protected String loadDescription() {
49  1 return concat(format(c), " to be enabled");
50    }
51    };
52    }
53   
 
54  96 toggle public boolean test() {
55  96 return isEnabled(c);
56    }
57   
58    /** ${@inheritDoc} */
 
59  2 toggle @Override protected void done() {
60  2 c = null;
61    }
62    }