Reactos

[COMCTL32_APITEST] Add propsheetv6 testcase (#1853)

The proof of #1842. Property sheet does unchange the page after WM_INITDIALOG. CORE-16280

authored by

Katayama Hirofumi MZ and committed by
GitHub
fce89806 2fbff737

+136 -1
+1 -1
modules/rostests/apitests/comctl32/CMakeLists.txt
··· 1 1 2 - add_executable(comctl32_apitest button.c toolbar.c testlist.c ../include/msgtrace.c comctl32_apitest.rc) 2 + add_executable(comctl32_apitest button.c propsheet.c toolbar.c testlist.c ../include/msgtrace.c comctl32_apitest.rc) 3 3 target_link_libraries(comctl32_apitest wine) 4 4 set_module_type(comctl32_apitest win32cui) 5 5 add_importlibs(comctl32_apitest uxtheme comctl32 user32 gdi32 msvcrt kernel32 ntdll)
+12
modules/rostests/apitests/comctl32/comctl32_apitest.rc
··· 7 7 #include <reactos/manifest_exe.rc> 8 8 9 9 5 BITMAP "test.bmp" 10 + 11 + LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT 12 + 13 + 1 DIALOG 0, 0, 171, 82 14 + CAPTION "propsheet page1" 15 + STYLE DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION 16 + FONT 9, "MS Shell Dlg" 17 + { 18 + EDITTEXT edt1, 29, 22, 60, 14 19 + DEFPUSHBUTTON "OK", IDOK, 25, 60, 60, 14 20 + PUSHBUTTON "Cancel", IDCANCEL, 96, 60, 60, 14 21 + }
+121
modules/rostests/apitests/comctl32/propsheet.c
··· 1 + /* 2 + * PROJECT: ReactOS api tests 3 + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) 4 + * PURPOSE: Test for property sheet 5 + * COPYRIGHT: Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com) 6 + */ 7 + #include "wine/test.h" 8 + #include <windows.h> 9 + #include <windowsx.h> 10 + #include <commctrl.h> 11 + #include <prsht.h> 12 + 13 + #define IDC_APPLY_BUTTON 12321 14 + 15 + static BOOL s_bNotified; 16 + 17 + static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) 18 + { 19 + s_bNotified = FALSE; 20 + SetDlgItemTextW(hwnd, edt1, L"text"); 21 + SetTimer(hwnd, 999, 300, NULL); 22 + return TRUE; 23 + } 24 + 25 + static void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) 26 + { 27 + switch (id) 28 + { 29 + case IDOK: 30 + case IDCANCEL: 31 + EndDialog(hwnd, id); 32 + break; 33 + case edt1: 34 + if (codeNotify == EN_CHANGE) 35 + { 36 + s_bNotified = TRUE; 37 + PropSheet_Changed(GetParent(hwnd), hwnd); 38 + } 39 + break; 40 + } 41 + } 42 + 43 + static void OnTimer(HWND hwnd, UINT id) 44 + { 45 + HWND hwndParent, hwndApply; 46 + 47 + KillTimer(hwnd, id); 48 + 49 + ok_int(s_bNotified, TRUE); 50 + 51 + hwndParent = GetParent(hwnd); 52 + hwndApply = GetDlgItem(hwndParent, IDC_APPLY_BUTTON); 53 + ok_int(IsWindowEnabled(hwndApply), FALSE); 54 + 55 + PropSheet_Changed(hwndParent, hwnd); 56 + ok_int(IsWindowEnabled(hwndApply), TRUE); 57 + 58 + PropSheet_UnChanged(hwndParent, hwnd); 59 + ok_int(IsWindowEnabled(hwndApply), FALSE); 60 + 61 + PropSheet_PressButton(hwndParent, PSBTN_OK); 62 + } 63 + 64 + static INT_PTR CALLBACK 65 + Page1DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 66 + { 67 + switch (uMsg) 68 + { 69 + HANDLE_MSG(hwnd, WM_INITDIALOG, OnInitDialog); 70 + HANDLE_MSG(hwnd, WM_COMMAND, OnCommand); 71 + HANDLE_MSG(hwnd, WM_TIMER, OnTimer); 72 + } 73 + return 0; 74 + } 75 + 76 + typedef HPROPSHEETPAGE (WINAPI *FN_CreatePropertySheetPageW)(LPCPROPSHEETPAGEW); 77 + typedef int (WINAPI *FN_PropertySheetW)(LPCPROPSHEETHEADERW); 78 + 79 + START_TEST(propsheet) 80 + { 81 + PROPSHEETPAGEW psp; 82 + PROPSHEETHEADERW header; 83 + HPROPSHEETPAGE hpsp[1]; 84 + HMODULE hComCtl32; 85 + FN_CreatePropertySheetPageW pCreatePropertySheetPageW; 86 + FN_PropertySheetW pPropertySheetW; 87 + 88 + hComCtl32 = LoadLibraryW(L"comctl32.dll"); 89 + pCreatePropertySheetPageW = (FN_CreatePropertySheetPageW)GetProcAddress(hComCtl32, "CreatePropertySheetPageW"); 90 + pPropertySheetW = (FN_PropertySheetW)GetProcAddress(hComCtl32, "PropertySheetW"); 91 + 92 + ok(pCreatePropertySheetPageW != NULL, "pCreatePropertySheetPageW was NULL.\n"); 93 + ok(pPropertySheetW != NULL, "pPropertySheetW was NULL.\n"); 94 + 95 + if (!pCreatePropertySheetPageW || !pPropertySheetW) 96 + { 97 + skip("!pCreatePropertySheetPageW || !pPropertySheetW\n"); 98 + return; 99 + } 100 + 101 + ZeroMemory(&psp, sizeof(psp)); 102 + psp.dwSize = sizeof(psp); 103 + psp.dwFlags = PSP_DEFAULT; 104 + psp.hInstance = GetModuleHandleW(NULL); 105 + psp.pszTemplate = MAKEINTRESOURCEW(1); 106 + psp.pfnDlgProc = Page1DlgProc; 107 + hpsp[0] = (*pCreatePropertySheetPageW)(&psp); 108 + ok(hpsp[0] != NULL, "hpsp[0] was NULL.\n"); 109 + 110 + ZeroMemory(&header, sizeof(header)); 111 + header.dwSize = sizeof(header); 112 + header.dwFlags = 0; 113 + header.hInstance = GetModuleHandleW(NULL); 114 + header.hwndParent = NULL; 115 + header.nPages = ARRAYSIZE(hpsp); 116 + header.phpage = hpsp; 117 + header.pszCaption = L"propsheet"; 118 + ok((*pPropertySheetW)(&header) > 0, "PropertySheet returned non-positive value.\n"); 119 + 120 + FreeLibrary(hComCtl32); 121 + }
+2
modules/rostests/apitests/comctl32/testlist.c
··· 2 2 #include <apitest.h> 3 3 4 4 extern void func_button(void); 5 + extern void func_propsheet(void); 5 6 extern void func_toolbar(void); 6 7 7 8 const struct test winetest_testlist[] = 8 9 { 9 10 { "buttonv6", func_button }, 11 + { "propsheetv6", func_propsheet }, 10 12 { "toolbarv6", func_toolbar }, 11 13 { 0, 0 } 12 14 };