diff --git a/tests/test_utils_termtitle.py b/tests/test_utils_termtitle.py new file mode 100644 index 000000000..3fdf4eb69 --- /dev/null +++ b/tests/test_utils_termtitle.py @@ -0,0 +1,27 @@ +import sys +import os +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from slic.utils.termtitle import * +import subprocess +import time + +@pytest.mark.skipif(not os.environ.get("WINDOWID"), reason="X11 actif terminal necessary") +def test_termtitle_changes_actual_title(): + + # Generate title + test_title = f"TEST_{time.time()}" + + # Change terminal titre + termtitle(test_title) + time.sleep(0.5) # + + # Capture actual terminal title with xprop + result = subprocess.run( + ["xprop", "-id", os.environ["WINDOWID"], + capture_output=True, + text=True + ) + captured_title = result.stdout.split("WM_NAME = ")[1].strip('"\n') + + assert test_title in captured_title + \ No newline at end of file