home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / d / d009_2 / 1.ddi / SAMPLES / DOCS / TESTCTRL.MS$ / TESTCTRL.bin
Encoding:
Text File  |  1992-02-03  |  2.8 KB  |  128 lines

  1. '*********************** TESTCTRL.MST ************************************
  2. 'Demonstrates:  The use of procedures found in the TESTCTRL.DLL Library
  3. '               provided with Microsoft Test for Windows.
  4. '
  5. 'Required Files: MSTEST.INC, TESTCTRL.DLL, CARDFILE.EXE
  6. '
  7. 'Uses: TESTCTRL
  8. '
  9. 'Complexity Level: INTERMEDIATE
  10. '
  11. 'Notes:
  12. '
  13. '*************************************************************************
  14.  
  15. '$DEFINE TESTCTRL
  16. '$INCLUDE 'MSTEST.INC'
  17.  
  18. DECLARE SUB TestMainMenu
  19. DECLARE SUB TestAddDialog
  20. DECLARE SUB TestFileSaveAs
  21. DECLARE SUB ExitApp
  22.  
  23. RUN "cardfile.exe", NOWAIT
  24.  
  25. Viewport Clear  '*** Remove all text from the Viewport
  26.  
  27. ON END ExitApp  '*** Call ExitApp to exit the application when we
  28.                 '*** reach the END statement
  29.  
  30.  
  31. '*** The following subroutines are the body of the main program:
  32.  
  33. TestMainMenu
  34. TestAddDialog
  35. TestFileSaveAs
  36.  
  37. END '*** End of main program
  38.  
  39.  
  40. SUB TestMainMenu STATIC
  41. DIM ret%
  42.  
  43. '*** Record a failure if there are not 6 menu items:
  44.  
  45. IF WMenuCount <> 6 THEN
  46.     PRINT "Test failure crdfle001 - incorrect number of menu items"
  47. END IF
  48.  
  49. '*** Record a failure if the Edit/Text menu item is not checked
  50.  
  51. WMenu "&Edit"
  52. IF WMenuChecked("Te&xt") = FALSE THEN
  53.     PRINT "Test failure crdfle002 - menu item not checked"
  54. END IF
  55.  
  56. END SUB
  57.  
  58.  
  59. SUB TestAddDialog STATIC
  60. DIM ret%
  61.  
  62. '*** Send the string Alt+c+a to select the Card/Add menu item:
  63.  
  64. DoKeys("%ca")
  65.  
  66. IF WEditExists("&Add:") = FALSE THEN
  67.     PRINT "Failure crdfle003 - Card/Add edit box does not exist"
  68.     END
  69. ENDIF
  70.  
  71. IF WButtonExists("OK") = FALSE THEN
  72.     PRINT "Failure crdfle004 - Card/Add OK button does not exist"
  73.     END
  74. ENDIF
  75.  
  76. IF WButtonEnabled("OK") = FALSE THEN
  77.     PRINT "Failure crdfle005 - Card/Add OK button is not enabled"
  78.     END
  79. ENDIF
  80.  
  81. WEditSetText "&Add:", "Mark Jones (201) 555-1212"
  82.  
  83. WButtonClick "OK"
  84.  
  85. END SUB
  86.  
  87.  
  88. SUB TestFileSaveAs STATIC
  89.  
  90. DIM ret%
  91.  
  92. DoKeys "%fa"   '*** Select the File/Save As menu item
  93.  
  94. IF WListExists("&Directories:") = FALSE THEN
  95.     PRINT "Failure crdfle006 - File/Save As Directories list doesn't exist"
  96.     END
  97.  
  98. ENDIF
  99.  
  100. IF WListItemExists("&Directories:", "[..]") = FALSE THEN
  101.     PRINT "Failure crdfle007 - File/Save As Parent directory list item doesn't exist"
  102.     END
  103. ENDIF
  104.  
  105. '*** Double click the first item in the directories list box ([..])
  106.  
  107. WListItemDblClk "&Directories:", 1
  108.  
  109. '*** Enter a unique filename, then click the OK button to save the
  110. '*** file. The unique filename "guarantees" that we won't overwrite
  111. '*** an existing file.
  112.  
  113. WEditSetText "File&name:", "MJ^~123.CRD"
  114.  
  115. WButtonClick "OK"
  116.  
  117. END SUB
  118.  
  119.  
  120. SUB ExitApp STATIC
  121.  
  122. DoKeys "{ESC 3}"  '*** Close dialogs or menus that might still be active.
  123. DoKeys "%fx"      '*** Send Alt + f + x to exit Cardfile
  124.  
  125. END SUB
  126.  
  127.  
  128.