-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_notification_simple.py
More file actions
67 lines (52 loc) · 1.8 KB
/
test_notification_simple.py
File metadata and controls
67 lines (52 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python3
"""Simple quick test for notification system."""
import sys
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent / "src"))
from openadapt_tray.notifications import NotificationManager
def main():
"""Run quick tests."""
print("Testing OpenAdapt Notification System")
print("=" * 60)
nm = NotificationManager()
print(f"Backend: {nm._backend}")
print(f"Notifier available: {nm._notifier is not None}")
# Test 1: Basic notification
print("\n1. Sending basic notification...")
result1 = nm.show(
title="OpenAdapt Test",
body="This is a basic test notification from desktop-notifier!"
)
print(f" Result: {result1}")
# Test 2: Critical notification
print("\n2. Sending critical notification...")
result2 = nm.show(
title="OpenAdapt Critical",
body="This is a critical notification!",
urgency="critical"
)
print(f" Result: {result2}")
# Test 3: Notification with callback
print("\n3. Sending notification with callback...")
clicked = [False]
def on_click():
print(" [Callback triggered!]")
clicked[0] = True
result3 = nm.show(
title="OpenAdapt Callback Test",
body="Click this notification if you want to test callbacks",
on_clicked=on_click
)
print(f" Result: {result3}")
# Summary
print("\n" + "=" * 60)
print("Summary:")
print(f" Basic notification: {'PASS' if result1 else 'FAIL'}")
print(f" Critical notification: {'PASS' if result2 else 'FAIL'}")
print(f" Callback notification: {'PASS' if result3 else 'FAIL'}")
# Cleanup
nm.cleanup()
print("\nAll tests completed. Check Notification Center to see notifications!")
if __name__ == "__main__":
main()