From cc35a23785da52a502993e6afefb5b0ccc369a56 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 21 Aug 2026 22:54:17 +0200 Subject: feat: make status messages dismissable Status messages now show a dismiss button; an error persists until dismissed or replaced, and a transient message can be cleared early. --- test_llamachat.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'test_llamachat.py') diff --git a/test_llamachat.py b/test_llamachat.py index 74b0d0c..bb5f097 100755 --- a/test_llamachat.py +++ b/test_llamachat.py @@ -843,6 +843,59 @@ def test_shortcuts(): print("ok shortcuts") +def test_status_dismiss(): + """Status messages show a dismiss button; clicking it hides them.""" + os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") + from PySide6.QtWidgets import QApplication + + from llamachat import backend as _backend + from llamachat import config as _config + from llamachat import models as _models + from llamachat.ui import ChatWindow + + app = QApplication.instance() or QApplication([]) + + with tempfile.TemporaryDirectory() as tmp: + cfg = _config.load(Path(tmp) / "config.toml") + cfg.prompts_dir = Path(tmp) / "prompts" + cfg.db_path = Path(tmp) / "t.db" + history = db.History(cfg.db_path) + window = ChatWindow( + cfg, + history, + _backend.MultiClient(cfg.providers, cfg.request_timeout), + _config.parse_presets(cfg.presets_path), + _models.ModelStore(cfg.models_path), + ) + window.show() + app.processEvents() + + # Errors are dismissable: the ✕ button appears beside the message. + window.show_status("boom", error=True) + app.processEvents() + assert not window.status_row.isHidden() + assert window.status_label.text() == "boom" + assert not window.status_dismiss.isHidden() + + window.status_dismiss.click() + app.processEvents() + assert window.status_row.isHidden() + + # Transient statuses are dismissable too. + window.show_status("searching: otters…") + app.processEvents() + assert not window.status_row.isHidden() + assert not window.status_dismiss.isHidden() + + window.status_dismiss.click() + app.processEvents() + assert window.status_row.isHidden() + + window.close() + history.close() + print("ok status dismiss") + + def test_version_matches_changelog(): """The package version must be the newest release in the changelog.""" import re @@ -3168,6 +3221,7 @@ if __name__ == "__main__": test_unbalanced_backticks() test_sidebar_toggle() test_shortcuts() + test_status_dismiss() test_system_qt_theme_guard() test_version_matches_changelog() test_venv_discovery() -- cgit v1.2.3