~ubuntu-branches/ubuntu/hardy/uim/hardy

« back to all changes in this revision

Viewing changes to test/test-im.scm

  • Committer: Bazaar Package Importer
  • Author(s): Masahito Omote
  • Date: 2007-04-21 03:46:09 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070421034609-gpcurkutp8vaysqj
Tags: 1:1.4.1-3
* Switch to dh_gtkmodules for the gtk 2.10 transition (Closes:
  #419318)
  - debian/control: Add ${misc:Depends} and remove libgtk2.0-bin on
    uim-gtk2.0.
  - debian/uim-gtk2.0.post{inst,rm}: Removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env gosh
2
2
 
3
 
;;; Copyright (c) 2003-2006 uim Project http://uim.freedesktop.org/
 
3
;;; Copyright (c) 2003-2007 uim Project http://uim.freedesktop.org/
4
4
;;;
5
5
;;; All rights reserved.
6
6
;;;
29
29
;;; SUCH DAMAGE.
30
30
;;;;
31
31
 
32
 
;; This file is tested with revision 2005 of new repository
 
32
;; These tests are passed at revision 4331 (new repository)
33
33
 
34
34
(use test.unit)
35
35
 
78
78
                                           direct-reset-handler
79
79
                                           direct-get-candidate-handler
80
80
                                           direct-set-candidate-index-handler
81
 
                                           context-prop-activate-handler))
 
81
                                           context-prop-activate-handler
 
82
                                           #f
 
83
                                           #f
 
84
                                           #f
 
85
                                           #f
 
86
                                           #f))
82
87
             (set! test-im-alt-init-args (list 'test-im
83
88
                                               "en"
84
89
                                               "en_US.UTF-8"
93
98
                                               'alt-reset-handler
94
99
                                               'alt-get-candidate-handler
95
100
                                               'alt-set-candidate-index-handler
96
 
                                               'alt-prop-activate-handler))
 
101
                                               'alt-prop-activate-handler
 
102
                                               #f
 
103
                                               #f
 
104
                                               #f
 
105
                                               #f
 
106
                                               #f))
97
107
             #t))))
98
108
 
99
109
  ("test normalize-im-list"
131
141
   (assert-equal (+ (uim 'prev-nr-ims) 1)
132
142
                 (uim '(length im-list)))
133
143
   (assert-equal 'test-im
134
 
                 (uim '(im-name (retrieve-im 'test-im #f))))
135
 
   (assert-false (uim-bool '(im-module-name (retrieve-im 'test-im #f))))
136
 
   (assert-equal 16
137
 
                 (uim '(length (retrieve-im 'test-im #f))))
138
 
   (uim '(im-set-module-name! (retrieve-im 'test-im #f) "foo"))
 
144
                 (uim '(im-name (retrieve-im 'test-im))))
 
145
   (assert-false (uim-bool '(im-module-name (retrieve-im 'test-im))))
 
146
   (assert-equal 21
 
147
                 (uim '(length (retrieve-im 'test-im))))
 
148
   (uim '(im-set-module-name! (retrieve-im 'test-im) "foo"))
139
149
   (assert-equal "foo"
140
 
                 (uim '(im-module-name (retrieve-im 'test-im #f))))
 
150
                 (uim '(im-module-name (retrieve-im 'test-im))))
141
151
 
142
152
   ;; duplicate register overwrites preexisting one
143
153
   (assert-false (uim-bool '(apply register-im test-im-alt-init-args)))
158
168
                   alt-get-candidate-handler
159
169
                   alt-set-candidate-index-handler
160
170
                   alt-prop-activate-handler
161
 
                   ())  ;; replace with #f for R5RS compliant interpreter
162
 
                 (uim '(retrieve-im 'test-im #f)))
 
171
                   ;; replace with #f for R5RS compliant interpreter
 
172
                   ()
 
173
                   ()
 
174
                   ()
 
175
                   ()
 
176
                   ()
 
177
                   ())
 
178
                 (uim '(retrieve-im 'test-im)))
163
179
   ;; subsequent registration that has different im-name will be
164
180
   ;; registered as another IM
165
181
   (assert-true  (uim-bool '(apply register-im
182
198
                   alt-get-candidate-handler
183
199
                   alt-set-candidate-index-handler
184
200
                   alt-prop-activate-handler
185
 
                   ())  ;; replace with #f for R5RS compliant interpreter
186
 
                 (uim '(retrieve-im 'test-im2 #f))))
 
201
                   ;; replace with #f for R5RS compliant interpreter
 
202
                   ()
 
203
                   ()
 
204
                   ()
 
205
                   ()
 
206
                   ()
 
207
                   ())
 
208
                 (uim '(retrieve-im 'test-im2))))
187
209
 
188
210
  ("test register-im (module-name)"
189
211
   (assert-true  (uim-bool '(apply register-im test-im-init-args)))
190
 
   (assert-false (uim-bool '(im-module-name (retrieve-im 'test-im #f))))
 
212
   (assert-false (uim-bool '(im-module-name (retrieve-im 'test-im))))
191
213
 
192
214
   (uim '(set! currently-loading-module-name "foo"))
193
215
   (assert-true  (uim-bool '(apply register-im (cons 'test-im2
194
216
                                                     (cdr test-im-init-args)))))
195
217
   (assert-equal "foo"
196
 
                 (uim '(im-module-name (retrieve-im 'test-im2 #f)))))
 
218
                 (uim '(im-module-name (retrieve-im 'test-im2)))))
197
219
 
198
220
  ("test retrieve-im"
199
221
   (assert-false (uim-bool '(retrieve-im 'nonexistent)))
322
344
   (assert-equal 'anthy
323
345
                 (uim '(im-name (find-im-for-locale "ja.UTF-8"))))
324
346
   ;; Korean
325
 
   (assert-equal 'hangul2
 
347
   (assert-equal 'byeoru
326
348
                 (uim '(im-name (find-im-for-locale "ko"))))
327
 
   (assert-equal 'hangul2
 
349
   (assert-equal 'byeoru
328
350
                 (uim '(im-name (find-im-for-locale "ko_KR"))))
329
 
   (assert-equal 'hangul2
 
351
   (assert-equal 'byeoru
330
352
                 (uim '(im-name (find-im-for-locale "ko_KR.EUC-KR"))))
331
 
   (assert-equal 'hangul2
 
353
   (assert-equal 'byeoru
332
354
                 (uim '(im-name (find-im-for-locale "ko_KR.UTF-8"))))
333
 
   (assert-equal 'hangul2
 
355
   (assert-equal 'byeoru
334
356
                 (uim '(im-name (find-im-for-locale "ko.UTF-8"))))
335
357
   ;; Vietnamese
336
 
   (assert-equal 'viqr
 
358
   (assert-equal 'm17n-vi-viqr
337
359
                 (uim '(im-name (find-im-for-locale "vi"))))
338
 
   (assert-equal 'viqr
 
360
   (assert-equal 'm17n-vi-viqr
339
361
                 (uim '(im-name (find-im-for-locale "vi_VN"))))
340
 
   (assert-equal 'viqr
 
362
   (assert-equal 'm17n-vi-viqr
341
363
                 (uim '(im-name (find-im-for-locale "vi_VN.UTF-8"))))
342
 
   (assert-equal 'viqr
 
364
   (assert-equal 'm17n-vi-viqr
343
365
                 (uim '(im-name (find-im-for-locale "vi.UTF-8"))))
344
366
   ;; native locale
345
367
   (uim '(unsetenv "LC_ALL"))