| 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 |
call test_listbox |
| 13 |
call test_filenamebox |
| 14 |
call test_dirnamebox |
| 15 |
messagebox "finish all tests" "test" |
| 16 |
end |
| 17 |
|
| 18 |
;;;;;;;;;;;;;;;; |
| 19 |
;;; messagebox |
| 20 |
:test_messagebox |
| 21 |
s = "メッセージボックス\nthis is basic test\n3 행" |
| 22 |
strspecial s |
| 23 |
messagebox s "メッセージボックス" |
| 24 |
messagebox "finish messagebox test" "test messagebox" |
| 25 |
return |
| 26 |
|
| 27 |
;;;;;;;;;;;;;;;; |
| 28 |
;;; error dialog |
| 29 |
;;; - Dependence |
| 30 |
;;; messagebox |
| 31 |
:test_errordialogbox |
| 32 |
messagebox "Please push `continue` button in next window" "test errordialogbox" |
| 33 |
this_line_is_error_push_continue |
| 34 |
messagebox "finish error dialog test" "test error dialog" |
| 35 |
return |
| 36 |
|
| 37 |
;;;;;;;;;;;;;;;; |
| 38 |
;;; yesnobox |
| 39 |
;;; - Dependence |
| 40 |
;;; messagebox |
| 41 |
:test_yesnobox |
| 42 |
yes = 0 |
| 43 |
no = 0 |
| 44 |
while ((yes == 0) or (no == 0)) |
| 45 |
yesnobox "push 是的(yes) or 没有(no)" "test yesnobox" |
| 46 |
if result == 1 yes = yes + 1 |
| 47 |
if result == 0 no = no + 1 |
| 48 |
sprintf "yes=%d no=%d" yes no |
| 49 |
messagebox inputstr "test yesnobox" |
| 50 |
endwhile |
| 51 |
sprintf "finish yesnobox test\nyes=%d no=%d" yes no |
| 52 |
s = inputstr |
| 53 |
strspecial s |
| 54 |
messagebox s "test yesnobox" |
| 55 |
return |
| 56 |
|
| 57 |
;;;;;;;;;;;;;;;; |
| 58 |
;;; inputbox |
| 59 |
;;; - Dependence |
| 60 |
;;; messagebox |
| 61 |
:test_inputbox |
| 62 |
s = "default string" |
| 63 |
match = 0 |
| 64 |
while match == 0 |
| 65 |
inputbox "入力 `ok` to finish" "test inputbox" s |
| 66 |
s = inputstr |
| 67 |
sprintf "入力文字列 は `%s`" s |
| 68 |
messagebox inputstr "test inputbox" |
| 69 |
strmatch s "^ok$" |
| 70 |
match = result |
| 71 |
endwhile |
| 72 |
messagebox "finish inputbox test" "test inputbox" |
| 73 |
return |
| 74 |
|
| 75 |
;;;;;;;;;;;;;;;; |
| 76 |
;;; passwordbox |
| 77 |
;;; - Dependence |
| 78 |
;;; messagebox |
| 79 |
:test_passwordbox |
| 80 |
match = 0 |
| 81 |
while match == 0 |
| 82 |
passwordbox "`password` と入力すると終了" "test passwordbox" |
| 83 |
s = inputstr |
| 84 |
sprintf "入力文字列 は `%s`" s |
| 85 |
messagebox inputstr "test inputbox" |
| 86 |
strmatch s "^password$" |
| 87 |
match = result |
| 88 |
endwhile |
| 89 |
messagebox "finish passwordbox test" "test passwordbox" |
| 90 |
return |
| 91 |
|
| 92 |
;;;;;;;;;;;;;;;; |
| 93 |
;;; statusbox |
| 94 |
;;; setdlgpos |
| 95 |
;;; closesbox |
| 96 |
;;; - Dependence |
| 97 |
;;; messagebox |
| 98 |
:test_statusbox |
| 99 |
call test_statusbox_centerwindow |
| 100 |
;call test_statusbox_setdlgpos |
| 101 |
return |
| 102 |
|
| 103 |
; 表示されていない→表示する 時 センタリングされる |
| 104 |
; 表示されている時 width=変化しない height=変化する(フィット) pos=変化しない |
| 105 |
:test_statusbox_centerwindow |
| 106 |
pause_time = 3 |
| 107 |
statusbox "statusbox message" "test statusbox" |
| 108 |
pause pause_time |
| 109 |
sprintf2 s "1 line1\n2 line2 \n3 line3\n4 long long long long long line" |
| 110 |
strspecial s |
| 111 |
statusbox s "test statusbox" |
| 112 |
pause pause_time |
| 113 |
closesbox |
| 114 |
statusbox s "test statusbox" |
| 115 |
pause pause_time |
| 116 |
statusbox "statusbox message" "test statusbox" |
| 117 |
pause pause_time |
| 118 |
closesbox |
| 119 |
statusbox "statusbox message" "test statusbox" |
| 120 |
pause pause_time |
| 121 |
closesbox |
| 122 |
messagebox "finish statusbox centerwindow test" "test statusbox" |
| 123 |
return |
| 124 |
|
| 125 |
:test_statusbox_setdlgpos |
| 126 |
pause_time = 1 |
| 127 |
last_val = 3 |
| 128 |
statusbox "statusbox message" "test statusbox" |
| 129 |
pause pause_time |
| 130 |
for i 1 last_val |
| 131 |
x = i*10 |
| 132 |
y = i*10 |
| 133 |
setdlgpos x y |
| 134 |
sprintf2 s "setdlgpos\ni=%d/%d\n(%d,%d)" i last_val x y |
| 135 |
strspecial s |
| 136 |
statusbox s "test statusbox/setdlgpos" |
| 137 |
pause pause_time |
| 138 |
next |
| 139 |
closesbox |
| 140 |
s = "Please overwrap other window\nwait 5 sec\nbringupbox test" |
| 141 |
strspecial s |
| 142 |
setdlgpos 0 0 |
| 143 |
statusbox s "test statusbox" |
| 144 |
pause 5 |
| 145 |
bringupbox |
| 146 |
statusbox "bringupbox" "test statusbox" |
| 147 |
pause 5 |
| 148 |
closesbox |
| 149 |
setdlgpos -10000 0 ; go center |
| 150 |
messagebox "finish statusbox setdlgpos test" "test statusbox" |
| 151 |
return |
| 152 |
|
| 153 |
;;;;;;;;;;;;;;;; |
| 154 |
;;; macrodialog box |
| 155 |
;;; show |
| 156 |
;;; - Dependence |
| 157 |
;;; messagebox |
| 158 |
:test_macrodialogbox |
| 159 |
call test_macrodialogbox_show |
| 160 |
call test_macrodialogbox_move_resize |
| 161 |
messagebox "finish macro dialogbox test" "test macro dialogbox" |
| 162 |
return |
| 163 |
|
| 164 |
:test_macrodialogbox_show |
| 165 |
N = 5 |
| 166 |
intdim show_flag_list N |
| 167 |
show_flag_list[0] = 1 |
| 168 |
show_flag_list[1] = -1 |
| 169 |
show_flag_list[2] = 1 |
| 170 |
show_flag_list[3] = 0 |
| 171 |
show_flag_list[4] = 1 |
| 172 |
for i 0 N-1 |
| 173 |
show_flag = show_flag_list[i] |
| 174 |
show show_flag |
| 175 |
if show_flag < 0 then |
| 176 |
s = "macro dialog box was hidden\ncheck task bar" |
| 177 |
elseif show_flag == 0 then |
| 178 |
s = "macro dialog box was minimize\ncheck task bar" |
| 179 |
elseif show_flag > 0 then |
| 180 |
s = "macro dialog box was shown\nmove this messagebox and check macro dialog box" |
| 181 |
endif |
| 182 |
sprintf "show %d\n%s" show_flag s |
| 183 |
s = inputstr |
| 184 |
strspecial s |
| 185 |
messagebox s "test macrodialog/show" |
| 186 |
next |
| 187 |
return |
| 188 |
|
| 189 |
:test_macrodialogbox_move_resize |
| 190 |
w = 15 |
| 191 |
sprintf "move and resize test\nwait %d sec" w |
| 192 |
s = inputstr |
| 193 |
strspecial s |
| 194 |
messagebox s "test macro dialog" |
| 195 |
pause w |
| 196 |
messagebox "finish move and resize test" "test macro dialog/move and resize" |
| 197 |
return |
| 198 |
|
| 199 |
;;;;;;;;;;;;;;;; |
| 200 |
;;; listbox |
| 201 |
;;; - Dependence |
| 202 |
;;; messagebox |
| 203 |
:test_listbox |
| 204 |
N = 7 |
| 205 |
intdim done N |
| 206 |
strdim strs N |
| 207 |
strdim srcs N |
| 208 |
for i 0 N-1 |
| 209 |
done[i] = 0 |
| 210 |
next |
| 211 |
srcs[0] = "本気の失敗には価値がある" |
| 212 |
srcs[1] = "俺の敵は だいたい俺です" |
| 213 |
srcs[2] = "ちょっとだけ無理なことに挑戦してこーぜ" |
| 214 |
srcs[3] = "リーダーというのはやはり安心と興奮を同時にくれる" |
| 215 |
srcs[4] = "”止まる”も”進む”もコントロールするのはお前だ" |
| 216 |
srcs[5] = "どっちが楽しいかで決めなさい。" |
| 217 |
srcs[6] = "悩むなら、なってから悩みなさい" |
| 218 |
done_all = 0 |
| 219 |
done_cancel = 0 |
| 220 |
prev = 0 |
| 221 |
while ((done_all == 0) or (done_cancel == 0)) |
| 222 |
for i 0 N-1 |
| 223 |
if done[i] == 0 then |
| 224 |
s = "" |
| 225 |
else |
| 226 |
s = "[selected]" |
| 227 |
endif |
| 228 |
sprintf2 s "%s %s" s srcs[i] |
| 229 |
strs[i] = s |
| 230 |
next |
| 231 |
if done_all == 0 then |
| 232 |
msg = "select one from list and `ok`" |
| 233 |
if done_cancel == 0 then |
| 234 |
strconcat msg " or `cancel`" |
| 235 |
endif |
| 236 |
else |
| 237 |
msg = "push `cancel`" |
| 238 |
endif |
| 239 |
listbox msg "test listbox" strs prev |
| 240 |
if result < 0 then |
| 241 |
done_cancel = 1 |
| 242 |
continue |
| 243 |
endif |
| 244 |
prev = result |
| 245 |
if done[result] == 0 then |
| 246 |
done[result] = 1 |
| 247 |
else |
| 248 |
done[result] = 0 |
| 249 |
endif |
| 250 |
done_all = 1 |
| 251 |
for i 0 N-1 |
| 252 |
if done[i] == 0 then |
| 253 |
done_all = 0 |
| 254 |
break |
| 255 |
endif |
| 256 |
next |
| 257 |
endwhile |
| 258 |
messagebox "finish listbox test" "test listbox" |
| 259 |
return |
| 260 |
|
| 261 |
;;;;;;;;;;;;;;;; |
| 262 |
;;; filenamebox |
| 263 |
;;; - Dependence |
| 264 |
;;; messagebox |
| 265 |
:test_filenamebox |
| 266 |
filenamebox "ファイルを選んでください(load)" 0 "c:\" |
| 267 |
sprintf2 s "result %d inputstr %s" result inputstr |
| 268 |
messagebox s "test fienamebox" |
| 269 |
filenamebox "ファイルを選んでください(save)" 1 "c:\windows" |
| 270 |
sprintf2 s "result %d inputstr %s" result inputstr |
| 271 |
messagebox s "test fienamebox" |
| 272 |
messagebox "finish filenaebox test" "test filenamebox" |
| 273 |
return |
| 274 |
|
| 275 |
;;;;;;;;;;;;;;;; |
| 276 |
;;; dirnamebox |
| 277 |
;;; - Dependence |
| 278 |
;;; messagebox |
| 279 |
:test_dirnamebox |
| 280 |
dirnamebox "whereディレクトリ" "c:\" |
| 281 |
sprintf2 s "result %d inputstr %s" result inputstr |
| 282 |
messagebox s "test fienamebox" |
| 283 |
messagebox "finish dirnamebox test" "test dirnambox" |
| 284 |
return |
| 285 |
|
| 286 |
|