def test_ignition_point_application_02(qgis_app: QgsApplication, qgis_locale: QSettings, qgis_plugin: Dict[str, Any], qgis_bot: QgisBot, qtbot: QtBot, qgis_new_project: None, qgis_canvas: QgsMapCanvas) -> None: """ Tests the Map point tool is destroyed when there is a Right Click :param qgis_app: QGIS application fixture :type qgis_app: QgsApplication :param qgis_locale: QSettings fixture this the current QGIS application locale :type qgis_locale: QSettings :param qgis_plugin: QGIS loading and unloading fixture for plugins :type qgis_plugin: dict of Any :param qgis_bot: QGIS UI Test Bot :type qgis_bot: QgisBot :param qtbot: QT UI Test Bot :type qtbot: QtBot :param qgis_new_project: Ensures a new project is created for the current test :type qgis_new_project: None :return: Nothing :rtype: None """ assert type(qgis.utils.plugins['gisfire_spread_simulation'] ).__name__ == 'GisFIRESpreadSimulation' plugin: GisFIRESpreadSimulation = qgis_plugin['gisfire_spread_simulation'] plugin._menu_actions['new_ignition'].trigger() assert plugin._pointTool is not None qtbot.mouseClick(qgis_canvas.viewport(), qgis.QtCore.Qt.RightButton, pos=QPoint(10, 10)) assert plugin._pointTool is None
def test_view_space_active(qtbot: QtBot): viewspace = ViewSpace() qtbot.addWidget(viewspace) viewspace.show() # Default active assert viewspace.activeView() == viewspace.views[0] # Focus new widget viewspace.splitActiveHorizontal() assert viewspace.activeView() == viewspace.views[1] # Test stack changes active qtbot.mouseClick(viewspace.views[0].stack, QtCore.Qt.LeftButton) assert viewspace.activeView() == viewspace.views[0] # Test focus on tab changes active qtbot.mouseClick(viewspace.views[1].tabs, QtCore.Qt.LeftButton) assert viewspace.activeView() == viewspace.views[1]
def test_ignition_point_dialog_05(qgis_app: QgsApplication, qgis_locale: QSettings, qgis_plugin: Dict[str, Any], qgis_bot: QgisBot, qtbot: QtBot, qgis_new_project: None): """ Tests the labels and data provided is shown (with local TZ) :param qgis_app: QGIS application fixture :type qgis_app: QgsApplication :param qgis_locale: QT settings fixture with a user locale :type qgis_locale: QSettings :param qgis_plugin: QGIS loading and unloading fixture for plugins :type qgis_plugin: dict of Any :param qgis_bot: QGIS Bot to automate GUI tests :type qgis_bot: QgisBot :param qtbot: QT fixture to automate GUI tests :type qtbot: QtBot :param qgis_new_project: Ensures the project instance is clean :type qgis_new_project: None """ assert type(qgis.utils.plugins['gisfire_spread_simulation'] ).__name__ == 'GisFIRESpreadSimulation' dialog: IgnitionDateTimeDialog = IgnitionDateTimeDialog() dialog.show() assert dialog.isVisible() dt: datetime.datetime = datetime.datetime(2022, 1, 1, 0, 0, 0, tzinfo=pytz.timezone('CET')) dt_str: str = dt.strftime("%d/%m/%Y %H:%M:%S") qtbot.keyClicks(dialog._datetime_ignition, dt_str) assert dialog.ignition_datetime == datetime.datetime(2021, 12, 31, 23, 0, 0, tzinfo=pytz.UTC) buttons: QDialogButtonBox = dialog._button_box button_ok: QPushButton = buttons.button(QDialogButtonBox.Ok) qtbot.mouseClick(button_ok, qgis.QtCore.Qt.LeftButton) assert not dialog.isVisible()
def test_ignition_point_application_03(qgis_app: QgsApplication, qgis_locale: QSettings, qgis_plugin: Dict[str, Any], qgis_bot: QgisBot, qtbot: QtBot, qgis_new_project: None, qgis_canvas: QgsMapCanvas) -> None: """ Tests the Ignition Point dialog is shown when there is a Left Click (the appearing dialog is cancelled) :param qgis_app: QGIS application fixture :type qgis_app: QgsApplication :param qgis_locale: QSettings fixture this the current QGIS application locale :type qgis_locale: QSettings :param qgis_plugin: QGIS loading and unloading fixture for plugins :type qgis_plugin: dict of Any :param qgis_bot: QGIS UI Test Bot :type qgis_bot: QgisBot :param qtbot: QT UI Test Bot :type qtbot: QtBot :param qgis_new_project: Ensures a new project is created for the current test :type qgis_new_project: None :return: Nothing :rtype: None """ assert type(qgis.utils.plugins['gisfire_spread_simulation'] ).__name__ == 'GisFIRESpreadSimulation' def on_timer(): dlg: IgnitionDateTimeDialog = plugin._dlg assert dlg.isVisible() qtbot.mouseClick(dlg._button_box.button(QDialogButtonBox.Cancel), qgis.QtCore.Qt.LeftButton) plugin: GisFIRESpreadSimulation = qgis_plugin['gisfire_spread_simulation'] plugin._menu_actions['new_ignition'].trigger() assert plugin._pointTool is not None QTimer.singleShot(100, on_timer) qtbot.mouseClick(qgis_canvas.viewport(), qgis.QtCore.Qt.LeftButton, pos=QPoint(10, 10))
def click_login(dialog: LoginDialog, qtbot: QtBot, mock_critical: Mock): """click login""" btn = dialog.button_box.button(QtWidgets.QDialogButtonBox.Ok) qtbot.mouseClick(btn, QtCore.Qt.LeftButton)