diff --git a/src/pomodouroboros/model/test/test_model.py b/src/pomodouroboros/model/test/test_model.py index d104dee..caebedb 100644 --- a/src/pomodouroboros/model/test/test_model.py +++ b/src/pomodouroboros/model/test/test_model.py @@ -42,6 +42,18 @@ class TestInterval: T = TypeVar("T") +@dataclass +class SessionChange: + session: Session + startTime: float + progress: list[float] = field(default_factory=list) + endTime: float | None = None + + def setEndTime(self, newEndTime: float) -> None: + assert self.endTime is None, f"session already ended at {self.endTime}" + self.endTime = newEndTime + + @dataclass class TestUserInterface: """ @@ -52,6 +64,7 @@ class TestUserInterface: clock: IReactorTime actions: list[TestInterval] = field(default_factory=list) actualInterval: TestInterval | None = None + sessionChanges: list[SessionChange] = field(default_factory=list) def describeCurrentState(self, description: str) -> None: ... @@ -65,10 +78,12 @@ def intervalProgress(self, percentComplete: float) -> None: self.actualInterval.currentProgress.append(percentComplete) def sessionStarted(self, session: Session) -> None: - ... + self.sessionChanges.append( + SessionChange(session, self.clock.seconds()) + ) def sessionEnded(self) -> None: - ... + self.sessionChanges[-1].setEndTime(self.clock.seconds()) def intervalStart(self, interval: AnyIntervalOrIdle) -> None: """