From 75cc5b2b1cd03b8e0dd7730a187b1f85ad906161 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Wed, 24 Apr 2024 19:03:10 +0900 Subject: [PATCH] [SHELL32_APITEST] Commonize FindSubProgram function and delete obsolete "iexplore.exe" tests. CORE-13950 --- .../apitests/shell32/SHChangeNotify.cpp | 20 +--------------- .../apitests/shell32/ShellExecCmdLine.cpp | 23 +------------------ .../apitests/shell32/shell32_apitest_sub.h | 18 +++++++++++++++ 3 files changed, 20 insertions(+), 41 deletions(-) diff --git a/modules/rostests/apitests/shell32/SHChangeNotify.cpp b/modules/rostests/apitests/shell32/SHChangeNotify.cpp index f06921961d0..e853baa875f 100644 --- a/modules/rostests/apitests/shell32/SHChangeNotify.cpp +++ b/modules/rostests/apitests/shell32/SHChangeNotify.cpp @@ -88,24 +88,6 @@ static void TEST_Quit(void) DoDeleteFilesAndDirs(); } -static BOOL FindSubProgram(void) -{ - GetModuleFileNameW(NULL, s_szSubProgram, _countof(s_szSubProgram)); - PathRemoveFileSpecW(s_szSubProgram); - PathAppendW(s_szSubProgram, L"shell32_apitest_sub.exe"); - - if (!PathFileExistsW(s_szSubProgram)) - { - PathRemoveFileSpecW(s_szSubProgram); - PathAppendW(s_szSubProgram, L"testdata\\shell32_apitest_sub.exe"); - - if (!PathFileExistsW(s_szSubProgram)) - return FALSE; - } - - return TRUE; -} - static void DoBuildFilesAndDirs(void) { WCHAR szPath1[MAX_PATH]; @@ -533,7 +515,7 @@ MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) static BOOL TEST_Init(void) { - if (!FindSubProgram()) + if (!FindSubProgram(s_szSubProgram, _countof(s_szSubProgram))) { skip("shell32_apitest_sub.exe not found\n"); return FALSE; diff --git a/modules/rostests/apitests/shell32/ShellExecCmdLine.cpp b/modules/rostests/apitests/shell32/ShellExecCmdLine.cpp index c0a2104a25b..a9082d0fc07 100644 --- a/modules/rostests/apitests/shell32/ShellExecCmdLine.cpp +++ b/modules/rostests/apitests/shell32/ShellExecCmdLine.cpp @@ -256,27 +256,6 @@ static WCHAR s_win_test_exe[MAX_PATH]; static WCHAR s_sys_bat_file[MAX_PATH]; static WCHAR s_cur_dir[MAX_PATH]; -static BOOL -GetSubProgramPath(void) -{ - GetModuleFileNameW(NULL, s_sub_program, _countof(s_sub_program)); - PathRemoveFileSpecW(s_sub_program); - PathAppendW(s_sub_program, L"shell32_apitest_sub.exe"); - - if (!PathFileExistsW(s_sub_program)) - { - PathRemoveFileSpecW(s_sub_program); - PathAppendW(s_sub_program, L"testdata\\shell32_apitest_sub.exe"); - - if (!PathFileExistsW(s_sub_program)) - { - return FALSE; - } - } - - return TRUE; -} - static const TEST_ENTRY s_entries_1[] = { // NULL @@ -677,7 +656,7 @@ START_TEST(ShellExecCmdLine) } } - if (!GetSubProgramPath()) + if (!FindSubProgram(s_sub_program, _countof(s_sub_program))) { skip("shell32_apitest_sub.exe is not found\n"); return; diff --git a/modules/rostests/apitests/shell32/shell32_apitest_sub.h b/modules/rostests/apitests/shell32/shell32_apitest_sub.h index 8102c078dcd..d64e2af03de 100644 --- a/modules/rostests/apitests/shell32/shell32_apitest_sub.h +++ b/modules/rostests/apitests/shell32/shell32_apitest_sub.h @@ -12,6 +12,24 @@ #define NUM_STAGE 10 +static inline BOOL FindSubProgram(LPWSTR pszSubProgram, DWORD cchSubProgram) +{ + GetModuleFileNameW(NULL, pszSubProgram, cchSubProgram); + PathRemoveFileSpecW(pszSubProgram); + PathAppendW(pszSubProgram, L"shell32_apitest_sub.exe"); + + if (!PathFileExistsW(pszSubProgram)) + { + PathRemoveFileSpecW(pszSubProgram); + PathAppendW(pszSubProgram, L"testdata\\shell32_apitest_sub.exe"); + + if (!PathFileExistsW(pszSubProgram)) + return FALSE; + } + + return TRUE; +} + static inline HWND DoWaitForWindow(LPCWSTR clsname, LPCWSTR text, BOOL bClosing, BOOL bForce) { HWND hwnd = NULL;