[SHELL32_APITEST] Try to close windows opened by each test (#7861)

This commit is contained in:
Whindmar Saksit
2025-07-06 13:47:12 +02:00
committed by GitHub
parent a753f34e30
commit 2a901a72f3
3 changed files with 128 additions and 45 deletions

View File

@@ -149,7 +149,7 @@ getCommandLineFromProcess(HANDLE hProcess)
return pszBuffer; // needs free()
}
static void TEST_DoTestEntryStruct(const TEST_ENTRY *pEntry)
static TEST_RESULT TEST_DoTestEntryStruct(const TEST_ENTRY *pEntry)
{
SHELLEXECUTEINFOW info = { sizeof(info) };
info.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_WAITFORINPUTIDLE |
@@ -172,6 +172,9 @@ static void TEST_DoTestEntryStruct(const TEST_ENTRY *pEntry)
ok(pEntry->result == result,
"Line %d: result: %d vs %d\n", pEntry->line, pEntry->result, result);
if (result == TEST_SUCCESS_WITH_PROCESS)
WaitForInputIdle(info.hProcess, 2000);
if (pEntry->result == TEST_SUCCESS_WITH_PROCESS && pEntry->cmdline && !s_bWow64)
{
LPWSTR cmdline = getCommandLineFromProcess(info.hProcess);
@@ -191,13 +194,28 @@ static void TEST_DoTestEntryStruct(const TEST_ENTRY *pEntry)
}
CloseHandle(info.hProcess);
return result;
}
static void
TEST_DoTestEntry(INT line, TEST_RESULT result, LPCWSTR lpFile, LPCWSTR cmdline)
{
WINDOW_LIST existingwindows;
GetWindowList(&existingwindows);
HWND hWndForeground = GetForegroundWindow();
TEST_ENTRY entry = { line, result, lpFile, cmdline };
TEST_DoTestEntryStruct(&entry);
result = TEST_DoTestEntryStruct(&entry);
if (result == TEST_SUCCESS_NO_PROCESS)
{
// Wait a bit for Explorer to open its window
for (UINT i = 0; i < 2000 && hWndForeground == GetForegroundWindow(); i += 250)
Sleep(250);
}
CloseNewWindows(&existingwindows);
FreeWindowList(&existingwindows);
}
static BOOL