Get the pixel ratio.
()
| 708 | |
| 709 | @pytest.fixture(scope="session") |
| 710 | def pixel_ratio(): |
| 711 | """Get the pixel ratio.""" |
| 712 | # _check_qt_version will init an app for us, so no need for us to do it |
| 713 | if not check_version("pyvista", "0.32") or not _check_qt_version(): |
| 714 | return 1.0 |
| 715 | from qtpy.QtCore import Qt |
| 716 | from qtpy.QtWidgets import QMainWindow |
| 717 | |
| 718 | app = _init_mne_qtapp() |
| 719 | app.processEvents() |
| 720 | window = QMainWindow() |
| 721 | window.setAttribute(Qt.WA_DeleteOnClose, True) |
| 722 | ratio = float(window.devicePixelRatio()) |
| 723 | window.close() |
| 724 | return ratio |
| 725 | |
| 726 | |
| 727 | @pytest.fixture(scope="function", params=[testing._pytest_param()]) |
nothing calls this directly
no test coverage detected