Details
-
Task
-
Resolution: Done
-
P2: Important
-
6.x
-
None
Description
Goal
We'd like to Improve auto-test coverage of Qts high-DPI support, including CI regression testing. This requires running auto-tests in environments that does not have physical screens, by simulating (multiple) virtual screens:
Changes
- Add support for multiple virtual screens to the offscreen platform plugin, with settable properties such as geometry and DPI: https://codereview.qt-project.org/c/qt/qtbase/+/290632
- Write auto-tests for relevant API in QWindow, testing the QHighDPIScaling implementation and its usage by the QWindow implementation: https://codereview.qt-project.org/c/qt/qtbase/+/290633/1
Mock testing with the offscreen platform plugin overview
(as implemented in the changes above)
The offscreen platform plugin now supports taking a config file which specifies the virtual screen configuration: (example)
{ “screens”: [ { "name", "screen-1", "x", 0, "y", 0, "width", 640, "height", 480, "dpi", 96, "dpr", 1, }, … ] }
The config file path is specified using platform plugin arguments:
-platform offscfreen:configfile=/path/to/file
This enables two use cases:
- Running existing tests on any mock configuration. E.g, can tst_QWindow handle two screens with different DPI.
- Writing new tests witch instantiates different mock configurations, and then verifies that a specific Qt API/feature works as expected. (In practice, this is done by re-creating the QApplication a new config file.)
Future Work
- How can this be configured from e.g. a CI system script? Support specifying the config file by environment variable as well?
- Support events: "screen disconnected", "DPI changed".
- sepcify events/timing using JSON config file.
- Add QTestLib API for e.g. setting screen configuration.
- Can this be used by applications?
Limitations:
- Platform plugin code is not tested - we should implement as much in QtGui as possible
- We risk tailoring our tests to our the offscreen platform plugin implementation. Remember to test on actual platforms as well.