Knowledge Base Article

Home Page > Knowledge Base > Rapise

Home Page > Knowledge Base > Rapise > Rapise Desktop

Article Testing Win32 applications to verify that controls change display state

by Adam S on Friday, November 1, 2013

Sometimes you may have a button (or other control) that  can have a different appearance depending on the different focus statuses.
For example, the default status without focus is a grey image, whereas when the mouse hovering over it becomes blue. Then when the mouse left button is held down on the button (and not released), the image changes to a red image.
Finally, when the button is activated using the tab key to tab into the button and the mouse is somewhere else, it has a fourth color.

This article discusses solutions for how to test these kinds of situation

The recommended approach is to try to find some property of the control (window style etc) as Identified by the MSAA SPY tool, that changes when the state of button is modified (Window Style is candidate #1).

If nothing appropriate is found through SPY, then the next possible option is to use a bitmap comparison (even BWBitmap property may be used for that).  "Verify" button may be used to record corresponding snippet.

Now the tricky part is how to make a "Verify" for situations like 'Mouse over', 'Mouse down' etc. Our recommendation is to write a loop taking object BWBitmap and saving to file with interval 1-2 seconds and saving it to a file s1, s2, ....

If BWBitmap does not show appropriate difference (BW makes an image as 2-bit TIFF appropriate for OCR), then colored .Bitmap property may be used.  With this approach one should have a list of reference bitmaps to use for actual verification (or any other operations).

The attached code illustrates this approach.

Article Info
Last Updated: 11/1/2013
Article ID: KB65
# Views: 2703
Powered by KronoDesk v1.1.0.15 | © Copyright Inflectra Corporation 2011-2016 | Licensed to Inflectra Corporation.