调整流程

This commit is contained in:
13038267101 2022-12-28 10:21:16 +08:00
parent ef876fd539
commit 701a1ddfd4
2 changed files with 49 additions and 40 deletions

View File

@ -33,7 +33,7 @@
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
@ -46,7 +46,7 @@
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
@ -100,7 +100,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
@ -109,6 +109,9 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>copy $(OutDir)test.dll $(SolutionDir)..\..\..\release\win\x86\Release\</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
@ -128,7 +131,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
@ -137,6 +140,9 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>copy $(OutDir)test.dll $(SolutionDir)..\..\..\release\win\x64\Release\</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="test_base.cpp" />

View File

@ -53,7 +53,7 @@ int get_json_config_file()
std::cout << buf << std::endl;
}
static std::wstring set_test_name_;
static std::wstring set_test_name_ =L"";
class test
{
ui_helper* helper_;
@ -67,58 +67,58 @@ public:
return -1;
}
ui_helper* h= (ui_helper*)param;
std::wstring wstr = L"";
size_t l = 0;
bool type = true;
int ret = str_to_wchar((char*)data, (wchar_t*)wstr.c_str(), &l);
if (ret == ERROR_INSUFFICIENT_BUFFER)
ret = str_to_wchar((char*)data, (wchar_t*)wstr.c_str(), &l);
if (ret == ERROR_INSUFFICIENT_BUFFER)
{
type = false;
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)wstr.c_str(), type);
return -1;
}
switch (code)
{
case SANE_EVENT_WORKING:
{
}
break;
case SANE_EVENT_SCAN_FINISHED:
{
std::wstring wstr = L"";
size_t len = 0;
bool type = false;
int ret = str_to_wchar((char*)data, (wchar_t*)wstr.c_str(),&len);
if (ret == ERROR_INSUFFICIENT_BUFFER)
ret = str_to_wchar((char*)data, (wchar_t*)wstr.c_str(), &len);
if (ret == ERROR_INSUFFICIENT_BUFFER)
{
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)wstr.c_str(), type);
return -1;
}
SANE_Bool io_type = false;
unsigned int io_len = sizeof(SANE_Bool);
if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_SKEW_DETECTION) == 0)
{
type = strcmp((char*)data, STATU_DESC_SCANNER_ERR_DEVICE_PAPER_SKEW) == 0 ? true : false;
}
else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CIS_ORIGINAL_IMAGE) == 0)
{
h->io_control(IO_CTRL_CODE_SET_CIS_IMAGE, &io_type, &io_len);
}
else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_DISTORTION) == 0)
{
int ret = h->io_control(IO_CTRL_CODE_GET_DPI_COLOR_CHECK_VAL, &io_type, &io_len);
if (strcmp((char*)data, STATU_DESC_SCAN_STOPPED))
{
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_DISTORTION, (void*)L"畸变修正完成,是否进行单页扫描测试", type);
return 0;
}
}
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)wstr.c_str(), type);
}
break;
case SANE_EVENT_STATUS:
{
//std::string ret_call_ = (char*)data;
}
break;
case SANE_EVENT_ERROR:
{
//ret_call_ = (char*)data;
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)wstr.c_str(), false);
}
break;
case SANE_EVENT_IMAGE_OK:
{
if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CIS_ORIGINAL_IMAGE) == 0 ||
wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_QUALITY) == 0)
if ( wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CIS_ORIGINAL_IMAGE) == 0
||wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_QUALITY) == 0
||wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_DISTORTION) == 0)
{
if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CIS_ORIGINAL_IMAGE) == 0)
{
SANE_Bool type = false;
unsigned int len = sizeof(SANE_Bool);
h->io_control(IO_CTRL_CODE_SET_CIS_IMAGE, &type, &len); //ʹÓÃÍê»Ö¸´Ä¬ÈÏ
}
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_HAVE_IMAGE, data, true);
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_HAVE_IMAGE, data, true);
}
}
break;
@ -399,7 +399,10 @@ public:
/* »û±äÐÞÕý */
int test_distortion(void *data)
{
return SCANNER_ERR_OK;
const wchar_t* NAME = (wchar_t*)data;
SANE_Bool type = true;
unsigned int len = sizeof(SANE_Bool);
return helper_->io_control(IO_CTRL_CODE_GET_DPI_COLOR_CHECK_VAL, &type, &len);
}
/* ÉèÖÃÐÝÃß */
int test_dormancy(void *data)