From fedc708206240e541f7484527c6035c7178f9b0f Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Mon, 19 Jun 2023 18:48:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E7=95=B8=E5=8F=98=E5=80=BC?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=BB=85=E4=BB=8E=E8=AE=BE=E5=A4=87=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/base/test_base.cpp | 42 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/code/base/test_base.cpp b/code/base/test_base.cpp index 555c261..2ca3b5d 100644 --- a/code/base/test_base.cpp +++ b/code/base/test_base.cpp @@ -1,4 +1,4 @@ -#include"test_base.h" +#include"test_base.h" #include #include #include @@ -1165,9 +1165,8 @@ public: int ret = SCANNER_ERR_OK, dpi = 0; - SANE_Bool type = true; - unsigned int len = sizeof(SANE_Bool), - llen = sizeof(int); + float distortion = 0; + unsigned int len = sizeof(int); size_t strl = 0; ret = wchar_to_char(str, p, &strl); if (ret == ERROR_INSUFFICIENT_BUFFER) @@ -1182,39 +1181,20 @@ public: } if (dpi > 0) { - ret = helper_->io_control(IO_CTRL_CODE_SET_DPI, &dpi, &llen); + ret = helper_->io_control(IO_CTRL_CODE_SET_DPI, &dpi, &len); } - ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_IMAGE, &type, &len); - if (ret != SCANNER_ERR_OK) + ret = helper_->io_control(IO_CTRL_CODE_GET_DISTORTION_DEVS_CHECK_VAL, &distortion, &len); + if (ret == SCANNER_ERR_OK) { - return ret; - } - int cnt = 0; - SANE_DISTORTION_VAL dis = { 0 }; - while (ret == SCANNER_ERR_OK) - { - if (is_distortion_get_image) - { - ret = helper_->io_control(IO_CTRL_CODE_GET_PC_DISTORTION_CHECK_VAL, &dis, &llen); - break; - } - else if (cnt == 30) - break; - - if (is_distortion_get_image_abnormal) - return -1; - - Sleep(1000); - cnt++; - } - if (dis.h > 0 && dis.scaleXY < 10) - { - helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_DISTORTION_VAL, (void *)&dis, true); + wchar_t buf[64]; + swprintf(buf, 64, L"设备畸变值为:%.4f", distortion); + + helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)buf, 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; }