コード例 #1
0
def test_setError(qtbot):
    widget = EntryWidget()
    show(locals())
    widget.setError(True)
    assert widget.getError() is True
    assert getCurrentColor(
        widget.lineEdit, 'Window').names[0] == widget.defaultColors['error'][0]
    widget.setError(False)
    assert widget.getError() is False
    assert getCurrentColor(
        widget.lineEdit, 'Window').names[0] == widget.defaultColors['blank'][0]
コード例 #2
0
def test_hasError(qtbot):
    widget = EntryWidget()
    widget.hasError.connect(lambda: set_title_on_error(widget))
    show(locals())

    assert widget.getError() is False
    widget.setError(False)
    assert widget.getError() is False
    widget.setError(True)
    assert widget.windowTitle() == 'ERROR'
    widget.clearError()
    assert widget.getError() is None