-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest-ui
executable file
·42 lines (34 loc) · 1.14 KB
/
test-ui
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
#!/usr/bin/env guile
!#
(use-modules (ice-9 match) (ice-9 threads))
(define (delayed value) (lambda () (usleep (* 200 1000)) value))
(define battery-one
'((vendor . "ACME")
(model . "B1")
(sys-vendor . "Compaq")
(sys-model . "Portable")
(energy-full-design . 99)
(technology . 2)
(energy-full . 90)
(capacity . 90)))
(define battery-two
'((vendor . "ACME")
(model . "B-02")
(sys-vendor . "Compaq")
(sys-model . "Portable")
(energy-full-design . 65)
(technology . 1)
(energy-full . 64)
(capacity . 99)))
(define test-get-info
(match (command-line)
((or (cmd) (cmd "good-battery"))
(delayed (list battery-one)))
((cmd "no-battery") (delayed '()))
((cmd "error") (lambda () (sleep 1) (error "test error")))
((cmd "loading") (lambda () (sleep 99) '(((vendor . "ACME")))))
((cmd (or "more" "more-batteries")) (delayed (list battery-one battery-two)))
(else (error "Please specify test from: good-battery more-batteries no-battery error loading"))))
(add-to-load-path (dirname (current-filename)))
(use-modules (battery info) (gtk))
(run-battery-info #:get-info test-get-info)