Capturing Images When the Aero UI Theme Is Active

Applies to TestComplete 15.46, last modified on January 09, 2023

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 captures (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
  1. Select Tools > Current project properties from the TestComplete main menu.

  2. On the Properties page of the project, click General in the tree on the left.

  3. Select or clear the Disable DWM before capturing image check box and then click File > Save from the TestComplete main menu to save the changes.

Notes
  • Enabling this option only makes sense if you use the Aero theme on Windows 7, Window Vista, Windows Server 2008 or later operating systems. The option has no effect 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.

  • If this option is enabled, the screen may blink when a screenshot is being captured. This does not affect the screenshot quality though.

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