KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > uicapture > v1 > ScriptGeneratorUTest


1 /*
2  * @(#)ScriptGeneratorUTest.java
3  *
4  * Copyright (C) 2002-2003 Matt Albrecht
5  * groboclown@users.sourceforge.net
6  * http://groboutils.sourceforge.net
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24  * DEALINGS IN THE SOFTWARE.
25  */

26
27 package net.sourceforge.groboutils.uicapture.v1;
28
29 import java.awt.Robot JavaDoc;
30 import java.awt.Frame JavaDoc;
31 import java.awt.Rectangle JavaDoc;
32 import java.awt.Color JavaDoc;
33 import java.awt.Graphics2D JavaDoc;
34 import java.awt.image.BufferedImage JavaDoc;
35 import net.sourceforge.groboutils.uicapture.v1.event.*;
36
37 import net.sourceforge.groboutils.autodoc.v1.AutoDoc;
38 import junit.framework.Test;
39 import junit.framework.TestCase;
40 import junit.framework.TestSuite;
41 import org.easymock.EasyMock;
42 import org.easymock.MockControl;
43
44
45 /**
46  * Tests the ScriptGenerator class.
47  *
48  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
49  * @version $Date: 2003/02/10 22:52:34 $
50  * @since Oct 3, 2002
51  */

52 public class ScriptGeneratorUTest extends TestCase
53 {
54     //-------------------------------------------------------------------------
55
// Standard JUnit Class-specific declarations
56

57     private static final Class JavaDoc THIS_CLASS = ScriptGeneratorUTest.class;
58     private static final AutoDoc DOC = new AutoDoc( THIS_CLASS );
59     
60     public ScriptGeneratorUTest( String JavaDoc name )
61     {
62         super( name );
63     }
64
65
66     private MockControl scriptmakerControl;
67     private IScriptMaker mockScriptmaker;
68
69     
70     
71     /**
72      *
73      * @exception Exception thrown under any exceptional condition.
74      */

75     protected void setUp() throws Exception JavaDoc
76     {
77         super.setUp();
78         
79         // set ourself up
80
this.scriptmakerControl = EasyMock.controlFor( IScriptMaker.class );
81         this.mockScriptmaker = (IScriptMaker)this.scriptmakerControl.getMock();
82     }
83     
84
85     //-------------------------------------------------------------------------
86
// Tests
87

88     public void testInstantiation()
89     {
90         new ScriptGenerator( null, null, null, null );
91     }
92     
93     
94     public void testMouseWheelMovedNotStarted()
95     {
96         DOC.getIT().testsIssue( 618314 );
97         
98         // no method should be called in the scriptmaker.
99
//this.mockScriptmaker.removeText("Text");
100
//this.scriptmakerControl.setVoidCallable();
101

102         this.scriptmakerControl.activate();
103         ScriptGenerator sg = new ScriptGenerator( null, null,
104             this.mockScriptmaker, "base" );
105         MouseWheelCaptureEvent mwce = new MouseWheelCaptureEvent( 10 );
106         
107         
108         sg.mouseWheelMoved( mwce );
109         
110         
111         this.scriptmakerControl.verify();
112     }
113     
114     
115     
116     
117
118
119     //-------------------------------------------------------------------------
120
// Helpers
121

122     
123     
124     //-------------------------------------------------------------------------
125
// Standard JUnit declarations
126

127     
128     public static Test suite()
129     {
130         TestSuite suite = new TestSuite( THIS_CLASS );
131         
132         return suite;
133     }
134     
135     public static void main( String JavaDoc[] args )
136     {
137         String JavaDoc[] name = { THIS_CLASS.getName() };
138         
139         // junit.textui.TestRunner.main( name );
140
// junit.swingui.TestRunner.main( name );
141

142         junit.textui.TestRunner.main( name );
143     }
144     
145     
146     /**
147      *
148      * @exception Exception thrown under any exceptional condition.
149      */

150     protected void tearDown() throws Exception JavaDoc
151     {
152         // tear ourself down
153

154         super.tearDown();
155     }
156 }
157
158
Popular Tags