From: Katayama Hirofumi MZ Date: Sun, 18 Aug 2019 09:53:37 +0000 (+0900) Subject: [COMCTL32_APITEST] Add propsheetv6 testcase (#1853) X-Git-Tag: 0.4.14-dev~303 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=fce898063ecdcdaea81045a8a3f7c1526c412170 [COMCTL32_APITEST] Add propsheetv6 testcase (#1853) The proof of #1842. Property sheet does unchange the page after WM_INITDIALOG. CORE-16280 --- diff --git a/modules/rostests/apitests/comctl32/CMakeLists.txt b/modules/rostests/apitests/comctl32/CMakeLists.txt index 88f45e91527..d3d11b9be77 100644 --- a/modules/rostests/apitests/comctl32/CMakeLists.txt +++ b/modules/rostests/apitests/comctl32/CMakeLists.txt @@ -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) diff --git a/modules/rostests/apitests/comctl32/comctl32_apitest.rc b/modules/rostests/apitests/comctl32/comctl32_apitest.rc index 8cfe8183739..67723069d77 100644 --- a/modules/rostests/apitests/comctl32/comctl32_apitest.rc +++ b/modules/rostests/apitests/comctl32/comctl32_apitest.rc @@ -7,3 +7,15 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include 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 +} diff --git a/modules/rostests/apitests/comctl32/propsheet.c b/modules/rostests/apitests/comctl32/propsheet.c new file mode 100644 index 00000000000..9daf5b0a401 --- /dev/null +++ b/modules/rostests/apitests/comctl32/propsheet.c @@ -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 +#include +#include +#include + +#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); +} diff --git a/modules/rostests/apitests/comctl32/testlist.c b/modules/rostests/apitests/comctl32/testlist.c index a1d535d1de6..da44fe7e3fb 100644 --- a/modules/rostests/apitests/comctl32/testlist.c +++ b/modules/rostests/apitests/comctl32/testlist.c @@ -2,11 +2,13 @@ #include 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 } };