[ROSTESTS] Add an interactive "dialog_initvisible" test (#9362)

CORE-20706

Its purpose is to observe whether or not a dialog that has the
`WS_VISIBLE` style explicitly set, briefly becomes visible
even if it gets terminated early from its `WM_INITDIALOG` handler.
(On Windows it does NOT become visible.)
This commit is contained in:
Hermès Bélusca-Maïto
2026-08-06 19:05:44 +02:00
parent 2543392039
commit 99a4e12e74
5 changed files with 90 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
add_subdirectory(biditext)
add_subdirectory(dialog_initvisible)
add_subdirectory(editalign)
add_subdirectory(menuaccels)
add_subdirectory(messagebox)

View File

@@ -0,0 +1,5 @@
add_executable(dialog_initvisible dialog_initvisible.c dialog_initvisible.rc)
set_module_type(dialog_initvisible win32gui UNICODE)
add_importlibs(dialog_initvisible user32 msvcrt kernel32)
add_rostests_file(TARGET dialog_initvisible SUBDIR suppl)

View File

@@ -0,0 +1,65 @@
/*
* PROJECT: ReactOS Tests
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Tests whether a dialog is getting visible even if WM_INITDIALOG ends it.
* COPYRIGHT: Copyright 2026 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
*/
#define WIN32_NO_STATUS
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#define NTOS_MODE_USER
#include <ndk/iotypes.h> // Needed for kdtypes.h
#include <ndk/ketypes.h> // " " "
#include <ndk/kdtypes.h> // For SharedUserData
#include "resource.h"
INT_PTR CALLBACK
AboutDlgProc(
_In_ HWND hDlg,
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (uMsg)
{
case WM_INITDIALOG:
{
/* Intentional breakpoint for you to step-by-step debug into a debugger! */
if (IsDebuggerPresent() || SharedUserData->KdDebuggerEnabled)
__debugbreak();
SendMessageW(hDlg, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), 0);
EndDialog(hDlg, -1);
return (INT_PTR)TRUE;
}
case WM_COMMAND:
{
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
}
return (INT_PTR)FALSE;
}
int APIENTRY
wWinMain(
_In_ HINSTANCE hInstance,
_In_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
return DialogBoxW(hInstance, MAKEINTRESOURCEW(IDD_ABOUTBOX), NULL, AboutDlgProc);
}

View File

@@ -0,0 +1,17 @@
#include <winnt.rh>
#include <winuser.rh>
#include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
// NOTE: Ensure the WS_VISIBLE flag is set for the test.
IDD_ABOUTBOX DIALOGEX 0, 0, 135, 62
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
CAPTION "About Dialog_InitVisible"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Dialog_InitVisible, Version 1.0", IDC_STATIC, 7, 14, 114, 8, SS_NOPREFIX
LTEXT "Copyright (C) 2026 ReactOS", IDC_STATIC, 7, 26, 114, 8
DEFPUSHBUTTON "OK", IDOK, 78, 41, 50, 14, WS_GROUP
END

View File

@@ -0,0 +1,2 @@
#define IDD_ABOUTBOX 101
#define IDC_STATIC -1