mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[COMCTL32_APITEST] Add propsheetv6 testcase (#1853)
The proof of #1842. Property sheet does unchange the page after WM_INITDIALOG. CORE-16280
This commit is contained in:
parent
2fbff73792
commit
fce898063e
4 changed files with 136 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
|
||||
add_executable(comctl32_apitest button.c toolbar.c testlist.c ../include/msgtrace.c comctl32_apitest.rc)
|
||||
add_executable(comctl32_apitest button.c propsheet.c toolbar.c testlist.c ../include/msgtrace.c comctl32_apitest.rc)
|
||||
target_link_libraries(comctl32_apitest wine)
|
||||
set_module_type(comctl32_apitest win32cui)
|
||||
add_importlibs(comctl32_apitest uxtheme comctl32 user32 gdi32 msvcrt kernel32 ntdll)
|
||||
|
|
|
@ -7,3 +7,15 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
#include <reactos/manifest_exe.rc>
|
||||
|
||||
5 BITMAP "test.bmp"
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
|
||||
|
||||
1 DIALOG 0, 0, 171, 82
|
||||
CAPTION "propsheet page1"
|
||||
STYLE DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION
|
||||
FONT 9, "MS Shell Dlg"
|
||||
{
|
||||
EDITTEXT edt1, 29, 22, 60, 14
|
||||
DEFPUSHBUTTON "OK", IDOK, 25, 60, 60, 14
|
||||
PUSHBUTTON "Cancel", IDCANCEL, 96, 60, 60, 14
|
||||
}
|
||||
|
|
121
modules/rostests/apitests/comctl32/propsheet.c
Normal file
121
modules/rostests/apitests/comctl32/propsheet.c
Normal file
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: Test for property sheet
|
||||
* COPYRIGHT: Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
|
||||
*/
|
||||
#include "wine/test.h"
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <commctrl.h>
|
||||
#include <prsht.h>
|
||||
|
||||
#define IDC_APPLY_BUTTON 12321
|
||||
|
||||
static BOOL s_bNotified;
|
||||
|
||||
static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
|
||||
{
|
||||
s_bNotified = FALSE;
|
||||
SetDlgItemTextW(hwnd, edt1, L"text");
|
||||
SetTimer(hwnd, 999, 300, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case IDOK:
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd, id);
|
||||
break;
|
||||
case edt1:
|
||||
if (codeNotify == EN_CHANGE)
|
||||
{
|
||||
s_bNotified = TRUE;
|
||||
PropSheet_Changed(GetParent(hwnd), hwnd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void OnTimer(HWND hwnd, UINT id)
|
||||
{
|
||||
HWND hwndParent, hwndApply;
|
||||
|
||||
KillTimer(hwnd, id);
|
||||
|
||||
ok_int(s_bNotified, TRUE);
|
||||
|
||||
hwndParent = GetParent(hwnd);
|
||||
hwndApply = GetDlgItem(hwndParent, IDC_APPLY_BUTTON);
|
||||
ok_int(IsWindowEnabled(hwndApply), FALSE);
|
||||
|
||||
PropSheet_Changed(hwndParent, hwnd);
|
||||
ok_int(IsWindowEnabled(hwndApply), TRUE);
|
||||
|
||||
PropSheet_UnChanged(hwndParent, hwnd);
|
||||
ok_int(IsWindowEnabled(hwndApply), FALSE);
|
||||
|
||||
PropSheet_PressButton(hwndParent, PSBTN_OK);
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK
|
||||
Page1DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
HANDLE_MSG(hwnd, WM_INITDIALOG, OnInitDialog);
|
||||
HANDLE_MSG(hwnd, WM_COMMAND, OnCommand);
|
||||
HANDLE_MSG(hwnd, WM_TIMER, OnTimer);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef HPROPSHEETPAGE (WINAPI *FN_CreatePropertySheetPageW)(LPCPROPSHEETPAGEW);
|
||||
typedef int (WINAPI *FN_PropertySheetW)(LPCPROPSHEETHEADERW);
|
||||
|
||||
START_TEST(propsheet)
|
||||
{
|
||||
PROPSHEETPAGEW psp;
|
||||
PROPSHEETHEADERW header;
|
||||
HPROPSHEETPAGE hpsp[1];
|
||||
HMODULE hComCtl32;
|
||||
FN_CreatePropertySheetPageW pCreatePropertySheetPageW;
|
||||
FN_PropertySheetW pPropertySheetW;
|
||||
|
||||
hComCtl32 = LoadLibraryW(L"comctl32.dll");
|
||||
pCreatePropertySheetPageW = (FN_CreatePropertySheetPageW)GetProcAddress(hComCtl32, "CreatePropertySheetPageW");
|
||||
pPropertySheetW = (FN_PropertySheetW)GetProcAddress(hComCtl32, "PropertySheetW");
|
||||
|
||||
ok(pCreatePropertySheetPageW != NULL, "pCreatePropertySheetPageW was NULL.\n");
|
||||
ok(pPropertySheetW != NULL, "pPropertySheetW was NULL.\n");
|
||||
|
||||
if (!pCreatePropertySheetPageW || !pPropertySheetW)
|
||||
{
|
||||
skip("!pCreatePropertySheetPageW || !pPropertySheetW\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ZeroMemory(&psp, sizeof(psp));
|
||||
psp.dwSize = sizeof(psp);
|
||||
psp.dwFlags = PSP_DEFAULT;
|
||||
psp.hInstance = GetModuleHandleW(NULL);
|
||||
psp.pszTemplate = MAKEINTRESOURCEW(1);
|
||||
psp.pfnDlgProc = Page1DlgProc;
|
||||
hpsp[0] = (*pCreatePropertySheetPageW)(&psp);
|
||||
ok(hpsp[0] != NULL, "hpsp[0] was NULL.\n");
|
||||
|
||||
ZeroMemory(&header, sizeof(header));
|
||||
header.dwSize = sizeof(header);
|
||||
header.dwFlags = 0;
|
||||
header.hInstance = GetModuleHandleW(NULL);
|
||||
header.hwndParent = NULL;
|
||||
header.nPages = ARRAYSIZE(hpsp);
|
||||
header.phpage = hpsp;
|
||||
header.pszCaption = L"propsheet";
|
||||
ok((*pPropertySheetW)(&header) > 0, "PropertySheet returned non-positive value.\n");
|
||||
|
||||
FreeLibrary(hComCtl32);
|
||||
}
|
|
@ -2,11 +2,13 @@
|
|||
#include <apitest.h>
|
||||
|
||||
extern void func_button(void);
|
||||
extern void func_propsheet(void);
|
||||
extern void func_toolbar(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "buttonv6", func_button },
|
||||
{ "propsheetv6", func_propsheet },
|
||||
{ "toolbarv6", func_toolbar },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue