def test_ask_question_close(qtbot): w = custom_dialogs.QuestionWidget(message="Message", button_texts=["YES", "NO"]) d = custom_dialogs.GreyedDialog(w, title="Title", parent=None) w.dialog = d qtbot.addWidget(d) d.show() assert d.isVisible() is True assert w.isVisible() is True assert d.label_title.text() == "Title" assert w.label_message.text() == "Message" qtbot.mouseClick(d.button_close, QtCore.Qt.LeftButton) assert d.result() == QtWidgets.QDialog.Rejected assert w.status is None assert w.isVisible() is False
def test_ask_question_yes(qtbot): w = custom_dialogs.QuestionWidget(message="Message", button_texts=["YES", "NO"]) d = custom_dialogs.GreyedDialog(w, title="Title", parent=None) w.dialog = d qtbot.addWidget(d) d.show() assert d.isVisible() is True assert w.isVisible() is True assert d.label_title.text() == "Title" assert w.label_message.text() == "Message" button_yes = w.layout_buttons.itemAt(2).widget() assert button_yes.text() == "YES" qtbot.mouseClick(button_yes, QtCore.Qt.LeftButton) assert d.result() == QtWidgets.QDialog.Accepted assert w.status == "YES" assert w.isVisible() is False