[SHELL32_APITEST] Try to fix Test Win2003_x64 again

This commit is contained in:
Katayama Hirofumi MZ 2022-02-13 17:45:08 +09:00
parent 45a4e53fa4
commit 60b89da383
6 changed files with 40 additions and 29 deletions

View file

@ -8,6 +8,7 @@
#include "shelltest.h"
#include <stdio.h>
#include <shlwapi.h>
#include "shell32_apitest_sub.h"
static char s_sub_program[MAX_PATH];
@ -268,4 +269,6 @@ START_TEST(FindExecutable)
DeleteFileA(s_sys_bat_file);
DeleteFileA(s_win_txt_file);
DeleteFileA(s_sys_txt_file);
DoWaitForWindow(CLASSNAME, CLASSNAME, TRUE, TRUE);
}

View file

@ -8,7 +8,7 @@
// NOTE: This test program closes the Explorer windows before tests.
#include "shelltest.h"
#include "SHChangeNotify.h"
#include "shell32_apitest_sub.h"
#include <time.h>
#include <process.h>
#include <versionhelpers.h>
@ -32,31 +32,6 @@ static WCHAR s_szSubProgram[MAX_PATH];
static HANDLE s_hThread = NULL;
static HANDLE s_hEvent = NULL;
static HWND DoWaitForWindow(LPCWSTR clsname, LPCWSTR text, BOOL bClosing, BOOL bForce)
{
HWND hwnd = NULL;
for (INT i = 0; i < 50; ++i)
{
hwnd = FindWindowW(clsname, text);
if (bClosing)
{
if (!hwnd)
break;
if (bForce)
PostMessage(hwnd, WM_CLOSE, 0, 0);
}
else
{
if (hwnd)
break;
}
Sleep(1);
}
return hwnd;
}
static BOOL DoCreateEmptyFile(LPCWSTR pszFileName)
{
FILE *fp = _wfopen(pszFileName, L"wb");
@ -964,5 +939,5 @@ START_TEST(SHChangeNotify)
#endif
DoWaitForWindow(CLASSNAME, CLASSNAME, TRUE, TRUE);
Sleep(500);
Sleep(100);
}

View file

@ -8,6 +8,7 @@
#include <shlwapi.h>
#include <strsafe.h>
#include <versionhelpers.h>
#include "shell32_apitest_sub.h"
#define NDEBUG
#include <debug.h>
@ -738,4 +739,7 @@ START_TEST(ShellExecCmdLine)
ok(DeleteFileA("Test File 1.txt"), "failed to delete the test file\n");
ok(DeleteFileA("Test File 2.bat"), "failed to delete the test file\n");
free(s_wi0.phwnd);
DoWaitForWindow(CLASSNAME, CLASSNAME, TRUE, TRUE);
Sleep(100);
}

View file

@ -9,6 +9,7 @@
#include "shelltest.h"
#include <shlwapi.h>
#include <stdio.h>
#include "shell32_apitest_sub.h"
#define ok_ShellExecuteEx (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : TestShellExecuteEx
@ -465,4 +466,7 @@ START_TEST(ShellExecuteEx)
DoAppPathTest();
DoTestEntries();
test_properties();
DoWaitForWindow(CLASSNAME, CLASSNAME, TRUE, TRUE);
Sleep(100);
}

View file

@ -6,7 +6,7 @@
*/
#include "shelltest.h"
#include "SHChangeNotify.h"
#include "shell32_apitest_sub.h"
static HWND s_hwnd = NULL;
static UINT s_uRegID = 0;

View file

@ -59,7 +59,7 @@ inline LPITEMIDLIST DoGetPidl(DIRTYPE iDir)
return ret;
}
inline LPWSTR DoGetDir(DIRTYPE iDir)
static inline LPWSTR DoGetDir(DIRTYPE iDir)
{
static size_t s_index = 0;
static WCHAR s_pathes[3][MAX_PATH];
@ -71,3 +71,28 @@ inline LPWSTR DoGetDir(DIRTYPE iDir)
s_index = (s_index + 1) % _countof(s_pathes);
return psz;
}
static inline HWND DoWaitForWindow(LPCWSTR clsname, LPCWSTR text, BOOL bClosing, BOOL bForce)
{
HWND hwnd = NULL;
for (INT i = 0; i < 50; ++i)
{
hwnd = FindWindowW(clsname, text);
if (bClosing)
{
if (!hwnd)
break;
if (bForce)
PostMessage(hwnd, WM_CLOSE, 0, 0);
}
else
{
if (hwnd)
break;
}
Sleep(1);
}
return hwnd;
}