mantidproject / mantidimaging

Graphical toolkit for neutron imaging.
https://mantidproject.github.io/mantidimaging
GNU General Public License v3.0
12 stars 6 forks source link

4k screenshot tests #1977

Closed samtygier-stfc closed 8 months ago

samtygier-stfc commented 10 months ago

Desired Behaviour

Our current screen shot tests run in a normal screen resolution, so we may miss bugs related to hidpi scaling. Needs some investigation on how to do this within github actions.

On Linux we run the tests in a virtual X server with xvfb-run. This can be passed a screen size, e.g., xvfb-run --server-args="-screen 0 600x400x24", but this seems to have no influence the size the windows are drawn in the test or on the screenshot.

To see whats happening in the xvfb you can split in to parts. Add a QTest.qWait(5000) into _take_screenshot()

# start an xvfb
Xvfb :7 -screen 0 600x400x24 -fbdir /var/tmp

# run a test 
DISPLAY=:7 APPLITOOLS_API_KEY=local APPLITOOLS_IMAGE_DIR=/tmp/gui_test pytest -p no:xdist -p no:randomly -p no:cov mantidimaging/eyes_tests/main_window_test.py  -o log_cli=true -k test_main_window_loaded_data

# see the contents of the frame buffer
xwud -in /var/tmp/Xvfb_screen0

Might need to try running a window manager inside xvfb

On Windows we set a resolution with Set-DisplayResolution -Width 1920 -Height 1080 -Force Maybe we can do something similar to set dpi scaling.

Or maybe we can set the scaling within QT.

samtygier-stfc commented 8 months ago

We have investigated, but seems difficult to do and not very necessary.

Closing for now.