예제 #1
0
def test_update_timer_label_when_session_changes(subject):
    Session.send(State.changed, payload=TimerPayload(duration=1, time_left=1))

    markup = subject.timer_markup(format_time_left(1))
    root = ET.fromstring(markup)

    assert subject.widget.get_text() == root.text
예제 #2
0
def test_updat_timer_label_when_session_stops(timer_frame):
    Session.send(State.stopped, time_left=10)

    markup = timer_frame.time_left_markup(10)
    root = ET.fromstring(markup)

    assert timer_frame.timer_label.get_text() == root.text
예제 #3
0
def test_updat_timer_label_when_session_attributes_changes(timer_frame):
    Session.send(State.changed, time_left=1)

    markup = timer_frame.time_left_markup(1)
    root = ET.fromstring(markup)

    assert timer_frame.timer_label.get_text() == root.text
예제 #4
0
def test_update_session_label_when_session_reset_with_custom_value(
        timer_frame):
    Session.send(State.finished)

    markup = timer_frame.session_markup(DEFAULT_SESSION_COUNT)
    root = ET.fromstring(markup)

    assert timer_frame.session_label.get_text() == root.text
예제 #5
0
def test_update_session_label_when_session_finishes_with_custom_value(
        timer_frame):
    Session.send(State.finished, sessions=10)

    markup = timer_frame.session_markup(10)
    root = ET.fromstring(markup)

    assert timer_frame.session_label.get_text() == root.text
예제 #6
0
    def test_change_button_when_session_finishes(self, subject):
        payload = SessionPayload(
            type=Sessions.shortbreak,
            sessions=[],
            state=State.finished,
            duration=0,
            task="",
        )

        Session.send(State.finished, payload=payload)

        assert subject.widget.get_selected() is Sessions.shortbreak.value
        subject.session.change.assert_called_once_with(
            session=Sessions.shortbreak)
예제 #7
0
    def test_buttons_should_be_activate_when_session_finishes(self, subject):
        Session.send(State.finished)

        assert subject.widget.get_sensitive() is True
예제 #8
0
    def test_buttons_should_be_deactivate_when_session_starts(self, subject):
        Session.send(State.started)

        assert subject.widget.get_sensitive() is False
예제 #9
0
def test_change_button_when_session_finishes(task_button):
    Session.send(State.finished, task=Task.shortbreak)

    assert task_button.modebutton.get_selected() is Task.shortbreak.value
    task_button.session.change_task.assert_called_once_with(task=Task.shortbreak)
예제 #10
0
def test_buttons_should_be_activate_when_session_stops(task_button):
    Session.send(State.stopped)

    assert task_button.modebutton.get_sensitive() is True
예제 #11
0
def test_buttons_should_be_deactivate_when_session_starts(task_button):
    Session.send(State.started)

    assert task_button.modebutton.get_sensitive() is False
예제 #12
0
def test_on_sesion_reset(toolbar):
    toolbar.reset_button.set_sensitive(True)

    Session.send(State.reset)

    assert toolbar.reset_button.get_sensitive() is False
예제 #13
0
def test_on_sesion_stop_in_the_second_session(toolbar):
    Session.send(State.stopped, sessions=1)

    assert toolbar.start_button.get_visible() is True
    assert toolbar.stop_button.get_visible() is False
    assert toolbar.reset_button.get_sensitive() is True
예제 #14
0
def test_on_sesion_start(toolbar):
    Session.send(State.started)

    assert toolbar.start_button.get_visible() is False
    assert toolbar.stop_button.get_visible() is True
    assert toolbar.reset_button.get_sensitive() is False