1 (defpackage :notify-test
3 (in-package :notify-test
)
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Tests ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9 ;;;;;;;;;;;;;;;;;;;;;;; Test 1: Generate a notification ;;;;;;;;;;;;;;;;;;;;;;;;
11 (dispatch-notification "Summary"
12 :body
"Some rather longer content. Blah Blah Blah."
15 ;;;;;;;;;;;;;;;;;; Test 2: Callbacks (not implemented) ;;;;;;;;;;;;;;;;;;
17 ;; See test-default-action.c and test-multi-actions.c
19 (warn "Test 2: Not implemented.")
21 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Test 3: Images ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23 ;; First create a notification with a stock icon
24 (dispatch-notification "Icon Test"
25 :body
"Testing stock icon"
26 :icon
"appointment-new"
29 ;; Now try an icon by uri. This assumes that the working directory is set to the
30 ;; cl-notify source directory.
32 (dispatch-notification "Own icon test"
33 :body
"Thank you, Conrad Barski!"
34 :icon
(format nil
"file://~A"
35 (namestring (merge-pathnames
36 "lisplogo_warning_128.png"))))
38 (warn "Test 3: We don't know enough to play with pixbufs yet.")
40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Test 4: Markup ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
42 (dispatch-notification "Markup test"
43 :body
"<b>bold</b>, <u>underlined</u>, <i>italic</i>,
44 <a href='http://www.google.com'>linked</a> text"
47 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Test 5: Replace ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
50 ("Replace me!" :timeout
5000)
53 (setf (summary n nil
) "Replaced")
54 (setf (body n
) "Here's some new body text."))
56 ;;;;;;;;;;;;;;;;;;;;;;;; Test 6: Attaching to widgets. ;;;;;;;;;;;;;;;;;;;;;;;;;
58 ;; See test-replace-widget.c
60 (warn "Attachment to widgets not implemented.")
62 ;;;;;;;;;;;;;;;;;;;;;;;;; Test 7: Getting server info ;;;;;;;;;;;;;;;;;;;;;;;;;;
63 (destructuring-bind (name vendor version specversion
)
65 (format t
"Server info~%~%~:{~A:~1,15T~A~%~}"
69 ("Spec. Version" ,specversion
))))
71 ;; See test-server-info.c
72 (warn "get-server-caps not implemented: avoiding GList.")
74 (dispatch-notification "Low"
75 :body
"Put the washing out"
77 (dispatch-notification "Medium"
80 (dispatch-notification "High"
81 :body
"Plug your laptop in!!"
84 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; Test 8: Setting a hint ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
86 (with-notification n
("X, Y Test"
87 :body
"This notification should point to 150, 10")
89 (setf (hint n
"x" :int
) 150)
90 (setf (hint n
"y" :int
) 150)
92 (show-notification n
))