解决动态校正无纸的情况下有异常的问题

This commit is contained in:
yangjiaxuan 2024-07-25 19:02:17 +08:00
parent a579da892e
commit fdf5dd261d
1 changed files with 11 additions and 1 deletions

View File

@ -721,10 +721,18 @@ void test::thread_dynamic_correct(std::string correctData)
return; 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); CorrectMode correctMode = m_correctModeMap.at(g_currentCorrectType);
int dpi = correctMode.dpi; int dpi = correctMode.dpi;
bool isColor = correctMode.isColor; bool isColor = correctMode.isColor;
int ret = public_test_image_correct(correctData, dpi, isColor); ret = public_test_image_correct(correctData, dpi, isColor);
g_currentCorrectType++; g_currentCorrectType++;
} }
} }
@ -1784,6 +1792,8 @@ int test::test_image_correct_all(void* data)
} }
g_currentCorrectType = 1; 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)); thread_dynamic_correct_handle.reset(new std::thread(&test::thread_dynamic_correct, this, str));
return SCANNER_ERR_OK; return SCANNER_ERR_OK;