root/trunk/projects/bos/test/poi.lisp

Revision 3700, 3.1 kB (checked in by ksprotte, 4 months ago)

checkpoint

Line 
1 (in-package :bos.test)
2 (in-suite :bos.test.poi)
3
4 (test make-poi-medium.without-poi
5   (with-fixture initial-bos-store ()
6     (let ((medium (make-poi-medium 'poi-medium :language "de"
7                                                :title "a title")))
8       (is (string= "a title" (slot-string medium 'title "de"))))
9     (signals (error) (make-poi-medium 'poi-medium :title "a title"))))
10
11 (test make-poi-medium.with-poi
12   (with-fixture initial-bos-store ()
13     (let* ((poi (make-poi "turm"))
14            (medium (make-poi-medium 'poi-medium :language "de"
15                                                 :title "a title"
16                                                 :poi poi)))     
17       (is (eq poi (poi-medium-poi medium)))
18       (is (member medium (poi-media poi))))))
19
20 (test make-poi
21   (with-fixture initial-bos-store ()
22     (let ((poi (make-poi "turm" :area (list 50 60))))
23       (is (string= "turm" (poi-name poi)))
24       (is (= 50 (poi-center-x poi)))
25       (is (= 60 (poi-center-y poi)))
26       (is (string= "" (slot-string poi 'title "de")))
27       (is (string= "" (slot-string poi 'subtitle "de")))
28       (is (string= "" (slot-string poi 'description "de")))
29       (is (null (poi-images poi)))
30       (is (null (poi-airals poi)))
31       (is (null (poi-panoramas poi)))
32       (is (null (poi-movies poi))))
33     (signals (error) (make-poi "brunnen" :title "title"))
34     (let ((poi2 (make-poi "brunnen" :language "de"
35                                     :title "a title"
36                                     :subtitle "a subtitle"
37                                     :description "a description")))
38       (is (string= "brunnen" (poi-name poi2)))     
39       (is (string= "a title" (slot-string poi2 'title "de")))
40       (is (string= "a subtitle" (slot-string poi2 'subtitle "de")))
41       (is (string= "a description" (slot-string poi2 'description "de"))))))
42
43 (defun finishes-make-poi-javascript ()
44   (dolist (language '("de" "en" "da"))
45     (finishes (make-poi-javascript language))))
46
47 (test make-poi-javascript
48   (with-fixture initial-bos-store ()
49     (finishes-make-poi-javascript)
50     (make-poi "turm" :area (list 50 60))
51     (finishes-make-poi-javascript)
52     (make-poi "brunnen" :language "de"
53               :title "a title"
54               :subtitle "a subtitle"
55               :description "a description")
56     (finishes-make-poi-javascript)))
57
58 (test make-poi-image
59   (with-fixture initial-bos-store ()
60    
61     (let ((test-image-path (merge-pathnames "test.png" (bknr.datastore::store-directory *store*)))
62           (poi (make-poi "turm")))     
63       (cl-gd:with-image* (100 120 t)
64         (cl-gd:write-image-to-file test-image-path))
65       (is (null (poi-media poi)))
66       (import-image test-image-path :class-name 'poi-image
67                     :initargs `(:poi ,poi :language "de" :title "a title"))
68       (is (poi-media poi))
69       (is (string= "a title" (slot-string (first (poi-media poi)) 'title "de")))
70       (is (= 100 (store-image-width (first (poi-media poi)))))
71       (is (= 120 (store-image-height (first (poi-media poi)))))
72       (let ((medium (first (poi-media poi))))
73         (is (eq poi (poi-medium-poi medium))))
74       (finishes-make-poi-javascript))))
Note: See TracBrowser for help on using the browser.