def test_add_button(qtbot): #return # app = QApplication(sys.argv) # これ入れるとセグフォする # setWindowIcon is a method for QApplication, not for QWidget # path = os.path.join(os.path.dirname(sys.modules[__name__].__file__), 'icon_persephone.png') # app.setWindowIcon(QIcon(path)) ui = persephonep.PersephonepMainWindow() qt_api.qWarning('test') qtbot.addWidget(ui) qtbot.mouseClick(ui.table_widget.add_button, PyQt5.QtCore.Qt.LeftButton) assert ui.table_widget.add_button.text() == '+'
def test_qtlog_fixture(qtlog): """ Test qtlog fixture. """ qt_api.qDebug('this is a DEBUG message') qt_api.qWarning('this is a WARNING message') qt_api.qCritical('this is a CRITICAL message') records = [(m.type, m.message.strip()) for m in qtlog.records] assert records == [ (qt_api.QtDebugMsg, 'this is a DEBUG message'), (qt_api.QtWarningMsg, 'this is a WARNING message'), (qt_api.QtCriticalMsg, 'this is a CRITICAL message'), ] # `records` attribute is read-only with pytest.raises(AttributeError): qtlog.records = []
def test_qtlog_fixture(qtlog): """ Test qtlog fixture. """ qt_api.qDebug('this is a DEBUG message') qt_api.qWarning('this is a WARNING message') qt_api.qCritical('this is a CRITICAL message') records = [(m.type, m.message.strip()) for m in qtlog.records] assert records == [ (qt_api.QtDebugMsg, 'this is a DEBUG message'), (qt_api.QtWarningMsg, 'this is a WARNING message'), (qt_api.QtCriticalMsg, 'this is a CRITICAL message'), ] # `records` attribute is read-only with pytest.raises(AttributeError): qtlog.records = []
def test_qtlog_fixture(qtlog): """ Test qtlog fixture. """ # qInfo is not exposed by the bindings yet (#232) qt_api.qDebug("this is a DEBUG message") qt_api.qWarning("this is a WARNING message") qt_api.qCritical("this is a CRITICAL message") records = [(m.type, m.message.strip()) for m in qtlog.records] assert records == [ (qt_api.QtDebugMsg, "this is a DEBUG message"), (qt_api.QtWarningMsg, "this is a WARNING message"), (qt_api.QtCriticalMsg, "this is a CRITICAL message"), ] # `records` attribute is read-only with pytest.raises(AttributeError): qtlog.records = []
def test_qtlog_fixture(qtlog): """ Test qtlog fixture. """ # qInfo is not exposed by the bindings yet (#232) qt_api.qDebug("this is a DEBUG message") qt_api.qWarning("this is a WARNING message") qt_api.qCritical("this is a CRITICAL message") records = [(m.type, m.message.strip()) for m in qtlog.records] assert records == [ (qt_api.QtDebugMsg, "this is a DEBUG message"), (qt_api.QtWarningMsg, "this is a WARNING message"), (qt_api.QtCriticalMsg, "this is a CRITICAL message"), ] # `records` attribute is read-only with pytest.raises(AttributeError): qtlog.records = []