diff --git a/code/base/test_base.cpp b/code/base/test_base.cpp index 248da08..774f892 100644 --- a/code/base/test_base.cpp +++ b/code/base/test_base.cpp @@ -121,6 +121,7 @@ int get_json_config_file() } static std::wstring set_test_name_ =L""; bool is_distortion_get_image = false; +bool is_distortion_get_image_abnormal = false; class test { ui_helper* helper_; @@ -372,6 +373,7 @@ public: { type = false; is_distortion_get_image = false; + is_distortion_get_image_abnormal = true; wcscpy(buf, L"畸变修正值获取失败,原因--->"); } else @@ -595,7 +597,11 @@ public: helper_->test_callback(name, ui_helper::TEST_EVENT_NOT_FIND_TEST, NULL, false); return ret; } - if (ret != SCANNER_ERR_OK && ret != -1) + if (ret == SCANNER_ERR_DEVICE_NOT_SUPPORT + || ret == SCANNER_ERR_IO + || ret == SCANNER_ERR_TIMEOUT + || ret == SCANNER_ERR_NO_DATA + ) { helper_->test_callback(name, ui_helper::TEST_EVENT_IO_FAIL, NULL, ret); } @@ -1001,16 +1007,19 @@ public: else if (cnt == 30) break; + if (is_distortion_get_image_abnormal) + return; + Sleep(1000); cnt++; } - if (dis.h > 0 && dis.scaleXY < 10) + if (dis.h > 0 && dis.scaleXY < 10) { helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_DISTORTION_VAL, (void *)&dis, true); } else { - helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT,(void*)L"自动计算畸变值获取失败", false); + helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT,(void*)L"自动计算畸变值获取失败", false); } return ret; } @@ -1268,6 +1277,8 @@ DECL_API(int) func_test_go(const wchar_t* NAME, const wchar_t* oper, ui_helper* //helper->add_ref(void *data); is_distortion_get_image = false; + is_distortion_get_image_abnormal = false; + int ret = 0; SANE_Bool type = false; unsigned int len = sizeof(SANE_Bool);