Exemplo n.º 1
0
def test_updater_hides_and_accepts_if_all_watches_are_finished(application):
    u = updater.UpdaterProgressDialog(None)
    t = NoOpThread()

    u.addWatch(t)
    u.show()
    t.start()

    while not t.isFinished():
        pass

    application.processEvents()
    assert not u.isVisible()
    assert u.result() == QtWidgets.QDialog.Accepted
Exemplo n.º 2
0
def test_updater_does_not_hide_and_accept_before_all_watches_are_finished(application):
    u = updater.UpdaterProgressDialog(None)
    t = TestThreadNoOp()
    t_not_finished = QtCore.QThread()

    u.addWatch(t)
    u.addWatch(t_not_finished)
    u.show()
    t.start()

    while not t.isFinished():
        pass

    application.processEvents()
    assert u.isVisible()
    assert not u.result() == QtGui.QDialog.Accepted
Exemplo n.º 3
0
def test_updater_watch_finished_raises_error_on_watch_without_method_is_finished(
        application):
    u = updater.UpdaterProgressDialog(None)
    u.addWatch(NoIsFinished())
    with pytest.raises(AttributeError):
        u.watchFinished()
Exemplo n.º 4
0
def test_updater_add_watch_raises_error_on_watch_without_signal_finished(
        application):
    with pytest.raises(AttributeError):
        updater.UpdaterProgressDialog(None).addWatch(QtCore.QObject())
Exemplo n.º 5
0
def test_updater_append_log_accepts_qobject_with_signals_finished(application):
    updater.UpdaterProgressDialog(None).addWatch(QtCore.QThread())
Exemplo n.º 6
0
def test_updater_has_method_add_watch(application):
    assert isinstance(
        updater.UpdaterProgressDialog(None).addWatch, collections.Callable)
Exemplo n.º 7
0
def test_updater_append_log_accepts_string(application):
    updater.UpdaterProgressDialog(None).appendLog("Hello Test")
Exemplo n.º 8
0
def test_updater_has_method_append_log(application):
    assert isinstance(
        updater.UpdaterProgressDialog(None).appendLog, collections.Callable)
Exemplo n.º 9
0
def test_updater_has_progress_bar_mod_progress(application):
    assert isinstance(
        updater.UpdaterProgressDialog(None).mapProgress,
        QtWidgets.QProgressBar)
Exemplo n.º 10
0
def test_updater_is_a_dialog(application):
    assert isinstance(updater.UpdaterProgressDialog(None), QtWidgets.QDialog)
Exemplo n.º 11
0
def test_updater_has_method_add_watch(application):
    assert callable(updater.UpdaterProgressDialog(None).addWatch)
Exemplo n.º 12
0
def test_updater_has_method_append_log(application):
    assert callable(updater.UpdaterProgressDialog(None).appendLog)
Exemplo n.º 13
0
def test_updater_has_progress_bar_game_progress(application):
    assert isinstance(updater.UpdaterProgressDialog(None).gameProgress, QtGui.QProgressBar)