https://git.reactos.org/?p=reactos.git;a=commitdiff;h=60b89da383dbe74b3ac85…
commit 60b89da383dbe74b3ac850e0d1611eb376a7a470
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Feb 13 17:45:08 2022 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Sun Feb 13 17:45:08 2022 +0900
[SHELL32_APITEST] Try to fix Test Win2003_x64 again
---
.../rostests/apitests/shell32/FindExecutable.cpp | 3 +++
.../rostests/apitests/shell32/SHChangeNotify.cpp | 29 ++--------------------
.../rostests/apitests/shell32/ShellExecCmdLine.cpp | 4 +++
.../rostests/apitests/shell32/ShellExecuteEx.cpp | 4 +++
.../apitests/shell32/shell32_apitest_sub.cpp | 2 +-
.../{SHChangeNotify.h => shell32_apitest_sub.h} | 27 +++++++++++++++++++-
6 files changed, 40 insertions(+), 29 deletions(-)
diff --git a/modules/rostests/apitests/shell32/FindExecutable.cpp
b/modules/rostests/apitests/shell32/FindExecutable.cpp
index 07a673af8bd..132c9589e65 100644
--- a/modules/rostests/apitests/shell32/FindExecutable.cpp
+++ b/modules/rostests/apitests/shell32/FindExecutable.cpp
@@ -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);
}
diff --git a/modules/rostests/apitests/shell32/SHChangeNotify.cpp
b/modules/rostests/apitests/shell32/SHChangeNotify.cpp
index e1edb4a5376..7a95fc470f6 100644
--- a/modules/rostests/apitests/shell32/SHChangeNotify.cpp
+++ b/modules/rostests/apitests/shell32/SHChangeNotify.cpp
@@ -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);
}
diff --git a/modules/rostests/apitests/shell32/ShellExecCmdLine.cpp
b/modules/rostests/apitests/shell32/ShellExecCmdLine.cpp
index ce53cd45968..699def5e114 100644
--- a/modules/rostests/apitests/shell32/ShellExecCmdLine.cpp
+++ b/modules/rostests/apitests/shell32/ShellExecCmdLine.cpp
@@ -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);
}
diff --git a/modules/rostests/apitests/shell32/ShellExecuteEx.cpp
b/modules/rostests/apitests/shell32/ShellExecuteEx.cpp
index 3e33c075d10..70f33ca4021 100644
--- a/modules/rostests/apitests/shell32/ShellExecuteEx.cpp
+++ b/modules/rostests/apitests/shell32/ShellExecuteEx.cpp
@@ -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);
}
diff --git a/modules/rostests/apitests/shell32/shell32_apitest_sub.cpp
b/modules/rostests/apitests/shell32/shell32_apitest_sub.cpp
index 1b90c7ae39a..5a56b08aefb 100644
--- a/modules/rostests/apitests/shell32/shell32_apitest_sub.cpp
+++ b/modules/rostests/apitests/shell32/shell32_apitest_sub.cpp
@@ -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;
diff --git a/modules/rostests/apitests/shell32/SHChangeNotify.h
b/modules/rostests/apitests/shell32/shell32_apitest_sub.h
similarity index 74%
rename from modules/rostests/apitests/shell32/SHChangeNotify.h
rename to modules/rostests/apitests/shell32/shell32_apitest_sub.h
index e20b6b7a74c..bff2e174683 100644
--- a/modules/rostests/apitests/shell32/SHChangeNotify.h
+++ b/modules/rostests/apitests/shell32/shell32_apitest_sub.h
@@ -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;
+}