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
def test_update_timer_label_when_timer_changed(subject): Timer.send(State.changed, payload=TimerPayload(time_left=10, duration=0)) markup = subject.timer_markup(format_time_left(10)) root = ET.fromstring(markup) assert subject.widget.get_text() == root.text
def update_timer(self, sender=None, **kwargs): time_left = format_time_left(kwargs.get('time_left', 25 * 60)) markup = '<span font="60">{}</span>'.format(time_left) self.timer_label.set_markup(markup) logger.debug('timer label update %s', time_left)
def _update_text(self, value: int) -> None: formatted_value = format_time_left(value) self.widget.set_markup(self.timer_markup(formatted_value)) logger.debug("component=timerFrame action=updateFrame value=%s", formatted_value)
def test_format_time_left(self): from tomate.utils import format_time_left self.assertEqual('25:00', format_time_left(25 * 60)) self.assertEqual('15:00', format_time_left(15 * 60)) self.assertEqual('05:00', format_time_left(5 * 60))
def test_format_seconds_in_string_with_minutes_and_seconds(seconds, time_formated): assert time_formated == format_time_left(seconds)
def time_left_markup(time_left): markup = '<span font="60">{}</span>'.format( format_time_left(time_left)) return markup