Debian Codegraph @

src/tests/test-notifications

raw symbols SCIP
1 #!/usr/bin/python3
2
3 import subprocess
4 import time
5 import os
6
7 print("Assertion: Notifications should not appear while the screensaver is active")
8 print("Test: Activate the screensaver, then send a test notification a couple seconds later.")
9 print("Expected outcome: Notification should *not* appear over the screensaver window.\n")
10
11 print("Starting cinnamon-screensaver if necessary...")
12 ps_output = subprocess.check_output(["ps", "-A"])
13 if "cinnamon-screen" not in ps_output.decode("utf-8"):
14 os.system("cinnamon-screensaver &")
15 time.sleep(2)
16 print("Ok\n")
17
18 print("Locking screen...")
19 os.system("cinnamon-screensaver-command --lock")
20 print("Ok\n")
21
22 print("waiting a few seconds...")
23 time.sleep(5)
24 print("Ok\n")
25
26 print("Sending a notification...")
27 os.system("notify-send 'Test notification' 'You should not see this while the screen is locked'")
28 print("Ok\n")
29
30 print("waiting a few more seconds...")
31 time.sleep(5)
32 os.system("cinnamon-screensaver-command --deactivate")
33 print("Unlocked. Terminating.")
34 quit()
35