test_load_settings_position_invalid failing
I'm seeing this test failure when trying to run tests on both 2.9.4 and latest commit in master:
=================================== FAILURES ===================================
_____________________ test_load_settings_position_invalid ______________________
main_window = <openlp.core.ui.mainwindow.MainWindow object at 0x7f10a46655a0>
settings = <openlp.core.common.settings.Settings object at 0x7f10a4665480>
@pytest.mark.skipif(is_macosx(), reason='Test does not work on macOS')
def test_load_settings_position_invalid(main_window, settings):
"""
Test that the position of the main window is not restored when it's invalid, but rather set to (0, 0)
"""
# GIVEN a newly opened OpenLP instance, mocked screens and settings for a valid window position
# mock out some other calls in load_settings()
main_window.control_splitter = MagicMock()
main_window._live_controller = MagicMock()
main_window._preview_controller = MagicMock()
# set up a window position outside the parameters of the main_window fixture
# this can represent a monitor positioned above the primary display, but which has been unplugged
main_window.move(QtCore.QPoint(-100, -800))
main_window.resize(1000, 500)
# need to call show() to ensure the geometry works as expected (works on Windows, but not linux)
main_window.show()
main_window.hide()
# store the values in the settings
settings.setValue('user interface/main window position', main_window.pos())
settings.setValue('user interface/main window geometry', main_window.saveGeometry())
settings.setValue('user interface/main window state', main_window.saveState())
# change the position and size
main_window.move(QtCore.QPoint(20, 20))
main_window.resize(500, 300)
# WHEN the settings are loaded
main_window.load_settings()
# THEN the main window's position should be (0, 0)
> assert main_window.pos().x() == 0
E assert -202 == 0
E + where -202 = <built-in method x of QPoint object at 0x7f10a46ca0a0>()
E + where <built-in method x of QPoint object at 0x7f10a46ca0a0> = PyQt5.QtCore.QPoint(-202, 18).x
E + where PyQt5.QtCore.QPoint(-202, 18) = <built-in method pos of MainWindow object at 0x7f10a46655a0>()
E + where <built-in method pos of MainWindow object at 0x7f10a46655a0> = <openlp.core.ui.mainwindow.MainWindow object at 0x7f10a46655a0>.pos
tests/openlp_core/ui/test_mainwindow.py:342: AssertionError
----------------------------- Captured Qt messages -----------------------------
QtWarningMsg: This plugin does not support propagateSizeHints()
QtWarningMsg: This plugin does not support propagateSizeHints()
=============================== warnings summary ===============================
tests/openlp_core/api/test_tab.py: 95 warnings
tests/openlp_core/ui/test_icons.py: 1 warning
/usr/lib/python3.10/site-packages/qtawesome/iconic_font.py:325: DeprecationWarning: The FontAwesome 4.7 ('fa' prefix) icon set will be removed in a future release in favor of FontAwesome 6. We recommend you to move to FontAwesome 5 ('fa5*' prefix) to prevent any issues in the future
warnings.warn(
tests/openlp_plugins/alerts/test_plugin.py::test_plugin_state
/builddir/openlp-master/openlp/plugins/alerts/remote.py:58: UserWarning: The name 'v2-alert-plugin' is already registered for this blueprint. Use 'name=' to provide a unique name. This will become an error in Flask 2.1.
app.register_blueprint(v2_views, url_prefix='/api/v2/plugins/alerts')
tests/openlp_plugins/alerts/test_plugin.py::test_plugin_state
/builddir/openlp-master/openlp/plugins/alerts/remote.py:59: UserWarning: The name 'v1-alert-plugin' is already registered for this blueprint. Use 'name=' to provide a unique name. This will become an error in Flask 2.1.
app.register_blueprint(v1_views, url_prefix='/api/alert')
-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED tests/openlp_core/ui/test_mainwindow.py::test_load_settings_position_invalid
=========== 1 failed, 2020 passed, 44 skipped, 98 warnings in 34.05s ===========