Clover coverage report - clover
Coverage timestamp: Sat Oct 8 2005 22:54:17 EDT
file stats: LOC: 70   Methods: 4
NCLOC: 51   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
EventEditorTest.java - 95.5% 75% 92.3%
coverage coverage
 1   
 package abbot.editor.editors;
 2   
 
 3   
 import java.awt.event.*;
 4   
 
 5   
 import javax.swing.JLabel;
 6   
 
 7   
 import junit.extensions.abbot.*;
 8   
 import abbot.script.*;
 9   
 
 10   
 /** Verify EventEditor operation. */
 11   
 
 12   
 public class EventEditorTest extends ComponentTestFixture {
 13   
 
 14   
     private Event event;
 15   
     private EventEditor editor;
 16   
 
 17  1
     public void testMouseEvent() {
 18  1
         JLabel label = new JLabel(getName());
 19  1
         showFrame(label);
 20  1
         MouseEvent me =
 21   
             new MouseEvent(label, MouseEvent.MOUSE_MOVED,
 22   
                            System.currentTimeMillis(),
 23   
                            MouseEvent.BUTTON1_MASK, 2, 3, 1, false);
 24  1
         event = new Event(getResolver(), "mouse press", me);
 25  1
         String refid = event.getComponentID();
 26  1
         editor = new EventEditor(event);
 27   
         // expect description, type, kind, component, x, y
 28  1
         assertEquals("Wrong number of fields", 6, editor.getComponents().length/4);
 29  1
         assertTrue("Type field should not be enabled",
 30   
                    !editor.type.isEnabled());
 31  1
         assertTrue("Kind field should not be enabled",
 32   
                    !editor.kind.isEnabled());
 33   
 
 34  1
         assertEquals("Wrong Component", refid,
 35   
                      editor.cref.getSelectedItem());
 36   
 
 37   
     }
 38   
 
 39  1
     public void testKeyEvent() {
 40  1
         JLabel label = new JLabel(getName());
 41  1
         showFrame(label);
 42  1
         KeyEvent ke =
 43   
             new KeyEvent(label, KeyEvent.KEY_PRESSED,
 44   
                          System.currentTimeMillis(),
 45   
                          0, KeyEvent.VK_A, KeyEvent.CHAR_UNDEFINED);
 46  1
         event = new Event(getResolver(), "key press", ke);
 47  1
         String refid = event.getComponentID();
 48  1
         editor = new EventEditor(event);
 49   
         // expect description, type, kind, component, keycode
 50  1
         assertEquals("Wrong number of fields", 5, editor.getComponents().length/4);
 51  1
         assertTrue("Type field should not be enabled",
 52   
                    !editor.type.isEnabled());
 53  1
         assertTrue("Kind field should not be editable",
 54   
                    !editor.kind.isEditable());
 55   
 
 56  1
         assertEquals("Wrong Component", refid,
 57   
                      editor.cref.getSelectedItem());
 58   
     }
 59   
 
 60   
     /** Construct a test case with the given name. */
 61  2
     public EventEditorTest(String name) {
 62  2
         super(name);
 63   
     }
 64   
 
 65   
     /** Run the default test suite. */
 66  0
     public static void main(String[] args) {
 67  0
         TestHelper.runTests(args, EventEditorTest.class);
 68   
     }
 69   
 }
 70