Testing With Various DPI Settings

Applies to TestComplete 15.63, last modified on April 10, 2024

When a user changes the DPI setting of a display, the operating system increases the size of UI elements. This may cause issues with playing back tests on displays with various DPI settings.

This topic explains the specifics of testing with various DPI setting.

Testing DPI-Aware and Non-DPI-Aware Applications

Non-DPI-aware applications do not detect changes made to the DPI setting and always run as if the setting is 100% (96 DPI). Desktop Windows Manager (DWM) scales such applications to run them with the current DPI setting.

In this case, when you use an object-specific method or property (for example, you perform a click within a window or get an object’s height) TestComplete uses the application's coordinate system. In other words, it uses values as if the application is running with the 100% DPI setting. So, it does not matter with which DPI setting the test runs, TestComplete recalculates the size of UI elements and the coordinates of user actions.

However, when you use methods or properties that relate to screen coordinates (for example, you perform the MouseDown action or get the ScreenLeft property), TestComplete uses the system's DPI setting. If the DPI setting changes, such tests may fail.

In DPI-aware applications, developers specify their behavior for different DPI settings. In this case, TestComplete uses the system's DPI setting and does not recalculate the coordinates of user actions and the size of UI elements. Besides, such applications may use different layouts on different DPI settings, so UI elements may change their location in the window or they can even be hidden.

General Principles

In general, to avoid issues with different DPI settings:

  • If it is possible, perform white-box testing. It allows using object-specific methods and properties that do not relate to the system's DPI setting, object size and coordinates.

  • Otherwise, you can use coordinates and sizes that are appropriate for your current DPI setting instead of hard coded values.

Capturing Images

TestComplete always uses screen coordinates when obtaining an object’s image. Region checkpoints and other operations and scripting methods you use to verify, compare and find images will not work correctly with images taken on different DPI settings. To learn more about it, see Factors Affecting Image Comparison.

Low-Level Testing

To record and play back low level proceduresTestComplete uses screen coordinates. Therefore, procedures recorded with one DPI setting most probably will not work correctly with another.

See Also

Interacting With Non-Compatible Application Objects
About Region Checkpoints

Highlight search results