TA的每日心情 | 奋斗 2015-11-17 09:09 |
---|
签到天数: 7 天 连续签到: 1 天 [LV.3]测试连长
|
3#
楼主 |
发表于 2007-1-13 00:31:16
|
只看该作者
###############################################################################################
#脚本1:(完成定制UI对话框,捕获,比较以及显示函数)
#Test Type:Compiled Module
###############################################################################################
# 定制的UI Check对话框,唯一的缺点在于不能多选。如果需要多选,需要预先将其进行组合,如此例中的“Both”。
function custome_ui_func(window, object, inout checklist, out arglist)
{
auto res = create_list_dialog("GUI Verification Sample UI_function Display","Please choose a check name","Size,X,Both");
switch(res){
case "Size":{
checklist = "Size";
arglist = "User selected Size";
break;
}
# X 是 Object 类的默认检查对象,故不需为其添加捕获函数和比较函数。这里将其显示在定制的UI Check 对话框中。
case "X":{
checklist = "X";
arglist = "User selected X";
break;
}
case "Both":{
checklist = "Size X";
arglist = "User selected Size and X";
break;
}
default:return -1;
}
return 0;
}
#1 捕获函数
function size_capture(object, inout size)
{
auto height,width;
obj_get_info(object, "height", height);
obj_get_info(object, "width", width);
size = height * width;
return 0;
}
#1 比较函数
function compare1(exp_val, act_val, arglist, inout diff_file)
{
diff_file = "";
if (exp_val != act_val) {
return E_DIFF;
}
return E_OK;
}
# 显示函数
function display_func2(exp_file, act_file, result, diff_file)
{
auto exp_buf, act_buf, diff_buf;
read_file(exp_file, exp_buf);
read_file(act_file, act_buf);
read_file(diff_file, diff_buf);
pause_test("\nExpected: " & exp_buf & "\nActual: " & act_buf & "\n\nResult: "& result & "\nDiff: " & diff_buf, "OK", "Cancel", "Close");
return 0;
}
function read_file(name, out buf)
{
auto tmp;
buf = "";
file_open(name,FO_MODE_READ);
if (name != "") {
while (file_getline(name,tmp)) {
buf = buf & tmp;
}
file_close(name);
}
} |
|