|
|
1.1 ! root 1: 'FastTest.inc - definitions/declarations for Fast Test routines ! 2: ' ! 3: ' Copyright (c) 1991-1992, Microsoft Corporation. All rights reserved. ! 4: ' ! 5: 'Purpose: ! 6: ' This file declares the functions, constants and variables ! 7: ' used by the Fast Test routines. ! 8: ' ! 9: 'NOTES: ! 10: ' A common code sequence is used throughout to catch unexpected errors ! 11: ' using the ON ERROR command. The sequence is explained in this note ! 12: ' but not each time that it is used. ! 13: ' ! 14: ' gErrorType = ET_NEXT ' Global variable to indicate how to handle ! 15: ' ' an unexpected error: ! 16: ' ' ET_NEXT : save that error happened ! 17: ' ' and continue on next statement ! 18: ' ' ET_NOTHING : let driver catch unexpected ! 19: ' ' errors with message ! 20: ' ' ET_LOG : error happened in log routine ! 21: ' ! 22: ' ' some code that could cause runtime errors ! 23: ' fh1% = FREEFILE ' out of handles? ! 24: ' OPEN stFileSpec1$ FOR INPUT AS #fh1% ' file doesn't exist? ! 25: ' fh2% = FREEFILE ' out of handles? ! 26: ' OPEN stFileSpec2$ FOR INPUT AS #fh2% ' file doesn't exist? ! 27: ' ! 28: ' IF gfError THEN ' since ET_NEXT was used above, we would ! 29: ' ' execute this block if an error had ! 30: ' ' occurred. ! 31: ' XLogFailure "Could not open files for XFileCmp" ' log a failure ! 32: ' ' specific to this section of code ! 33: ' ' if XSetTerminate is called to have scripts continue in event ! 34: ' ' of errors, then the script will continue executing here ! 35: ' gErrorType = ET_NOTHING ' reset so other unexpected errors are ! 36: ' ' caught ! 37: ' gfError = FALSE ' reset because we logged this already ! 38: ' EXIT SUB ' can't continue with this function, ! 39: ' ' something went wrong ! 40: ' END IF ! 41: ! 42: ! 43: ! 44: '$DEFINE TESTCTRL ! 45: '$DEFINE TESTEVNT ! 46: '$INCLUDE 'MSTEST.inc' ! 47: '$INCLUDE 'WNAPIDEC.INC' ! 48: ! 49: ' XLog constants to determine where to log information to ! 50: CONST LOG_DISK = 2 'log to disk ! 51: CONST LOG_SCREEN = 4 'log to screen (viewport in testdrvr) ! 52: CONST LOG_COM1 = 8 'log to COM1 port ! 53: CONST LOG_COM2 = 16 'log to COM2 port ! 54: CONST LOG_MSGBOX = 32 'log the string in a msgbox (Pause in testdrvr) ! 55: ! 56: ' Mouse button constants that map to QueMouse function names, X functions ! 57: ' can use either ones ! 58: CONST LBUTTON% = VK_LBUTTON ! 59: CONST MBUTTON% = VK_MBUTTON ! 60: CONST RBUTTON% = VK_RBUTTON ! 61: ! 62: 'Global to be used to describe Log Options by ORing above Const's ! 63: GLOBAL gfLogOptions% ! 64: 'Global to be used to save above flag when logging is temporarily turned off. ! 65: GLOBAL gfTmpLogOptions% ! 66: ! 67: gfLogOptions = LOG_SCREEN 'default to showing in viewport ! 68: gfTmpLogOptions = LOG_SCREEN 'default to showing in viewport ! 69: ! 70: GLOBAL gsCurrentDir$ ! 71: gsCurrentDir$ = curdir$ ' get current directory that started execution ! 72: ! 73: ' Global variable to hold log file name ! 74: GLOBAL gsLogFileName$ ! 75: gsLogFileName$ = gsCurrentDir$ + "\FASTTEST.LOG" ! 76: ! 77: ' Global variable to hold string to use as the keystrokes necessary ! 78: ' to close the app in the case of errors ! 79: GLOBAL gsCleanup$ ! 80: gsCleanup$ = "{esc 5}%( )c" ' five escapes, alt-space C (for close) ! 81: ! 82: ' Global variable to hold class name of app ! 83: GLOBAL gsAppClassname$ ! 84: gsAppClassname$ = "" ! 85: ! 86: ' Global variable to hold state of whether to terminate on XLogFailure ! 87: GLOBAL gfTerminate% ! 88: gfTerminate% = TRUE ' default to terminate at first failure ! 89: ! 90: ' Global variable that indicates if failure occured ! 91: GLOBAL gfFailure% ! 92: gfFailure% = FALSE ! 93: ! 94: 'Global variable that indicates an ON ERROR occurred ! 95: GLOBAL gfError% ! 96: gfError% = FALSE ! 97: ! 98: 'Global variable that is the string value for the dialog window class ! 99: GLOBAL gsDialogClass$ ! 100: gsDialogClass$ = "#32770" ! 101: ! 102: ! 103: ! 104: ' Error Type constants (don't use 0) ! 105: CONST ET_NOTHING = 1 ' no handling, log unexpected runtime error ! 106: CONST ET_NEXT = 2 ' flag error, continue next statement ! 107: CONST ET_LOG = 3 ' error happened in log routines, inform user elsewise ! 108: ! 109: 'Global variable that shows what type of error to handle ! 110: GLOBAL gErrorType% ! 111: gErrorType% = ET_NOTHING ! 112: ! 113: ! 114: 'Prototypes from FTestLog.mst ! 115: DECLARE SUB XSetLogFilename(sFilename$) ! 116: DECLARE SUB XSetTerminate(fTerminate%) ! 117: DECLARE SUB XLog (stLog$) ! 118: DECLARE SUB XLogBanner(lpszInput$) ! 119: DECLARE SUB XLogWarning(lpszInput$) ! 120: DECLARE SUB XLogFailure(stFailure$) ! 121: DECLARE SUB XFailureCheck ! 122: DECLARE SUB XSetLogOptions (wLogOptions%) ! 123: DECLARE SUB XLogOff () ! 124: DECLARE SUB XLogOn () ! 125: DECLARE SUB XDialogBoxExists(s$) ! 126: DECLARE SUB XDialogBoxNotExists(s$) ! 127: DECLARE SUB XWaitDialogBox(s$, WaitTime%) ! 128: DECLARE SUB XButtonExists(stButton$) ! 129: DECLARE SUB XButtonNotExists(stButton$) ! 130: DECLARE SUB XButtonEnabled(stButton$) ! 131: DECLARE SUB XButtonNotEnabled(stButton$) ! 132: DECLARE SUB XClickButton(stButtonName$) ! 133: DECLARE SUB XListBoxExists(stListBox$) ! 134: DECLARE SUB XListBoxNotExists(stListBox$) ! 135: DECLARE SUB XFocusListBox(stListBox$) ! 136: DECLARE SUB XListBoxItemExists (stListBox$, stListBoxItem$) ! 137: DECLARE SUB XListBoxItemNotExists (stListBox$, stListBoxItem$) ! 138: DECLARE SUB XClickListBoxItem (stListBox$, stListBoxItem$) ! 139: DECLARE SUB XDblClickListBoxItem (stListBox$, stListBoxItem$) ! 140: DECLARE SUB XComboBoxExists(stComboBox$) ! 141: DECLARE SUB XComboBoxNotExists(stComboBox$) ! 142: DECLARE SUB XFocusComboBox(stComboBox$) ! 143: DECLARE SUB XComboBoxItemExists (stComboBox$, stComboBoxItem$) ! 144: DECLARE SUB XComboBoxItemNotExists (stComboBox$, stComboBoxItem$) ! 145: DECLARE SUB XClickComboBoxItem (stComboBox$, stComboBoxItem$) ! 146: DECLARE SUB XDblClickComboBoxItem (stComboBox$, stComboBoxItem$) ! 147: DECLARE SUB XCheckBoxExists(stCheckBox$) ! 148: DECLARE SUB XCheckBoxNotExists(stCheckBox$) ! 149: DECLARE SUB XCheckBoxChecked(stCheckBox$) ! 150: DECLARE SUB XCheckBoxNotChecked(stCheckBox$) ! 151: DECLARE SUB XCheckBoxEnabled(stCheckBox$) ! 152: DECLARE SUB XCheckBoxNotEnabled(stCheckBox$) ! 153: DECLARE SUB XClickCheckBox(stCheckBox$) ! 154: DECLARE SUB XEditTextExists(stEditText$) ! 155: DECLARE SUB XEditTextNotExists(stEditTextNot$) ! 156: DECLARE SUB XSetEditText (stEditCaption$, stEditText$) ! 157: DECLARE SUB XOptionButtonExists(stOptionButton$) ! 158: DECLARE SUB XOptionButtonNotExists(stOptionButton$) ! 159: DECLARE SUB XOptionButtonEnabled(stOptionButton$) ! 160: DECLARE SUB XOptionButtonNotEnabled(stOptionButton$) ! 161: DECLARE SUB XOptionButtonChecked(stOptionButton$) ! 162: DECLARE SUB XOptionButtonNotChecked(stOptionButton$) ! 163: DECLARE SUB XClickOptionButton(stOptionButton$) ! 164: DECLARE FUNCTION BDialogBoxExists%(s$) ! 165: DECLARE FUNCTION BButtonExists%(stButtonName$) ! 166: DECLARE FUNCTION BButtonEnabled%(stButtonName$) ! 167: DECLARE FUNCTION BListBoxExists%(stListBox$) ! 168: DECLARE FUNCTION IGetListBoxItemCount%(stListBox$) ! 169: DECLARE FUNCTION BListBoxItemExists%(stListBox$, stListBoxItem$) ! 170: DECLARE FUNCTION SGetListBoxItemText$(stListBox$) ! 171: DECLARE FUNCTION BComboBoxExists%(stComboBox$) ! 172: DECLARE FUNCTION IGetComboBoxItemCount%(stComboBox$) ! 173: DECLARE FUNCTION BComboBoxItemExists%(stComboBox$, stComboBoxItem$) ! 174: DECLARE FUNCTION SGetComboBoxItemText$(stComboBox$) ! 175: DECLARE FUNCTION BCheckBoxExists%(stCheckBox$) ! 176: DECLARE FUNCTION BCheckBoxChecked%(stCheckBox$) ! 177: DECLARE FUNCTION BCheckBoxEnabled%(stCheckBox$) ! 178: DECLARE FUNCTION BEditTextExists%(stEditText$) ! 179: DECLARE FUNCTION SGetEditText$(stEditCaption$) ! 180: DECLARE FUNCTION BOptionButtonExists%(stOptionButton$) ! 181: DECLARE FUNCTION BOptionButtonEnabled%(stOptionButton$) ! 182: DECLARE FUNCTION BOptionButtonChecked%(stOptionButton$) ! 183: ! 184: 'Prototypes from FTestKey.mst ! 185: DECLARE SUB XKey (s$) ! 186: DECLARE SUB XAlt (s$) ! 187: DECLARE SUB XCtrl (s$) ! 188: DECLARE SUB XShift (s$) ! 189: DECLARE SUB XCtrlAlt (s$) ! 190: DECLARE SUB XAltShift (s$) ! 191: DECLARE SUB XCtrlShift (s$) ! 192: DECLARE SUB XCtrlAltShift (s$) ! 193: DECLARE SUB XText(s$) ! 194: DECLARE SUB XEnter(s$) ! 195: DECLARE SUB XSelectMenuItem(stMenu$,stMenuItem$,stHMenuItem$) ! 196: DECLARE SUB XMenuItemExists(stMenu$,stMenuItem$, stHMenuItem$) ! 197: DECLARE SUB XMenuItemNotExists(stMenu$,stMenuItem$, stHMenuItem$) ! 198: DECLARE SUB XMenuItemGrayed(stMenu$,stMenuItem$, stHMenuItem$) ! 199: DECLARE SUB XMenuItemNotGrayed(stMenu$,stMenuItem$, stHMenuItem$) ! 200: DECLARE SUB XMenuItemChecked(stMenu$,stMenuItem$, stHMenuItem$) ! 201: DECLARE SUB XMenuItemNotChecked(stMenu$,stMenuItem$, stHMenuItem$) ! 202: DECLARE SUB XMenuItemEnabled(stMenu$,stMenuItem$, stHMenuItem$) ! 203: DECLARE SUB XMenuItemNotEnabled(stMenu$,stMenuItem$, stHMenuItem$) ! 204: DECLARE SUB XCaptionExists(stCaption$) ! 205: DECLARE SUB XCaptionNotExists(stCaption$) ! 206: DECLARE SUB XZoomWindow ! 207: DECLARE SUB XMaxWindow ! 208: DECLARE SUB XWindowMaximized ! 209: DECLARE SUB XWindowNotMaximized ! 210: DECLARE SUB XMinWindow ! 211: DECLARE SUB XWindowMinimized ! 212: DECLARE SUB XWindowNotMinimized ! 213: DECLARE SUB XRestoreWindow ! 214: DECLARE SUB XSizeActiveWindow (iXPixels%, iYPixels%, fAbsOrRel%) ! 215: DECLARE SUB XMoveActiveWindow (iXPixels%, iYPixels%, fAbsOrRel%) ! 216: DECLARE FUNCTION SKeyString$(s$) ! 217: DECLARE FUNCTION SHideKeys$(s$) ! 218: DECLARE FUNCTION BMenuItemExists%(stMenu$,stMenuItem$,stHMenuItem$) ! 219: DECLARE FUNCTION IGetMenuCount%(stMenu$, stMenuItem$) ! 220: DECLARE FUNCTION SGetMenuItemText$(stMenu$,stMenuItem$, iIndex%) ! 221: DECLARE FUNCTION BMenuItemGrayed%(stMenu$, stMenuItem$, stHMenuItem$) ! 222: DECLARE FUNCTION BMenuItemChecked%(stMenu$, stMenuItem$, stHMenuItem$) ! 223: DECLARE FUNCTION BMenuItemEnabled%(stMenu$,stMenuItem$, stHMenuItem$) ! 224: DECLARE FUNCTION SGetCaption$() ! 225: DECLARE FUNCTION BWindowMaximized% ! 226: DECLARE FUNCTION BWindowMinimized% ! 227: ! 228: 'Prototypes from FTestUtl.mst ! 229: DECLARE SUB XFileExists(stFileSpec$) ! 230: DECLARE SUB XFileNotExists(stFileSpec$) ! 231: DECLARE SUB XFileCmp(stFileSpec1$,stFileSpec2$) ! 232: DECLARE SUB XFileNotCmp(stFileSpec1$,stFileSpec2$) ! 233: DECLARE SUB XDeleteFile(stFileSpec$) ! 234: DECLARE SUB XDeleteFileIfExists(stFileSpec$) ! 235: DECLARE SUB XCreateFile(stFileSpec$,s$) ! 236: DECLARE SUB XAppendFile(stFileSpec$,s$) ! 237: DECLARE SUB XWaitMessageFile(s$,Message$, WaitTime%) ! 238: DECLARE SUB XCWDCmp(s$) ! 239: DECLARE SUB XCWDNotCmp(s$) ! 240: DECLARE SUB XDriveCmp(s$) ! 241: DECLARE SUB XDriveNotCmp(s$) ! 242: DECLARE SUB XChangeCWD(s$) ! 243: DECLARE SUB XCreateDir(s$) ! 244: DECLARE SUB XChangeDrive(s$) ! 245: DECLARE SUB XStartApp(stAppName$, stClassname$) ! 246: DECLARE SUB XSetCleanup (sCleanup$) ! 247: DECLARE SUB XDoCleanup ! 248: DECLARE SUB XMoveMouse (x%, y%) ! 249: DECLARE SUB XClickMouse(button%, x%, y%) ! 250: DECLARE SUB XDblClickMouse(button%, x%, y%) ! 251: DECLARE SUB XDragMouse (button%, Begx%, Begy%, Endx%, Endy%) ! 252: DECLARE SUB XClipBoardCmp (s$) ! 253: DECLARE SUB XClipBoardNotCmp (s$) ! 254: DECLARE FUNCTION BFileExists%(stFileSpec$) ! 255: DECLARE FUNCTION BFileCmp%(stFileSpec1$,stFileSpec2$) ! 256: DECLARE FUNCTION BCWDCmp%(s$) ! 257: DECLARE FUNCTION BDriveCmp%(s$) ! 258: DECLARE FUNCTION HStartApp%(stAppName$) ! 259: DECLARE FUNCTION BClipBoardCmp (s$) ! 260: ! 261: ! 262: ! 263: ! 264: '$INCLUDE 'FTestLog.mst' ! 265: '$INCLUDE 'FTestKey.mst' ! 266: '$INCLUDE 'FTestUtl.mst' ! 267: ! 268: ! 269: ' These routines have to be after the above includes so that ! 270: ' the functions used are declared ! 271: ! 272: ON END XDoCleanup ! 273: ! 274: ' Set a UAE trap and log failure if one occurs ! 275: ! 276: TRAP UAETrap FROM "TESTDRVR.EXE" ! 277: XSetTerminate TRUE ! 278: XLogFailure "Application UAEed" ! 279: END TRAP ! 280: ! 281: ' in the FastTest code, gErrorType will be set to one of the following ! 282: ' CASE items to be handled and set back to ET_NOTHING when the particular ! 283: ' place where an error could occur is past. ! 284: ON ERROR GOTO XErrorHandler ! 285: ! 286: GOTO UsersCode ' branch around code used by On Error ! 287: ! 288: XErrorHandler: ' execute here on error conditions ! 289: ! 290: SELECT CASE gErrorType ! 291: CASE 0 ! 292: XSetTerminate TRUE ! 293: XLogFailure "Internal FastTest Error" ' catch undeclared ET vars ! 294: CASE ET_NOTHING ! 295: XSetTerminate TRUE ! 296: XLogFailure "Unexpected RunTime error;" + ERF + ":" + STR$(ERR) + " " + ERROR$(ERR) ! 297: CASE ET_NEXT ! 298: ' Code that uses this will check the global error variable ! 299: ' and log an appropriate error if one occurred ! 300: gfError = TRUE ! 301: RESUME NEXT ! 302: CASE ET_LOG ' something happened during logging, let user know ! 303: Print "****** A Log error occurred ******" ! 304: Pause "****** A Log error occurred ******" ! 305: ! 306: ! 307: END ! 308: ! 309: END SELECT ! 310: XSetTerminate TRUE ! 311: XLogFailure "Internal FastTest error" ! 312: ! 313: ! 314: UsersCode:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.