aboutsummaryrefslogtreecommitdiffstats
path: root/test_llamachat.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-21 22:54:17 +0200
committerDanilo M. <danix@danix.xyz>2026-08-21 22:54:17 +0200
commitcc35a23785da52a502993e6afefb5b0ccc369a56 (patch)
treedf3298eb705bffe36dc3bd9ec29967abe8b7d06e /test_llamachat.py
parenta241128e5a70cb75df9b7846f34f725ea84e4eeb (diff)
downloadllamachat-cc35a23785da52a502993e6afefb5b0ccc369a56.tar.gz
llamachat-cc35a23785da52a502993e6afefb5b0ccc369a56.zip
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.
Diffstat (limited to 'test_llamachat.py')
-rwxr-xr-xtest_llamachat.py54
1 files changed, 54 insertions, 0 deletions
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()