home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 8 / 08.iso / d / d026 / 1.ddi / DTA.IN_ / DTA.bin
Encoding:
Text File  |  1992-03-22  |  5.6 KB  |  176 lines

  1. '-------------------------------------------------------------------------
  2. '
  3. ' NAME     : DTA.INC
  4. ' DESC     : Contains common routines used by DTA-PEN.WTD, DTA-BRU.WTD, 
  5. '            DTA-PRIM.WTD, DTA-BKMO.WTD.
  6. ' DATE     : 10-03-91
  7. '-------------------------------------------------------------------------
  8.  
  9. '$IFNDEF SMOKE
  10. '$DEFINE PROMPT
  11. '$ENDIF
  12.  
  13. '$include: 'mfdll.inc'
  14. '$include: 'wtdutil.inc'
  15. '$IFDEF CTSHELL
  16.    '$include: 'hct.inc'
  17. '$ENDIF
  18.  
  19. CONST TESTAPP  = "dta"                         ' name of app w/o extension
  20. CONST WINTITLE = "Display Test Application"    ' window title
  21. CONST LOG      = "dta-test.log"                ' name of log file
  22. CONST MAXREP   = 5        ' repeat this many times when script says several
  23. CONST DISP_EXT = ".zzz"                        ' all display tests will 
  24.                                                '  write results to this 
  25.                                                '  extension.
  26.  
  27. GLOBAL  hDTA AS INTEGER                        ' handle to DTA window
  28.  
  29. DECLARE SUB InitApp
  30. DECLARE SUB EndScript
  31. DECLARE SUB EndTest (szTestName AS STRING)
  32. DECLARE SUB SelectOptionMenu (menu$)
  33. DECLARE SUB DrawObject
  34. DECLARE SUB PrintPause (szMsg AS STRING)
  35. DECLARE SUB ResetDTA
  36. DECLARE SUB SelectComboBoxItem (nIndex%)
  37. DECLARE SUB StartScript
  38. DECLARE SUB StartTest (szTestName AS STRING, nSection AS INTEGER, lNum AS LONG)
  39. DECLARE SUB TestHeader (testName$)
  40.  
  41. '--------------------------------------------------------------------------
  42. '--------------------------------------------------------------------------
  43.  
  44. SUB selectOptionMenu (menu$)
  45.    ' win30 doesn't do selectMenuItem() !@&@#!!!
  46.  
  47.    SendKeys "%o" + menu$   ' SelectMenuItem "Options" SelectMenuItem menu$
  48. END SUB
  49.  
  50. '--------------------------------------------------------------------------
  51.  
  52. SUB drawObject
  53.    '$IFDEF PROMPT
  54.       hWnd% = GetActiveWindow ()
  55.       SendKeys  "{F3}"                      ' draw the shape      
  56.       WHILE hwnd% = GetActiveWindow ()          
  57.          ' wait for prompt window to pop up...
  58.       WEND
  59.   
  60.       WHILE hwnd% <> GetActiveWindow ()         
  61.          ' wait for user to answer prompt...
  62.       WEND
  63.    '$ELSE
  64.        SendKeys  "{F3}"                      ' draw the shape              
  65.    '$ENDIF
  66.    
  67. '   Inc nVar                               ' add one to variation counter
  68. END SUB
  69.  
  70. '-------------------------------------------------------------------------
  71.  
  72. SUB EndScript
  73.    Print "In EndScript..."
  74.    '$IFDEF CTSHELL
  75.       lRetCode = SendMessage (hDTA, 10003, 0, 0)            
  76.       HctScriptEnd RS_PASSED      
  77.    '$ENDIF
  78.    PrintPause "End of " + SCRIPT + " Test"   
  79.    SelectWindow WINTITLE     ' make sure we're closing the right app...
  80.    SendKeys "%{F4}"          ' terminate app ("I'LL BE BACK!!")
  81. END SUB
  82.  
  83. '-------------------------------------------------------------------------
  84.  
  85. SUB EndTest (szTestName AS STRING)
  86.  
  87.    PrintPause "End of " + szTestName + " Test"
  88. END SUB
  89.  
  90. '--------------------------------------------------------------------------
  91.  
  92. SUB SelectComboBoxItem (nIndex%)
  93.    ' allocate buffer
  94.    szComboText$ = "                                                    " 
  95.    GetComboBoxItemText nIndex%, szComboText$, 20
  96.    ClickComboBoxItem szComboText$
  97. END SUB
  98.  
  99. '--------------------------------------------------------------------------
  100.  
  101. SUB InitApp
  102.    IF EXISTS (TESTAPP + ".exe") = 0 THEN
  103. '$IFNDEF CTSHELL
  104.       LogPause SCRIPT + ": Unable to initialize [" + TESTAPP + ".exe]"
  105. '$ELSE
  106.       Pause TEST_NAME + ": Unable to initialize [" + TESTAPP + ".exe]"
  107. '$ENDIF
  108.       END                ' terminate test script
  109.    ELSE 
  110.       RUN TESTAPP + " " + TEST_NAME, NOWAIT
  111. '      WAIT 2                          'wait for window to be registered
  112.       SelectWindow   WINTITLE          ' select testapp's window
  113.  
  114.       IF WindowExists ("Logging Options") THEN
  115.          SelectWindow "Logging Options"
  116.          ' This is the debug options - only comes up first time to 
  117.          '   create a DTA section in WIN.INI
  118.          SendKeys "%f"                 ' choose log to file
  119.          ClickButton "OK"              ' close debug options dlg
  120.       ENDIF
  121.  
  122.       hDTA = GetActiveWindow()         ' save the handle to DTA window
  123.       
  124.       selectOptionMenu "n"             ' select points dlg
  125.       SendKeys "%1{tab}50{tab}50"      ' turn off random checkboxes
  126.       SendKeys "%2{tab}200{tab}200"    ' turn off random checkboxes      
  127.       SendKeys "%3%4"                  ' turn these off too
  128.       SendKeys "%k"                    ' ClickButton "O&K"
  129.  
  130.       '$IFDEF PROMPT
  131.          ' turn on smart prompting
  132.          SelectOptionMenu "s"          ' SelectMenuItem "Smart Prompting" 
  133.       '$ENDIF
  134.    END IF
  135. END SUB
  136.  
  137. '-------------------------------------------------------------------------
  138.  
  139. SUB PrintPause (szMsg AS STRING)
  140.    '$IFDEF PROMPT 
  141.       Pause szMsg
  142.    '$ENDIF
  143.    Print szMsg
  144. END SUB
  145.  
  146. '-------------------------------------------------------------------------
  147.  
  148. SUB ResetDTA
  149.    SendKeys "%ot%od"    ' options: repeat last, default settings
  150. END SUB
  151.  
  152. '-------------------------------------------------------------------------
  153.  
  154. SUB StartTest (szTestName AS STRING, nSection AS INTEGER, lNum AS LONG)
  155.    DIM lRetCode AS LONG
  156.  
  157.    lRetCode = SendMessage (hDTA, 10001, nSection, lNum)
  158.    PrintPause "Start Of " + szTestName + " Test"
  159. END SUB
  160.  
  161. '-------------------------------------------------------------------------
  162.  
  163. SUB StartScript
  164.    '$IFDEF CTSHELL
  165.       HctScriptBegin  TESTAPP
  166.    '$ELSE
  167.       ViewPort ON
  168.       ViewPort CLEAR
  169.    '$ENDIF
  170.  
  171.    Print "In StartScript..."
  172.    PrintPause "Start of " + SCRIPT + " Test"
  173. END SUB
  174.  
  175.