New Property for Identification of WPF Images

New Property for Identification of WPF Images

New Property

Some WPF Image objects have the property Source in their nativeObject which has ToString() representation that is a path to some local image or image in a resource file. For example, for the static images that is usually something like this:

pack://application:,,,/AddressbookWPF;component/Images/fileopen.png

This is rather good information and it can be used for the identification of Image objects. Because of that the new Squish version 6.4 will have a new property source added to the Image type for WPF applications:

The value of this property is processed a bit so that the scripts which are using it, get more portable. The path is relative to the application and also lower cased so that differences in the folder and drive casing on different machines don’t break the identification.

Usage

When it exists, the new property will be automatically used in the Squish recordings. Of course, you can also use it in your test scripts and have, for example, something like this:

 image = waitForObjectExists("{type='Image' source='images/fileopen.png'}")
 test.compare(image.height, 34);
When the property does not have a good string representation it will not be used during recording and its value will be an empty string. This situation can happen with some images which are dynamically generated (drawn or created) during runtime.

In such cases you can use the recently introduced Image-Search feature which in the new Squish release will get more powerful with Fuzzy Image Lookup.

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*