Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screenshot tests: spectrum viewer size is non deterministic #2167

Closed
samtygier-stfc opened this issue Apr 16, 2024 · 1 comment · Fixed by #2173
Closed

Screenshot tests: spectrum viewer size is non deterministic #2167

samtygier-stfc opened this issue Apr 16, 2024 · 1 comment · Fixed by #2173

Comments

@samtygier-stfc
Copy link
Collaborator

samtygier-stfc commented Apr 16, 2024

Summary

The size of the spectrum viewer seems to change non deterministically. This is causing failures of the screenshot tests, e.g. test_spectrum_viewer_add_new_roi. It can also be seen when running the application, e.g. with

python -m mantidimaging --path '/data/imaging/IMAT00010675_128/Tomo' -sv

image
or
image

In SpectrumViewerWindowView.__init__() the size always starts as:
self.size()=PyQt5.QtCore.QSize(905, 752)
some times it will stay at this size, or some times it will be resized in show()
self.size()=PyQt5.QtCore.QSize(943, 978)

Steps To Reproduce

python -m mantidimaging --path '/data/imaging/IMAT00010675_128/Tomo' -sv
or run the screenshot tests with
-k test_spectrum_viewer_add_new_roi

Expected Behaviour

Consistent size

Current Behaviour

Varies, but not clear why or when

Context

And as far as I can tell it is always tall at 5b827de (#2151), but non-deterministic at ea787c4

Commenting out QApplication.instance().setStyle(settings.value('theme_selection')) makes it always be tall. But size either side of that gives the short dimensions. So some complex interaction going on.

@MikeSullivan7
Copy link
Collaborator

It seems that putting QApplication.instance().setStyle(settings.value('theme_selection')) before compile_ui(ui_file, self) like:

class BaseMainWindowView(QMainWindow):

    def __init__(self, parent, ui_file=None):
        self._t0 = time.monotonic()
        super().__init__(parent)

        self._has_shown = False

        QApplication.instance().setStyle(settings.value('theme_selection'))

        if ui_file is not None:
            compile_ui(ui_file, self)

reliably creates the spectrum viewer at a size of self.size()=PyQt5.QtCore.QSize(914, 978)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants