From fdf5dd261dac43b190f139e474dbdc4fc7cadddb Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Thu, 25 Jul 2024 19:02:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8A=A8=E6=80=81=E6=A0=A1?= =?UTF-8?q?=E6=AD=A3=E6=97=A0=E7=BA=B8=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=E6=9C=89=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/base/test_base.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/code/base/test_base.cpp b/code/base/test_base.cpp index 647e880..5196caf 100644 --- a/code/base/test_base.cpp +++ b/code/base/test_base.cpp @@ -721,10 +721,18 @@ void test::thread_dynamic_correct(std::string correctData) return; } + SANE_Bool type = true; + unsigned int len = sizeof(SANE_Bool); + int ret = helper_->io_control(IO_CTRL_CODE_GET_PAPER_ON, &type, &len); + if (!type) + { + helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"无纸", false); + return; + } CorrectMode correctMode = m_correctModeMap.at(g_currentCorrectType); int dpi = correctMode.dpi; bool isColor = correctMode.isColor; - int ret = public_test_image_correct(correctData, dpi, isColor); + ret = public_test_image_correct(correctData, dpi, isColor); g_currentCorrectType++; } } @@ -1784,6 +1792,8 @@ int test::test_image_correct_all(void* data) } g_currentCorrectType = 1; + if (thread_dynamic_correct_handle.get() && thread_dynamic_correct_handle->joinable()) + thread_dynamic_correct_handle->join(); thread_dynamic_correct_handle.reset(new std::thread(&test::thread_dynamic_correct, this, str)); return SCANNER_ERR_OK;