ReactOS 0.4.16-dev-197-g92996da
propsheet.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Test for v6 property sheet
5 * COPYRIGHT: Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
6 */
7
8#include "wine/test.h"
9#include <windows.h>
10#include <windowsx.h>
11#include <commctrl.h>
12#include <prsht.h>
13
14#define IDC_APPLY_BUTTON 12321
15
17
19{
21 SetDlgItemTextW(hwnd, edt1, L"text");
22 SetTimer(hwnd, 999, 300, NULL);
23 return TRUE;
24}
25
26static void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
27{
28 switch (id)
29 {
30 case IDOK:
31 case IDCANCEL:
32 EndDialog(hwnd, id);
33 break;
34 case edt1:
35 if (codeNotify == EN_CHANGE)
36 {
39 }
40 break;
41 }
42}
43
44static void OnTimer(HWND hwnd, UINT id)
45{
46 HWND hwndParent, hwndApply;
47
48 KillTimer(hwnd, id);
49
51
54 ok_int(IsWindowEnabled(hwndApply), FALSE);
55
57 ok_int(IsWindowEnabled(hwndApply), TRUE);
58
60 ok_int(IsWindowEnabled(hwndApply), FALSE);
61
63}
64
65static INT_PTR CALLBACK
67{
68 switch (uMsg)
69 {
73 }
74 return 0;
75}
76
77#ifdef _MSC_VER
78#define CHECK_STRUCT_SIZE(x, y) C_ASSERT((x) == (y))
79#else
80// Can't do this compile time, thanks gcc
81// 'error: non-nested function with variably modified type'
82#define CHECK_STRUCT_SIZE(x, y) ok((x) == (y), "Wrong size for %s, got %u, expected %u\n", #x, y, x)
83#endif
84
85// Validate struct sizes
86static void test_StructSizes()
87{
88#ifdef _M_X64
95
102#else
109
116#endif
117}
118
123
124// Show that the Apply button is not enabled by default
126{
127 PROPSHEETPAGEW psp = {0};
129 HPROPSHEETPAGE hpsp[1];
130
131 psp.dwSize = sizeof(psp);
132 psp.dwFlags = PSP_DEFAULT;
136 hpsp[0] = pCreatePropertySheetPageW(&psp);
137 ok(hpsp[0] != NULL, "hpsp[0] was NULL.\n");
138
139 header.dwSize = sizeof(header);
140 header.dwFlags = 0;
141 header.hInstance = GetModuleHandleW(NULL);
142 header.hwndParent = NULL;
143 header.nPages = ARRAYSIZE(hpsp);
144 header.phpage = hpsp;
145 header.pszCaption = L"propsheet";
146 ok(pPropertySheetW(&header) > 0, "PropertySheet returned non-positive value.\n");
147}
148
149
150START_TEST(propsheet)
151{
152 HMODULE hComCtl32;
153
154 hComCtl32 = LoadLibraryW(L"comctl32.dll");
155 pCreatePropertySheetPageW = (FN_CreatePropertySheetPageW)GetProcAddress(hComCtl32, "CreatePropertySheetPageW");
156 pPropertySheetW = (FN_PropertySheetW)GetProcAddress(hComCtl32, "PropertySheetW");
157
158 ok(pCreatePropertySheetPageW != NULL, "pCreatePropertySheetPageW was NULL.\n");
159 ok(pPropertySheetW != NULL, "pPropertySheetW was NULL.\n");
160
162 {
163 skip("!pCreatePropertySheetPageW || !pPropertySheetW\n");
164 return;
165 }
166
169
170 FreeLibrary(hComCtl32);
171}
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define ok_int(expression, result)
Definition: atltest.h:134
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define IDC_APPLY_BUTTON
Definition: comctl32.h:54
static HWND hwndParent
Definition: cryptui.c:300
#define edt1
Definition: dlgs.h:65
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define CALLBACK
Definition: compat.h:35
#define LoadLibraryW(x)
Definition: compat.h:747
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
Definition: propsheet.c:18
HPROPSHEETPAGE(WINAPI * FN_CreatePropertySheetPageW)(LPCPROPSHEETPAGEW)
Definition: propsheet.c:119
static INT_PTR CALLBACK Page1DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: propsheet.c:66
static void OnTimer(HWND hwnd, UINT id)
Definition: propsheet.c:44
static BOOL s_bNotified
Definition: propsheet.c:16
static FN_PropertySheetW pPropertySheetW
Definition: propsheet.c:122
#define CHECK_STRUCT_SIZE(x, y)
Definition: propsheet.c:82
static FN_CreatePropertySheetPageW pCreatePropertySheetPageW
Definition: propsheet.c:121
static void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
Definition: propsheet.c:26
static void test_ApplyButtonDisabled()
Definition: propsheet.c:125
static void test_StructSizes()
Definition: propsheet.c:86
int(WINAPI * FN_PropertySheetW)(LPCPROPSHEETHEADERW)
Definition: propsheet.c:120
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
#define PROPSHEETPAGEA_V2_SIZE
Definition: prsht.h:210
#define PROPSHEETHEADERA_V1_SIZE
Definition: prsht.h:290
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PropSheet_PressButton(d, i)
Definition: prsht.h:348
#define PROPSHEETPAGEA_V1_SIZE
Definition: prsht.h:209
#define PROPSHEETPAGEW_V2_SIZE
Definition: prsht.h:247
#define PSP_DEFAULT
Definition: prsht.h:22
#define PropSheet_UnChanged(d, w)
Definition: prsht.h:358
#define PROPSHEETPAGEA_V4_SIZE
Definition: prsht.h:212
#define PROPSHEETPAGEA_V3_SIZE
Definition: prsht.h:211
#define PROPSHEETHEADERW_V2_SIZE
Definition: prsht.h:326
#define PROPSHEETPAGEW_V3_SIZE
Definition: prsht.h:248
#define PROPSHEETPAGEW_V4_SIZE
Definition: prsht.h:249
const PROPSHEETHEADERW * LPCPROPSHEETHEADERW
Definition: prsht.h:324
#define PROPSHEETHEADERA_V2_SIZE
Definition: prsht.h:291
#define PSBTN_OK
Definition: prsht.h:149
#define PROPSHEETPAGEW_V1_SIZE
Definition: prsht.h:246
const PROPSHEETPAGEW * LPCPROPSHEETPAGEW
Definition: prsht.h:245
#define PROPSHEETHEADERW_V1_SIZE
Definition: prsht.h:325
DLGPROC pfnDlgProc
Definition: prsht.h:226
DWORD dwSize
Definition: prsht.h:214
DWORD dwFlags
Definition: prsht.h:215
LPCWSTR pszTemplate
Definition: prsht.h:218
HINSTANCE hInstance
Definition: prsht.h:216
int32_t INT_PTR
Definition: typedefs.h:64
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define HANDLE_MSG(hwnd, message, fn)
Definition: windowsx.h:322
#define IDCANCEL
Definition: winuser.h:834
#define WM_COMMAND
Definition: winuser.h:1743
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_INITDIALOG
Definition: winuser.h:1742
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:833
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_TIMER
Definition: winuser.h:1745
BOOL WINAPI IsWindowEnabled(_In_ HWND)
HWND WINAPI GetParent(_In_ HWND)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define EN_CHANGE
Definition: winuser.h:2025