[SHELL32_APITEST] Commonize FindSubProgram function

and delete obsolete "iexplore.exe" tests. CORE-13950
This commit is contained in:
Katayama Hirofumi MZ 2024-04-24 19:03:10 +09:00
parent 8337df2bd1
commit 75cc5b2b1c
3 changed files with 20 additions and 41 deletions

View file

@ -88,24 +88,6 @@ static void TEST_Quit(void)
DoDeleteFilesAndDirs(); 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) static void DoBuildFilesAndDirs(void)
{ {
WCHAR szPath1[MAX_PATH]; WCHAR szPath1[MAX_PATH];
@ -533,7 +515,7 @@ MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL TEST_Init(void) static BOOL TEST_Init(void)
{ {
if (!FindSubProgram()) if (!FindSubProgram(s_szSubProgram, _countof(s_szSubProgram)))
{ {
skip("shell32_apitest_sub.exe not found\n"); skip("shell32_apitest_sub.exe not found\n");
return FALSE; return FALSE;

View file

@ -256,27 +256,6 @@ static WCHAR s_win_test_exe[MAX_PATH];
static WCHAR s_sys_bat_file[MAX_PATH]; static WCHAR s_sys_bat_file[MAX_PATH];
static WCHAR s_cur_dir[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[] = static const TEST_ENTRY s_entries_1[] =
{ {
// NULL // 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"); skip("shell32_apitest_sub.exe is not found\n");
return; return;

View file

@ -12,6 +12,24 @@
#define NUM_STAGE 10 #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) static inline HWND DoWaitForWindow(LPCWSTR clsname, LPCWSTR text, BOOL bClosing, BOOL bForce)
{ {
HWND hwnd = NULL; HWND hwnd = NULL;