home *** CD-ROM | disk | FTP | other *** search
- '*********************** TESTCTRL.MST ************************************
- 'Demonstrates: The use of procedures found in the TESTCTRL.DLL Library
- ' provided with Microsoft Test for Windows.
- '
- 'Required Files: MSTEST.INC, TESTCTRL.DLL, CARDFILE.EXE
- '
- 'Uses: TESTCTRL
- '
- 'Complexity Level: INTERMEDIATE
- '
- 'Notes:
- '
- '*************************************************************************
-
- '$DEFINE TESTCTRL
- '$INCLUDE 'MSTEST.INC'
-
- DECLARE SUB TestMainMenu
- DECLARE SUB TestAddDialog
- DECLARE SUB TestFileSaveAs
- DECLARE SUB ExitApp
-
- RUN "cardfile.exe", NOWAIT
-
- Viewport Clear '*** Remove all text from the Viewport
-
- ON END ExitApp '*** Call ExitApp to exit the application when we
- '*** reach the END statement
-
-
- '*** The following subroutines are the body of the main program:
-
- TestMainMenu
- TestAddDialog
- TestFileSaveAs
-
- END '*** End of main program
-
-
- SUB TestMainMenu STATIC
- DIM ret%
-
- '*** Record a failure if there are not 6 menu items:
-
- IF WMenuCount <> 6 THEN
- PRINT "Test failure crdfle001 - incorrect number of menu items"
- END IF
-
- '*** Record a failure if the Edit/Text menu item is not checked
-
- WMenu "&Edit"
- IF WMenuChecked("Te&xt") = FALSE THEN
- PRINT "Test failure crdfle002 - menu item not checked"
- END IF
-
- END SUB
-
-
- SUB TestAddDialog STATIC
- DIM ret%
-
- '*** Send the string Alt+c+a to select the Card/Add menu item:
-
- DoKeys("%ca")
-
- IF WEditExists("&Add:") = FALSE THEN
- PRINT "Failure crdfle003 - Card/Add edit box does not exist"
- END
- ENDIF
-
- IF WButtonExists("OK") = FALSE THEN
- PRINT "Failure crdfle004 - Card/Add OK button does not exist"
- END
- ENDIF
-
- IF WButtonEnabled("OK") = FALSE THEN
- PRINT "Failure crdfle005 - Card/Add OK button is not enabled"
- END
- ENDIF
-
- WEditSetText "&Add:", "Mark Jones (201) 555-1212"
-
- WButtonClick "OK"
-
- END SUB
-
-
- SUB TestFileSaveAs STATIC
-
- DIM ret%
-
- DoKeys "%fa" '*** Select the File/Save As menu item
-
- IF WListExists("&Directories:") = FALSE THEN
- PRINT "Failure crdfle006 - File/Save As Directories list doesn't exist"
- END
-
- ENDIF
-
- IF WListItemExists("&Directories:", "[..]") = FALSE THEN
- PRINT "Failure crdfle007 - File/Save As Parent directory list item doesn't exist"
- END
- ENDIF
-
- '*** Double click the first item in the directories list box ([..])
-
- WListItemDblClk "&Directories:", 1
-
- '*** Enter a unique filename, then click the OK button to save the
- '*** file. The unique filename "guarantees" that we won't overwrite
- '*** an existing file.
-
- WEditSetText "File&name:", "MJ^~123.CRD"
-
- WButtonClick "OK"
-
- END SUB
-
-
- SUB ExitApp STATIC
-
- DoKeys "{ESC 3}" '*** Close dialogs or menus that might still be active.
- DoKeys "%fx" '*** Send Alt + f + x to exit Cardfile
-
- END SUB
-
-
-