Develop and Download Open Source Software

Browse Subversion Repository

Contents of /branches/4-stable/tests/gui_commands_test.ttl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8437 - (show annotations) (download)
Fri Dec 13 03:11:16 2019 UTC (4 years, 3 months ago) by doda
File size: 6137 byte(s)
Tera Term 4.xx メンテナンス用ブランチを作成

1 ;;;
2 ;;; test gui commands
3 ;;;
4 ;
5 call test_messagebox
6 call test_errordialogbox
7 call test_yesnobox
8 call test_inputbox
9 call test_passwordbox
10 call test_statusbox
11 call test_macrodialogbox
12 type = 1
13 call test_listbox
14 type = 2
15 call test_listbox
16 messagebox "finish all tests" "test"
17 end
18
19 ;;;;;;;;;;;;;;;;
20 ;;; messagebox
21 :test_messagebox
22 s = "messagebox test\nthis is basic test\n3 lines"
23 strspecial s
24 messagebox s "test messagebox"
25 messagebox "finish messagebox test" "test messagebox"
26 return
27
28 ;;;;;;;;;;;;;;;;
29 ;;; error dialog
30 ;;; - Dependence
31 ;;; messagebox
32 :test_errordialogbox
33 messagebox "Please push `continue` button in next window" "test errordialogbox"
34 this_line_is_error_push_continue
35 messagebox "finish error dialog test" "test error dialog"
36 return
37
38 ;;;;;;;;;;;;;;;;
39 ;;; yesnobox
40 ;;; - Dependence
41 ;;; messagebox
42 :test_yesnobox
43 yes = 0
44 no = 0
45 while ((yes == 0) or (no == 0))
46 yesnobox "push yes or no" "test yesnobox"
47 if result == 1 yes = yes + 1
48 if result == 0 no = no + 1
49 sprintf "yes=%d no=%d" yes no
50 messagebox inputstr "test yesnobox"
51 endwhile
52 sprintf "finish yesnobox test\nyes=%d no=%d" yes no
53 s = inputstr
54 strspecial s
55 messagebox s "test yesnobox"
56 return
57
58 ;;;;;;;;;;;;;;;;
59 ;;; inputbox
60 ;;; - Dependence
61 ;;; messagebox
62 :test_inputbox
63 s = "default string"
64 match = 0
65 while match == 0
66 inputbox "input `ok` to finish" "test inputbox" s
67 s = inputstr
68 sprintf "input string is `%s`" s
69 messagebox inputstr "test inputbox"
70 strmatch s "^ok$"
71 match = result
72 endwhile
73 messagebox "finish inputbox test" "test inputbox"
74 return
75
76 ;;;;;;;;;;;;;;;;
77 ;;; passwordbox
78 ;;; - Dependence
79 ;;; messagebox
80 :test_passwordbox
81 match = 0
82 while match == 0
83 passwordbox "input `password` to finish" "test passwordbox"
84 s = inputstr
85 sprintf "input string is `%s`" s
86 messagebox inputstr "test inputbox"
87 strmatch s "^password$"
88 match = result
89 endwhile
90 messagebox "finish passwordbox test" "test passwordbox"
91 return
92
93 ;;;;;;;;;;;;;;;;
94 ;;; statusbox
95 ;;; setdlgpos
96 ;;; closesbox
97 ;;; - Dependence
98 ;;; messagebox
99 :test_statusbox
100 call test_statusbox_centerwindow
101 call test_statusbox_setdlgpos
102 return
103
104 ; 表示されていない→表示する センタリングされる
105 ; 表示されている時 width=変化しない height=変化する(フィット) pos=変化しない
106 :test_statusbox_centerwindow
107 pause_time = 3
108 statusbox "statusbox message" "test statusbox"
109 pause pause_time
110 sprintf2 s "1 line1\n2 line2 \n3 line3\n4 long long long long long line"
111 strspecial s
112 statusbox s "test statusbox"
113 pause pause_time
114 closesbox
115 statusbox s "test statusbox"
116 pause pause_time
117 statusbox "statusbox message" "test statusbox"
118 pause pause_time
119 closesbox
120 statusbox "statusbox message" "test statusbox"
121 pause pause_time
122 closesbox
123 messagebox "finish statusbox centerwindow test" "test statusbox"
124 return
125
126 :test_statusbox_setdlgpos
127 pause_time = 1
128 last_val = 3
129 statusbox "statusbox message" "test statusbox"
130 pause pause_time
131 for i 1 last_val
132 x = i*10
133 y = i*10
134 setdlgpos x y
135 sprintf2 s "setdlgpos\ni=%d/%d\n(%d,%d)" i last_val x y
136 strspecial s
137 statusbox s "test statusbox/setdlgpos"
138 pause pause_time
139 next
140 closesbox
141 s = "Please overwrap other window\nwait 5 sec\nbringupbox test"
142 strspecial s
143 setdlgpos 0 0
144 statusbox s "test statusbox"
145 pause 5
146 bringupbox
147 statusbox "bringupbox" "test statusbox"
148 pause 5
149 closesbox
150 setdlgpos -10000 0 ; go center
151 messagebox "finish statusbox setdlgpos test" "test statusbox"
152 return
153
154 ;;;;;;;;;;;;;;;;
155 ;;; macrodialog box
156 ;;; show
157 ;;; - Dependence
158 ;;; messagebox
159 :test_macrodialogbox
160 call test_macrodialogbox_show
161 call test_macrodialogbox_move_resize
162 messagebox "finish macro dialogbox test" "test macro dialogbox"
163 return
164
165 :test_macrodialogbox_show
166 N = 5
167 intdim show_flag_list N
168 show_flag_list[0] = 1
169 show_flag_list[1] = -1
170 show_flag_list[2] = 1
171 show_flag_list[3] = 0
172 show_flag_list[4] = 1
173 for i 0 N-1
174 show_flag = show_flag_list[i]
175 show show_flag
176 if show_flag < 0 then
177 s = "macro dialog box was hidden\ncheck task bar"
178 elseif show_flag == 0 then
179 s = "macro dialog box was minimize\ncheck task bar"
180 elseif show_flag > 0 then
181 s = "macro dialog box was shown\nmove this messagebox and check macro dialog box"
182 endif
183 sprintf "show %d\n%s" show_flag s
184 s = inputstr
185 strspecial s
186 messagebox s "test macrodialog/show"
187 next
188 return
189
190 :test_macrodialogbox_move_resize
191 w = 15
192 sprintf "move and resize test\nwait %d sec" w
193 s = inputstr
194 strspecial s
195 messagebox s "test macro dialog"
196 pause w
197 messagebox "finish move and resize test" "test macro dialog/move and resize"
198 return
199
200 ;;;;;;;;;;;;;;;;
201 ;;; listbox
202 ;;; - Dependence
203 ;;; messagebox
204 :test_listbox
205 N = 7
206 if type == 1 then
207 intdim done N
208 strdim strs N
209 strdim srcs N
210 endif
211 for i 0 N-1
212 done[i] = 0
213 next
214 srcs[0] = "No man should understand where his dreams come from, Data. (Soong to Data, Birthright pt. 1)"
215 srcs[1] = "The Advocate will refrain from making her opponent disappear. (Data to Ardra, Devil's Due)"
216 srcs[2] = "He's comparing the Enterprise to a cruise ship? (Picard, The Neutral Zone)"
217 srcs[3] = "What's the first rule of acquisition?"
218 srcs[4] = "Once you have their money, you never give it back."
219 srcs[5] = "Don't thank me, I already regret it. (Odo)"
220 srcs[6] = "How long can two people talk about nothing? (Deanna, Starship Mine) "
221 done_all = 0
222 done_cancel = 0
223 prev = 0
224 while ((done_all == 0) or (done_cancel == 0))
225 for i 0 N-1
226 if done[i] == 0 then
227 s = ""
228 else
229 s = "[selected]"
230 endif
231 sprintf2 s "%s %s" s srcs[i]
232 strs[i] = s
233 next
234 if done_all == 0 then
235 msg = "select one from list and `ok`"
236 if done_cancel == 0 then
237 strconcat msg " or `cancel`"
238 endif
239 else
240 msg = "push `cancel`"
241 endif
242 if type == 2 then
243 strconcat msg "==================================================================================================="
244 strconcat msg "\n=\n=\n"
245 strspecial msg
246 endif
247 listbox msg "test listbox" strs prev
248 if result < 0 then
249 done_cancel = 1
250 continue
251 endif
252 prev = result
253 if done[result] == 0 then
254 done[result] = 1
255 else
256 done[result] = 0
257 endif
258 done_all = 1
259 for i 0 N-1
260 if done[i] == 0 then
261 done_all = 0
262 break
263 endif
264 next
265 endwhile
266 messagebox "finish listbox test" "test listbox"
267 return
268
269

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26