Capturing Images When the Aero UI Theme Is Active

Applies to TestComplete 14.70, last modified on April 22, 2021

Windows Vista and later operating systems include the Desktop Window Manager (DWM) component that enables the Aero user interface theme.

If the Aero theme is enabled in your system, the screenshots that TestComplete creates (for example, that Test Visualizer or region checkpoints generate) may be unreliable, because they include a redundant frame around the window. This happens because the DWM reports the window size including the semi-transparent shade that is around the window. Therefore, TestComplete includes this extra area in its screenshots.

To avoid possible issues, TestComplete projects include the Disable DWM before capturing image setting. When the setting is enabled, TestComplete turns off the DWM composition before capturing a screenshot. After a screenshot is captured, TestComplete turns on the DWM again.

To view or change the setting:

  • Find your project in the Project Explorer panel (by default, the panel is on the left of the TestComplete window. You can switch to it by selecting View | Project Explorer from the TestComplete main menu).

  • Right-click your project in the Project Explorer and select Edit | Properties from the context menu. This will open the project editor and activate its Properties page.

  • On the Properties page, choose General from the tree on the left. You will see the Disable DWM before capturing image check box on the right. Select or clear the check box and choose File | Save from the TestComplete main menu to save the changes.

Some notes on the Disable DWM before capturing image option:

Notes
  • Using the option only makes sense if you use the Aero theme on Windows 7, Window Vista, Windows Server 2008 or later operating systems. The option is useless if you use other UI themes or other operating systems.

  • Enable this option only if you are going to take screenshots of the whole window. TestComplete always takes screenshots of individual controls or arbitrary screen areas correctly even if the option is disabled.

  • This option does not affect images captured by the Test Visualizer subsystem. Test Visualizer always captures window images as they are.

  • Enabling this option causes the screen to blink while an image is being captured. However, this does not affect the image quality.

Alternative Approaches

  • Enable another UI theme in the operating system (as long as it is acceptable in your testing environment).

  • Capture images retaining the alpha channel. The alpha channel represents transparency information of an image on the per-pixel basis. TestComplete “understands” the per-pixel transparency and performs comparison / search operations taking it into account. Thus, images containing semi-transparent shades and other visual effects of the Aero theme will be handled correctly.

    Screenshots captured in Vista and later Windows operating systems already contain the alpha channel. Therefore, you need to save the captured images in a format that supports the alpha channel - BMP, PNG or TIFF. The image format to be used by TestComplete is set in the Image Settings dialog.

  • Create a comparison mask, where the window’s semi-transparent shade is filled with black, and pass it via the Mask parameter.

  • Fill the opaque areas and the upper-left pixel of the baseline image with a solid color and enable the Transparent parameter.

For examples of comparing images captured in the Aero theme, see the Comparing and finding images on Windows Vista and later operating systems section of the Comparing and Finding Images - Specific Tasks topic.

See Also

Specifics of Using TestComplete on Various Windows Operating Systems
Testing WPF Applications

Highlight search results