1 26 27 package net.sourceforge.groboutils.uicapture.v1; 28 29 import junit.framework.Test; 30 import junit.framework.TestCase; 31 import junit.framework.TestSuite; 32 import net.sourceforge.groboutils.junit.v1.iftc.*; 33 34 import java.io.*; 35 36 37 44 public class IScriptMakerUTestI extends InterfaceTestCase 45 { 46 47 48 51 private static final Class THIS_CLASS = IScriptMakerUTestI.class; 52 53 public IScriptMakerUTestI( String name, ImplFactory f ) 54 { 55 super( name, IScriptMaker.class, f ); 56 } 57 58 59 62 66 protected void setUp() throws Exception 67 { 68 super.setUp(); 69 70 } 72 73 74 75 private IScriptMaker createIScriptMaker() 76 { 77 return (IScriptMaker)createImplObject(); 78 } 79 80 81 84 85 public void testStart1() 86 { 87 IScriptMaker ism = createIScriptMaker(); 88 ism.start(); 89 } 90 91 92 public void testStart2() 93 { 94 IScriptMaker ism = createIScriptMaker(); 95 ism.start(); 96 97 try 98 { 99 ism.start(); 100 fail( "Did not throw IllegalStateException." ); 101 } 102 catch (IllegalStateException e) 103 { 104 } 106 } 107 108 109 public void testStart3() 110 { 111 IScriptMaker ism = createIScriptMaker(); 112 ism.start(); 113 ism.end(); 114 115 try 116 { 117 ism.start(); 118 fail( "Did not throw IllegalStateException." ); 119 } 120 catch (IllegalStateException e) 121 { 122 } 124 } 125 126 127 public void testEnd1() 128 { 129 IScriptMaker ism = createIScriptMaker(); 130 ism.start(); 131 132 ism.end(); 133 } 134 135 136 public void testEnd2() 137 { 138 IScriptMaker ism = createIScriptMaker(); 139 try 140 { 141 ism.end(); 142 fail( "Did not throw IllegalStateException." ); 143 } 144 catch (IllegalStateException e) 145 { 146 } 148 } 149 150 151 public void testGenerateDelay1() 152 { 153 IScriptMaker ism = createIScriptMaker(); 154 ism.start(); 155 156 ism.generateDelay( 100 ); 157 } 158 159 160 public void testGenerateMoveMouseWheel1() 161 { 162 IScriptMaker ism = createIScriptMaker(); 163 ism.start(); 164 165 ism.generateMoveMouseWheel( 10 ); 166 } 167 168 169 public void testGenerateMoveMouse1() 170 { 171 IScriptMaker ism = createIScriptMaker(); 172 ism.start(); 173 174 ism.generateMoveMouse( 10, 20 ); 175 } 176 177 178 public void testGeneratePressMouse1() 179 { 180 IScriptMaker ism = createIScriptMaker(); 181 ism.start(); 182 183 ism.generatePressMouse( 0 ); 184 } 185 186 187 public void testGenerateReleaseMouse1() 188 { 189 IScriptMaker ism = createIScriptMaker(); 190 ism.start(); 191 192 ism.generateReleaseMouse( 0 ); 193 } 194 195 196 public void testGeneratePressKey1() 197 { 198 IScriptMaker ism = createIScriptMaker(); 199 ism.start(); 200 201 ism.generatePressKey( 1 ); 202 } 203 204 205 public void testGenerateReleaseKey1() 206 { 207 IScriptMaker ism = createIScriptMaker(); 208 ism.start(); 209 210 ism.generateReleaseKey( 1 ); 211 } 212 213 214 public void testGenerateScreenCapture1() 215 throws IOException 216 { 217 IScriptMaker ism = createIScriptMaker(); 218 ism.start(); 219 220 File f = new File( "blah" ); 221 FileWriter fw = new FileWriter( f ); 222 try 223 { 224 fw.write( "blah blah" ); 225 fw.flush(); 226 fw.close(); 227 228 ism.generateScreenCapture( f, 1, 100, 30, 30 ); 229 } 230 finally 231 { 232 f.delete(); 233 } 234 } 235 236 237 238 241 242 243 246 247 public static InterfaceTestSuite suite() 248 { 249 InterfaceTestSuite suite = new InterfaceTestSuite( THIS_CLASS ); 250 251 return suite; 252 } 253 254 public static void main( String [] args ) 255 { 256 String [] name = { THIS_CLASS.getName() }; 257 258 261 junit.textui.TestRunner.main( name ); 262 } 263 264 265 269 protected void tearDown() throws Exception 270 { 271 273 274 super.tearDown(); 275 } 276 } 277 278 | Popular Tags |