001: /*
002: * @(#)ScriptGeneratorUTest.java
003: *
004: * Copyright (C) 2002-2003 Matt Albrecht
005: * groboclown@users.sourceforge.net
006: * http://groboutils.sourceforge.net
007: *
008: * Permission is hereby granted, free of charge, to any person obtaining a
009: * copy of this software and associated documentation files (the "Software"),
010: * to deal in the Software without restriction, including without limitation
011: * the rights to use, copy, modify, merge, publish, distribute, sublicense,
012: * and/or sell copies of the Software, and to permit persons to whom the
013: * Software is furnished to do so, subject to the following conditions:
014: *
015: * The above copyright notice and this permission notice shall be included in
016: * all copies or substantial portions of the Software.
017: *
018: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
019: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
020: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
021: * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
022: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
023: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
024: * DEALINGS IN THE SOFTWARE.
025: */
026:
027: package net.sourceforge.groboutils.uicapture.v1;
028:
029: import java.awt.Robot;
030: import java.awt.Frame;
031: import java.awt.Rectangle;
032: import java.awt.Color;
033: import java.awt.Graphics2D;
034: import java.awt.image.BufferedImage;
035: import net.sourceforge.groboutils.uicapture.v1.event.*;
036:
037: import net.sourceforge.groboutils.autodoc.v1.AutoDoc;
038: import junit.framework.Test;
039: import junit.framework.TestCase;
040: import junit.framework.TestSuite;
041: import org.easymock.EasyMock;
042: import org.easymock.MockControl;
043:
044: /**
045: * Tests the ScriptGenerator class.
046: *
047: * @author Matt Albrecht <a href="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
048: * @version $Date: 2003/02/10 22:52:34 $
049: * @since Oct 3, 2002
050: */
051: public class ScriptGeneratorUTest extends TestCase {
052: //-------------------------------------------------------------------------
053: // Standard JUnit Class-specific declarations
054:
055: private static final Class THIS_CLASS = ScriptGeneratorUTest.class;
056: private static final AutoDoc DOC = new AutoDoc(THIS_CLASS);
057:
058: public ScriptGeneratorUTest(String name) {
059: super (name);
060: }
061:
062: private MockControl scriptmakerControl;
063: private IScriptMaker mockScriptmaker;
064:
065: /**
066: *
067: * @exception Exception thrown under any exceptional condition.
068: */
069: protected void setUp() throws Exception {
070: super .setUp();
071:
072: // set ourself up
073: this .scriptmakerControl = EasyMock
074: .controlFor(IScriptMaker.class);
075: this .mockScriptmaker = (IScriptMaker) this .scriptmakerControl
076: .getMock();
077: }
078:
079: //-------------------------------------------------------------------------
080: // Tests
081:
082: public void testInstantiation() {
083: new ScriptGenerator(null, null, null, null);
084: }
085:
086: public void testMouseWheelMovedNotStarted() {
087: DOC.getIT().testsIssue(618314);
088:
089: // no method should be called in the scriptmaker.
090: //this.mockScriptmaker.removeText("Text");
091: //this.scriptmakerControl.setVoidCallable();
092:
093: this .scriptmakerControl.activate();
094: ScriptGenerator sg = new ScriptGenerator(null, null,
095: this .mockScriptmaker, "base");
096: MouseWheelCaptureEvent mwce = new MouseWheelCaptureEvent(10);
097:
098: sg.mouseWheelMoved(mwce);
099:
100: this .scriptmakerControl.verify();
101: }
102:
103: //-------------------------------------------------------------------------
104: // Helpers
105:
106: //-------------------------------------------------------------------------
107: // Standard JUnit declarations
108:
109: public static Test suite() {
110: TestSuite suite = new TestSuite(THIS_CLASS);
111:
112: return suite;
113: }
114:
115: public static void main(String[] args) {
116: String[] name = { THIS_CLASS.getName() };
117:
118: // junit.textui.TestRunner.main( name );
119: // junit.swingui.TestRunner.main( name );
120:
121: junit.textui.TestRunner.main(name);
122: }
123:
124: /**
125: *
126: * @exception Exception thrown under any exceptional condition.
127: */
128: protected void tearDown() throws Exception {
129: // tear ourself down
130:
131: super.tearDown();
132: }
133: }
|