Annotation of mstools/mstest/sample/imageinc.mst, revision 1.1.1.1

1.1       root        1: '******************************* IMAGEINC.MST  *********************************
                      2: 'Required Files: IMAGEDIT.INC
                      3: '
                      4: 'Uses:
                      5: ''******************************************************************************
                      6: 
                      7: 
                      8: 
                      9: 'Return when the window is gone
                     10: STATIC SUB WaitWhileWnd (Title$)
                     11:     WHILE WFndWndWait( Title$, FW_PART, 1 )
                     12:     WEND
                     13: END SUB
                     14: 
                     15: 'Wait until the window is opened or 10 sec elapsed.
                     16: STATIC SUB WaitForWnd (Title$)
                     17:     IF WFndWndWait( Title$, FW_PART, 10 ) = 0 THEN
                     18:         PAUSE "Window " + Title$ + " could not be found!"
                     19:         END
                     20:     END IF
                     21: END SUB
                     22: 
                     23: 
                     24: '******************************************************************************
                     25: 'SUB Bitmap32x32x16init
                     26: '******************************************************************************
                     27: SUB Bitmap32x32x16init STATIC
                     28:     WSetWndSiz WinHandle, 635 ,365
                     29:     PaletteShow( "ON" )   'Turn on the Color Palette
                     30:     PlacePalette 105, 370
                     31:     QueMouseClick VK_LBUTTON, 195, 10
                     32:     QueFlush  1
                     33: 
                     34:     DoKeys "%Fn"                'Open new file
                     35:     WaitForWnd "Resource Type"
                     36: ' Get the wnd handle without changing its activation state     
                     37:     hWndResType% = WFndWnd( "Resource Type", FW_PART )
                     38:     if hWndResType% <> WGetActWnd( 0 ) then
                     39:         pause "ERROR hWndResType not active!!!"
                     40:         end
                     41:     end if
                     42:     if not WOptionExists ("&Bitmap") then
                     43:         pause "ERROR (bitmap)!!!"
                     44:         end
                     45:     end if
                     46:     WOptionClick("&Bitmap")     'select Bitmap
                     47:     if not WButtonExists ("OK") then
                     48:         pause "ERROR!!!"
                     49:         end
                     50:     end if
                     51:     WbuttonClick "OK"
                     52:     DoKeys "%w32"               'select a 32x32 bit 32 color map
                     53:     DoKeys "%h32"
                     54:     DoKeys "%c"
                     55:     WOptionClick( "16 Color" )
                     56:     WbuttonClick "OK"
                     57:     PlaceViewWindow("32x32")
                     58:     SetBrushSize( "2x2" )
                     59: END SUB
                     60: '******************************************************************************
                     61: ' SUB  PlaceToolBox Places the tool bar at the coordintes passed to the
                     62: ' in tx and ty
                     63: '******************************************************************************
                     64: SUB PlaceToolBox(tx%,ty%) STATIC
                     65:    ToolHandle = FindWindow ("Toolbox", "")
                     66:    WSetWndPos ToolHandle, Tx, Ty
                     67: END SUB
                     68: 
                     69: '******************************************************************************
                     70: ' SUB  PlacePalette Places the Palette at the coordintes passed to the
                     71: ' SUB in px and py
                     72: '******************************************************************************
                     73: SUB PlacePalette(px%,py%) STATIC
                     74:    PaletteHandle = FindWindow ("#32770", "")
                     75:    WSetWndPos PaletteHandle, px, py
                     76: END SUB
                     77: 
                     78: '******************************************************************************
                     79: ' SUB  PlaceViewWndow places the view window in a standard place
                     80: ' for various sizes.
                     81: '******************************************************************************
                     82: SUB PlaceViewWindow(BoxSize$) STATIC
                     83:     SELECT CASE BoxSize
                     84:         CASE "16x16"
                     85:             ViewBox_x = 575
                     86:             ViewBox_y = 275
                     87: 
                     88:             ViewHandle = FindWindow ("View", "")
                     89:             IF ViewHandle = 0 THEN
                     90:                PRINT "ViewHandle was NULL"
                     91:             END IF
                     92:             WSetWndPos ViewHandle, ViewBox_x, ViewBox_y
                     93: 
                     94:         CASE "32x32"
                     95:             ViewBox_x = 585
                     96:             ViewBox_y = 275
                     97:             ViewHandle = FindWindow ("View", "")
                     98:            IF ViewHandle = 0 THEN
                     99:                 PRINT "ViewHandle was NULL"
                    100:             END IF
                    101:             WSetWndPos ViewHandle, ViewBox_x, ViewBox_y
                    102:         CASE "54x54"
                    103:             ViewBox_x = 550
                    104:             ViewBox_y = 275
                    105:             ViewHandle = FindWindow ("View", "")
                    106:             IF ViewHandle = 0 THEN
                    107:                 PRINT "ViewHandle was NULL"
                    108:             END IF
                    109:            WSetWndPos ViewHandle, ViewBox_x, ViewBox_y
                    110:         CASE ELSE
                    111:             PRINT "Error in PlaceViewWindow UNEXPECTED SIZE: ", BoxSize
                    112:             END
                    113: 
                    114:     END SELECT
                    115: 
                    116: END SUB
                    117: 
                    118: '******************************************************************************
                    119: ' SUB GridShow Turns the Grid on or off.
                    120: '******************************************************************************
                    121: SUB GridShow(State$) STATIC
                    122:     SELECT CASE State
                    123:         CASE "ON"
                    124:              WMenu "&Options"
                    125:              If WMenuChecked( "&Grid" ) = FALSE THEN
                    126:                DoKeys "G"
                    127:              End If
                    128:             WMenuEnd
                    129:         CASE "OFF"
                    130:              WMenu "&Options"
                    131:              If WMenuChecked( "&Grid" ) THEN
                    132:                  DoKeys "G"
                    133:              End If
                    134:             WMenuEnd
                    135:         CASE ELSE
                    136:             PRINT "Error in GridShow UNEXPECTED STATE: ", State
                    137:             END
                    138: 
                    139:     END SELECT
                    140: 
                    141: END SUB
                    142: 
                    143: '******************************************************************************
                    144: ' SUB ToolBoxShow Turns the Tool Bar on or off.
                    145: '******************************************************************************
                    146: SUB ToolBoxShow(State$) STATIC
                    147:     SELECT CASE State
                    148:         CASE "ON"
                    149:              WMenu "&Options"
                    150:              If WMenuChecked( "Show &Toolbox" ) = FALSE THEN
                    151:                  DoKeys "T"
                    152:              End If
                    153:             WMenuEnd
                    154:         CASE "OFF"
                    155:              WMenu "&Options"
                    156:              If WMenuChecked( "Show &Toolbox" ) THEN
                    157:                  DoKeys "T"
                    158:              End If
                    159:             WMenuEnd
                    160:         CASE ELSE
                    161:             PRINT "Error in ToolBoxShow UNEXPECTED STATE: ", State
                    162:             END
                    163: 
                    164:     END SELECT
                    165: 
                    166: END SUB
                    167: 
                    168: '******************************************************************************
                    169: ' SUB ViewWindowShow turns the View Window on or off.
                    170: '******************************************************************************
                    171: SUB ViewWindowShow(State$) STATIC
                    172:     SELECT CASE State
                    173:         CASE "ON"
                    174:              WMenu "&Options"
                    175:              If WMenuChecked( "Show &View Window" ) = FALSE THEN
                    176:                  DoKeys "V"
                    177:              End If
                    178:             WMenuEnd
                    179:         CASE "OFF"
                    180:              WMenu "&Options"
                    181:              If WMenuChecked( "Show &View Window" ) THEN
                    182:                  DoKeys "V"
                    183:              End If
                    184:             WMenuEnd
                    185:         CASE ELSE
                    186:             PRINT "Error in ViewWindowShow UNEXPECTED STATE: ", State
                    187:             END
                    188: 
                    189:     END SELECT
                    190: 
                    191: END SUB
                    192: 
                    193: '******************************************************************************
                    194: ' SUB PaletteShow turns the pallete on or off.
                    195: '******************************************************************************
                    196: SUB PaletteShow(State$) STATIC
                    197:     SELECT CASE State
                    198:         CASE "ON"
                    199:             PaletteHandle = FindWindow ("#32770", "")
                    200:             IF PaletteHandle = 0 THEN
                    201:                 PRINT "PaletteHandle is NULL"
                    202:             End If
                    203:             IF NOT WIsVisible( PaletteHandle ) THEN
                    204:                 DoKeys "^{F7}"
                    205:             End If
                    206:             IF NOT WIsVisible( PaletteHandle ) THEN
                    207:                 PRINT "Error: Palette wnd not visible!"
                    208:             END IF
                    209:         CASE "OFF"
                    210:             PaletteHandle = FindWindow ("#32770", "")
                    211:             IF WIsVisible( PaletteHandle ) THEN
                    212:                 DoKeys "^{F7}"
                    213:             End If
                    214:             IF WIsVisible( PaletteHandle ) THEN
                    215:                PRINT "Error: Palette wnd is visible!"
                    216:             END IF
                    217:         CASE ELSE
                    218:             PRINT "Error in PaletteShow UNEXPECTED STATE: ", State
                    219:             END
                    220: 
                    221:     END SELECT
                    222: END SUB
                    223: 
                    224: '$ifdef NASTYBUG
                    225: '******************************************************************************
                    226: ' SUB PaletteShow turns the pallete on or off.
                    227: '******************************************************************************
                    228: SUB PaletteShow(State$) STATIC
                    229:     WSetActWnd WinHandle
                    230:     SELECT CASE State
                    231:         CASE "ON"
                    232:              WMenu "&Options"
                    233:                If WMenuChecked( "Show &Color Palette" ) = FALSE THEN
                    234:                 DoKeys "C"
                    235:              End If
                    236:             WMenuEnd
                    237:              PaletteHandle = FindWindow ("#32770", "")
                    238:             IF NOT WIsVisible( PaletteHandle ) THEN
                    239:                  PRINT "Error: Palette wnd not visible!"
                    240:              END IF
                    241: 
                    242:         CASE "OFF"
                    243:              WMenu "&Options"
                    244:              If WMenuChecked( "Show &Color Palette" ) THEN
                    245:                  DoKeys "C"
                    246:              End If
                    247:             WMenuEnd
                    248:              PaletteHandle = FindWindow ("#32770", "")
                    249:              IF WIsVisible( PaletteHandle ) THEN
                    250:                 PRINT "Error: Palette wnd is visible!"
                    251:              END IF
                    252: 
                    253:         CASE ELSE
                    254:             PRINT "Error in PaletteShow UNEXPECTED STATE: ", State
                    255:             END
                    256: 
                    257:     END SELECT
                    258: END SUB
                    259: '$endif
                    260: 
                    261: '******************************************************************************
                    262: ' SUB SetBrushSize Set the brush size to one of the four possibilities
                    263: ' (2x2, 3x3, 4x4, 5x5)
                    264: '******************************************************************************
                    265: SUB SetBrushSize(Size$) STATIC
                    266:     SELECT CASE Size
                    267:         CASE "2x2"
                    268:              WMenu "&Options"
                    269:              WMenu "&Brush Size"
                    270:              If WMenuChecked( "&2x2" ) = FALSE THEN
                    271:                  DoKeys "2"
                    272:              End If
                    273:             WMenuEnd
                    274:         CASE "3x3"
                    275:              WMenu "&Options"
                    276:              WMenu "&Brush Size"
                    277:              If WMenuChecked( "&3x3" ) = FALSE THEN
                    278:                  DoKeys "3"
                    279:              End If
                    280:             WMenuEnd
                    281:         CASE "4x4"
                    282:              WMenu "&Options"
                    283:              WMenu "&Brush Size"
                    284:              If WMenuChecked( "&4x4" ) = FALSE THEN
                    285:                  DoKeys "4"
                    286:              End If
                    287:             WMenuEnd
                    288:         CASE "5x5"
                    289:              WMenu "&Options"
                    290:              WMenu "&Brush Size"
                    291:              If WMenuChecked( "&5x5" ) = FALSE THEN
                    292:                  DoKeys "5"
                    293:              End If
                    294:             WMenuEnd
                    295:         CASE ELSE
                    296:             PRINT "Error in SetBrushSize UNEXPECTED SIZE: ", Size
                    297:             END
                    298: 
                    299:     END SELECT
                    300: 
                    301: END SUB
                    302: 
                    303: 
                    304: '******************************************************************************
                    305: ' *** Determine the golden file name used. Default is now VRAM1024.scn.
                    306: '******************************************************************************
                    307: '$ifdef MIPS1280
                    308: Const GoldenFile$ = "mips1280.scn"
                    309: '$else
                    310: Const GoldenFile$ = "VRAM1024.scn"
                    311: '$endif
                    312: 
                    313: 
                    314: '******************************************************************************
                    315: ' Sub ProcessResults determines what to do at the end of the test routine
                    316: ' Default is verification.
                    317: '******************************************************************************
                    318: 
                    319: ' For testing now
                    320: '''''$define CREATEGOLDEN
                    321: 
                    322: SUB ProcessResults( FileName$, SubName$, DumpIndex% ) STATIC
                    323: '$ifdef CREATEGOLDEN
                    324:     CreateGolden FileName$, SubName$, DumpIndex%
                    325: '$else
                    326:     Verify FileName$, SubName$, DumpIndex%
                    327: '$endif
                    328: END SUB
                    329: 
                    330: 
                    331: '******************************************************************************
                    332: ' Sub CreateGolden compares window with golden window and Saves it to image.dmp        file can be loaded and saved properly.
                    333: '******************************************************************************
                    334: SUB CreateGolden( FileName$, SubName$, DumpIndex% ) STATIC
                    335: 
                    336:     IF NOT FileName$ = "" THEN
                    337:         IF NOT EXISTS(FileName) THEN
                    338:             DoKeys "%FA"
                    339:             DoKeys FileName
                    340:             WButtonClick "OK"
                    341:         ELSE
                    342:             DoKeys "%FA"
                    343:             DoKeys FileName
                    344:             WButtonClick "OK"
                    345:             DoKeys "y"
                    346:         END IF
                    347: 
                    348:         QueMouseMove 110, 224
                    349:         QueMouseMove 110, 324
                    350:         QueFlush 1
                    351:     END IF
                    352: 
                    353:     ret2% = fDumpWindow( GoldenFile$, WinHandle, 1, DumpIndex, FALSE)
                    354:     IF ret2% > 0 THEN
                    355:         Print #1, "Window dump failed in routine " SubName$ " Error #:" ret2%
                    356:         Print #1,
                    357:         ErrCount = ErrCount + 1
                    358:     ELSE
                    359:         Print #1, SubName,,, " golden generated OK."
                    360:     ENDIF
                    361: END SUB
                    362: 
                    363: 
                    364: '******************************************************************************
                    365: ' Sub VERIFY saves the area and compares the window with golden window in
                    366: ' gimage.scn. If there is a descrepency then the window is then dumped to
                    367: ' image.scn
                    368: '******************************************************************************
                    369: SUB Verify(FileName$, SubName$, DumpIndex%) STATIC
                    370: 
                    371:     IF NOT FileName$ = "" THEN
                    372:         IF NOT EXISTS(FileName) THEN
                    373:             DoKeys "%FA"
                    374:             DoKeys FileName
                    375:             WButtonClick "OK"
                    376:         ELSE
                    377:             DoKeys "%FA"
                    378:             DoKeys FileName
                    379:             WButtonClick "OK"
                    380:             DoKeys "y"
                    381:         END IF
                    382: 
                    383:         QueMouseMove 110, 224
                    384:         QueMouseMove 110, 324
                    385:         QueFlush 1
                    386:     END IF
                    387: 
                    388:     ret% = fCompWindow( GoldenFile$, WinHandle, DumpIndex, FALSE, FALSE)
                    389:     IF ret% > 0 THEN
                    390:         Print #1, "Construction failed for " SubName " Error #:" ret%
                    391:         Print #1, "Dumping Window at index:" DumpIndex%
                    392:         Print #1,
                    393:         ErrCount = ErrCount + 1
                    394:         ret2% = fDumpWindow("imagdump.scn", WinHandle, 1, DumpIndex, FALSE)
                    395:         IF ret2% > 0 THEN
                    396:             Print #1, "Window dump failed for " SubName " Error #:" ret2%
                    397:             Print #1,
                    398:             ErrCount = ErrCount + 1
                    399:         ENDIF
                    400:     ELSE
                    401:         Print #1, SubName,,, " PASSED"
                    402:     ENDIF
                    403: END SUB
                    404: 
                    405: 
                    406: 
                    407: '******************************************************************************
                    408: 'SUB ToolTest. Set up and mouse control for bimap tool test.
                    409: '******************************************************************************
                    410: SUB ToolTest(Width$) STATIC
                    411:     Bitmap32x32x16init
                    412:     SetBrushSize( Width$ )
                    413:     QueMouseClick VK_LBUTTON, 591, 111  'Select the pen
                    414:     QueMouseClick VK_LBUTTON, 333, 442  'Select Dithered Blue
                    415:     QueMouseClick VK_RBUTTON, 282, 426  'Select Yellow
                    416:     QueMouseDn VK_LBUTTON, 10, 74       'Draw diagonal line
                    417:     QueMouseUp VK_LBUTTON, 258, 322
                    418:     QueMouseClick VK_LBUTTON, 592, 165  'Select the outline box.
                    419:     QueMouseDn VK_RBUTTON, 258, 74      'Draw square
                    420:     QueMouseUp VK_RBUTTON, 146, 186
                    421:     QueMouseClick VK_LBUTTON, 257, 426  'Select Red
                    422:     QueMouseClick VK_RBUTTON, 291, 426  'Select Green
                    423:     QueMouseClick VK_LBUTTON, 592, 191  'Select the outline circle.
                    424:     QueMouseDn VK_RBUTTON, 114, 210     'Draw circle
                    425:     QueMouseUp VK_RBUTTON, 10, 322
                    426:     QueMouseClick VK_LBUTTON, 618, 111  'Select the Brush
                    427:     QueMouseClick VK_LBUTTON, 202, 266  'Draw dots
                    428:     QueMouseClick VK_LBUTTON, 134, 198
                    429:     QueMouseClick VK_LBUTTON,  66, 130
                    430:     QueMouseClick VK_LBUTTON, 619, 191  'Select Fill Circle.
                    431:     QueMouseDn VK_LBUTTON, 110, 314     'Clears size: field and sets postion:
                    432:     QueKeys "{ESC}"                     'field to a standerd number
                    433:     QueMouseUp VK_LBUTTON, 110, 324
                    434:     QueMouseClick VK_LBUTTON, 618, 111  'Select The Brush.
                    435:     QueFlush 1
                    436: END SUB
                    437: 
                    438: '******************************************************************************
                    439: 'SUB IToolTest. Set up and mouse control for icon tool test.
                    440: '******************************************************************************
                    441: SUB IToolTest(Width$) STATIC
                    442:     WSetWndSiz WinHandle, 635 ,365
                    443:     PaletteShow( "ON" )                 'Turn on the color palette
                    444:     PlacePalette 105, 370
                    445: '   QueMouseClick VK_LBUTTON, 195, 10
                    446: '   QueFlush  1
                    447:     WSetActWnd( WinHandle )
                    448:     DoKeys "%Fn"                        'Open new file
                    449:     WOptionClick("&Icon")               'Select bitmap
                    450:     WbuttonClick "OK"
                    451:     WListItemClkT "&Target Device:", "CGA 2-Color 32x16"
                    452:     WbuttonClick "OK"
                    453:     PlaceViewWindow("32x32")
                    454:     SetBrushSize( Width$ )
                    455:     QueMouseClick VK_LBUTTON, 360, 426  'Set screen and inverse colors to
                    456:     QueMouseClick VK_LBUTTON, 611, 321  'gray shades
                    457:     QueMouseClick VK_LBUTTON, 591, 111  'select the pen
                    458:     QueMouseClick VK_LBUTTON, 224, 442  'select Black
                    459:     QueMouseDn VK_LBUTTON, 10, 74       'Draw diagonal line
                    460:     QueMouseUp VK_LBUTTON, 542, 334
                    461:     QueMouseClick VK_LBUTTON, 592, 165  'Select the outline box.
                    462:     QueMouseDn VK_LBUTTON, 543, 78      'Draw square
                    463:     QueMouseUp VK_LBUTTON, 406, 215
                    464:     QueMouseClick VK_LBUTTON, 592, 191  'Select the outline Circle.
                    465:     QueMouseDn VK_LBUTTON, 15, 334      'Draw circle
                    466:     QueMouseUp VK_LBUTTON, 150, 198
                    467:     QueMouseClick VK_LBUTTON, 618, 111  'Select the Brush
                    468:     QueMouseClick VK_LBUTTON, 458, 283  'Draw dots
                    469:     QueMouseClick VK_LBUTTON, 278, 206
                    470:     QueMouseClick VK_LBUTTON,  99, 130
                    471:     QueMouseClick VK_LBUTTON, 619, 191  'Select Fill Circle.
                    472:     QueMouseDn VK_LBUTTON, 110, 314
                    473:     QueKeys "{ESC}"
                    474:     QueMouseUp VK_LBUTTON, 110, 324
                    475:     QueMouseClick VK_LBUTTON, 618, 111  'Select The Brush.
                    476:     QueFlush 1
                    477: END SUB
                    478: 
                    479: 
                    480: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.