ReactOS 0.4.15-dev-7788-g1ad9096
propsheet.c File Reference
#include <windows.h>
#include <commctrl.h>
#include "msg.h"
#include "resources.h"
#include "wine/test.h"
Include dependency graph for propsheet.c:

Go to the source code of this file.

Classes

struct  custom_proppage
 

Macros

#define IDC_APPLY_BUTTON   12321
 
#define RECEIVER_SHEET_CALLBACK   0
 
#define RECEIVER_SHEET_WINPROC   1
 
#define RECEIVER_PAGE   2
 
#define NUM_MSG_SEQUENCES   1
 
#define PROPSHEET_SEQ_INDEX   0
 
#define X(f)   p##f = (void*)GetProcAddress(hComCtl32, #f);
 

Functions

static HPROPSHEETPAGE (WINAPI *pCreatePropertySheetPageA)(const PROPSHEETPAGEA *desc)
 
static BOOL (WINAPI *pDestroyPropertySheetPage)(HPROPSHEETPAGE proppage)
 
static INT_PTR (WINAPI *pPropertySheetA)(const PROPSHEETHEADERA *header)
 
static void detect_locale (void)
 
static void flush_events (void)
 
static int CALLBACK sheet_callback (HWND hwnd, UINT msg, LPARAM lparam)
 
static INT_PTR CALLBACK page_dlg_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_title (void)
 
static void test_nopage (void)
 
static int CALLBACK disableowner_callback (HWND hwnd, UINT msg, LPARAM lparam)
 
static void register_parent_wnd_class (void)
 
static void test_disableowner (void)
 
static INT_PTR CALLBACK nav_page_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT CALLBACK new_nav_dialog_proc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
static LRESULT CALLBACK hook_proc (int code, WPARAM wp, LPARAM lp)
 
static void test_wiznavigation (void)
 
static void test_buttons (void)
 
static INT_PTR CALLBACK page_with_custom_default_button_dlg_proc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_custom_default_button (void)
 
static void save_message (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, INT receiver)
 
static LRESULT CALLBACK sheet_callback_messages_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static int CALLBACK sheet_callback_messages (HWND hwnd, UINT msg, LPARAM lParam)
 
static INT_PTR CALLBACK page_dlg_proc_messages (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_messages (void)
 
static void test_PSM_ADDPAGE (void)
 
static void test_PSM_INSERTPAGE (void)
 
static UINT CALLBACK proppage_callback_a (HWND hwnd, UINT msg, PROPSHEETPAGEA *psp)
 
static UINT CALLBACK proppage_callback_w (HWND hwnd, UINT msg, PROPSHEETPAGEW *psp)
 
static void test_CreatePropertySheetPage (void)
 
static void test_bad_control_class (void)
 
static void init_functions (void)
 
 START_TEST (propsheet)
 

Variables

static HWND parenthwnd
 
static HWND sheethwnd
 
static BOOL rtl
 
static LONG active_page = -1
 
static WNDPROC old_nav_dialog_proc
 
static BOOL add_button_has_been_pressed
 
static struct msg_sequencesequences [NUM_MSG_SEQUENCES]
 
static WNDPROC oldWndProc
 
static const struct message property_sheet_seq []
 

Macro Definition Documentation

◆ IDC_APPLY_BUTTON

#define IDC_APPLY_BUTTON   12321

Definition at line 39 of file propsheet.c.

◆ NUM_MSG_SEQUENCES

#define NUM_MSG_SEQUENCES   1

Definition at line 633 of file propsheet.c.

◆ PROPSHEET_SEQ_INDEX

#define PROPSHEET_SEQ_INDEX   0

Definition at line 634 of file propsheet.c.

◆ RECEIVER_PAGE

#define RECEIVER_PAGE   2

Definition at line 631 of file propsheet.c.

◆ RECEIVER_SHEET_CALLBACK

#define RECEIVER_SHEET_CALLBACK   0

Definition at line 629 of file propsheet.c.

◆ RECEIVER_SHEET_WINPROC

#define RECEIVER_SHEET_WINPROC   1

Definition at line 630 of file propsheet.c.

◆ X

#define X (   f)    p##f = (void*)GetProcAddress(hComCtl32, #f);

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pDestroyPropertySheetPage)
static

◆ detect_locale()

static void detect_locale ( void  )
static

Definition at line 46 of file propsheet.c.

47{
48 DWORD reading_layout;
50 (void *)&reading_layout, sizeof(reading_layout)) && reading_layout == 1;
51}
unsigned long DWORD
Definition: ntddk_ex.h:95
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1108
static BOOL rtl
Definition: propsheet.c:36
#define LOCALE_USER_DEFAULT
#define LOCALE_IREADINGLAYOUT
Definition: winnls.h:155

Referenced by START_TEST().

◆ disableowner_callback()

static int CALLBACK disableowner_callback ( HWND  hwnd,
UINT  msg,
LPARAM  lparam 
)
static

Definition at line 221 of file propsheet.c.

222{
223 switch(msg)
224 {
225 case PSCB_INITIALIZED:
226 {
227 ok(IsWindowEnabled(parenthwnd) == 0, "parent window should be disabled\n");
229 return FALSE;
230 }
231 }
232 return FALSE;
233}
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
#define FALSE
Definition: types.h:117
static HWND parenthwnd
Definition: propsheet.c:33
#define PSCB_INITIALIZED
Definition: prsht.h:75
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
BOOL WINAPI IsWindowEnabled(_In_ HWND)

Referenced by test_disableowner().

◆ flush_events()

static void flush_events ( void  )
static

Definition at line 54 of file propsheet.c.

55{
56 MSG msg;
57 int diff = 200;
58 int min_timeout = 100;
59 DWORD time = GetTickCount() + diff;
60
61 while (diff > 0)
62 {
63 if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
64 while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
65 diff = time - GetTickCount();
66 }
67}
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define NULL
Definition: types.h:112
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
__u16 time
Definition: mkdosfs.c:8
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define QS_ALLINPUT
Definition: winuser.h:903
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define PM_REMOVE
Definition: winuser.h:1196
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)

Referenced by test_nopage().

◆ hook_proc()

static LRESULT CALLBACK hook_proc ( int  code,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 325 of file propsheet.c.

326{
327 static BOOL done;
328 if (code == HCBT_CREATEWND)
329 {
331
332 /* The first dialog created will be the parent dialog */
333 if (!done && c->lpcs->lpszClass == (LPWSTR)WC_DIALOG)
334 {
336 done = TRUE;
337 }
338 }
339
340 return CallNextHookEx( NULL, code, wp, lp );
341}
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
const GLubyte * c
Definition: glext.h:8905
static WNDPROC old_nav_dialog_proc
Definition: propsheet.c:312
static LRESULT CALLBACK new_nav_dialog_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
Definition: propsheet.c:314
Definition: inflate.c:139
#define LONG_PTR
Definition: treelist.c:79
#define GWLP_WNDPROC
Definition: treelist.c:66
#define WC_DIALOG
Definition: undocuser.h:11
#define HCBT_CREATEWND
Definition: winuser.h:58
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
#define SetWindowLongPtrW
Definition: winuser.h:5346
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by test_wiznavigation().

◆ HPROPSHEETPAGE()

static HPROPSHEETPAGE ( WINAPI pCreatePropertySheetPageA) const
static

◆ init_functions()

static void init_functions ( void  )
static

Definition at line 1189 of file propsheet.c.

1190{
1191 HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
1192
1193#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
1198#undef X
1199}
INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh)
Definition: propsheet.c:2872
HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage)
Definition: propsheet.c:3083
HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(LPCPROPSHEETPAGEA lpPropSheetPage)
Definition: propsheet.c:2999
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3152
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define X(f)

Referenced by START_TEST().

◆ INT_PTR()

static INT_PTR ( WINAPI pPropertySheetA) const
static

◆ nav_page_proc()

static INT_PTR CALLBACK nav_page_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 288 of file propsheet.c.

289{
290 switch(msg){
291 case WM_NOTIFY:
292 {
294 switch(hdr->code){
295 case PSN_SETACTIVE:
296 active_page = /* PropSheet_HwndToIndex(hdr->hwndFrom, hwnd); */
297 (int)SendMessageA(hdr->hwndFrom, PSM_HWNDTOINDEX, (WPARAM)hwnd, 0);
298 return TRUE;
299 case PSN_KILLACTIVE:
300 /* prevent navigation away from the fourth page */
301 if(active_page == 3){
303 return TRUE;
304 }
305 }
306 break;
307 }
308 }
309 return FALSE;
310}
@ lparam
Definition: SystemMenu.c:31
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
char hdr[14]
Definition: iptest.cpp:33
static LONG active_page
Definition: propsheet.c:37
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define PSN_SETACTIVE
Definition: prsht.h:115
#define WM_NOTIFY
Definition: richedit.h:61
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
UINT_PTR WPARAM
Definition: windef.h:207
#define SetWindowLongPtrA
Definition: winuser.h:5345
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct tagNMHDR * LPNMHDR
#define DWLP_MSGRESULT
Definition: winuser.h:870

Referenced by test_wiznavigation().

◆ new_nav_dialog_proc()

static LRESULT CALLBACK new_nav_dialog_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 314 of file propsheet.c.

315{
316 switch (msg)
317 {
318 case DM_SETDEFID:
319 ok( IsWindowEnabled( GetDlgItem(hwnd, wp) ), "button is not enabled\n" );
320 break;
321 }
322 return CallWindowProcW( old_nav_dialog_proc, hwnd, msg, wp, lp );
323}
#define DM_SETDEFID
Definition: winuser.h:2099
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by hook_proc().

◆ page_dlg_proc()

static INT_PTR CALLBACK page_dlg_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 101 of file propsheet.c.

103{
104 switch(msg)
105 {
106 case WM_INITDIALOG:
107 {
108 HWND sheet = GetParent(hwnd);
109 char caption[256];
110 GetWindowTextA(sheet, caption, sizeof(caption));
111 ok(!strcmp(caption,"test caption"), "caption: %s\n", caption);
112 return TRUE;
113 }
114
115 case WM_NOTIFY:
116 {
117 NMHDR *nmhdr = (NMHDR *)lparam;
118 switch(nmhdr->code)
119 {
120 case PSN_APPLY:
121 return TRUE;
122 default:
123 return FALSE;
124 }
125 }
126 case WM_NCDESTROY:
127 ok(!SendMessageA(sheethwnd, PSM_INDEXTOHWND, 400, 0),"Should always be 0\n");
128 return TRUE;
129
130 default:
131 return FALSE;
132 }
133}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static HWND sheethwnd
Definition: propsheet.c:34
#define PSN_APPLY
Definition: prsht.h:117
UINT code
Definition: winuser.h:3159
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1330
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetParent(_In_ HWND)
#define WM_NCDESTROY
Definition: winuser.h:1684

Referenced by test_bad_control_class(), test_buttons(), test_nopage(), and test_title().

◆ page_dlg_proc_messages()

static INT_PTR CALLBACK page_dlg_proc_messages ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 782 of file propsheet.c.

784{
786
787 return FALSE;
788}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static void save_message(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, INT receiver)
Definition: propsheet.c:735
#define RECEIVER_PAGE
Definition: propsheet.c:631

Referenced by test_CreatePropertySheetPage(), test_messages(), test_PSM_ADDPAGE(), and test_PSM_INSERTPAGE().

◆ page_with_custom_default_button_dlg_proc()

static INT_PTR CALLBACK page_with_custom_default_button_dlg_proc ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 543 of file propsheet.c.

544{
545 switch (msg)
546 {
547 case WM_COMMAND:
548 switch(LOWORD(wparam))
549 {
551 switch(HIWORD(wparam))
552 {
553 case BN_CLICKED:
555 return TRUE;
556 }
557 break;
558 }
559 break;
560 }
561 return FALSE;
562}
@ wparam
Definition: SystemMenu.c:30
static BOOL add_button_has_been_pressed
Definition: propsheet.c:540
#define IDC_PS_PUSHBUTTON1
Definition: resources.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_COMMAND
Definition: winuser.h:1740
#define BN_CLICKED
Definition: winuser.h:1925

Referenced by test_custom_default_button().

◆ proppage_callback_a()

static UINT CALLBACK proppage_callback_a ( HWND  hwnd,
UINT  msg,
PROPSHEETPAGEA psp 
)
static

Definition at line 1025 of file propsheet.c.

1026{
1027 struct custom_proppage *cpage = (struct custom_proppage *)psp->lParam;
1028 PROPSHEETPAGEA *psp_orig = &cpage->u.pageA;
1029
1030 ok(hwnd == NULL, "Expected NULL hwnd, got %p\n", hwnd);
1031
1032 ok(psp->lParam && psp->lParam != (LPARAM)psp, "Expected newly allocated page description, got %lx, %p\n",
1033 psp->lParam, psp);
1034 ok(psp_orig->pszTitle == psp->pszTitle, "Expected same page title pointer\n");
1035 ok(!lstrcmpA(psp_orig->pszTitle, psp->pszTitle), "Expected same page title string\n");
1036
1037 switch (msg)
1038 {
1039 case PSPCB_ADDREF:
1040 ok(psp->dwSize > PROPSHEETPAGEA_V1_SIZE, "Expected ADDREF for V2+ only, got size %u\n", psp->dwSize);
1041 cpage->addref_called++;
1042 break;
1043 case PSPCB_RELEASE:
1044 ok(psp->dwSize >= PROPSHEETPAGEA_V1_SIZE, "Unexpected RELEASE, got size %u\n", psp->dwSize);
1045 cpage->release_called++;
1046 break;
1047 default:
1048 ok(0, "Unexpected message %u\n", msg);
1049 }
1050
1051 return 1;
1052}
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
#define PROPSHEETPAGEA_V1_SIZE
Definition: prsht.h:209
#define PSPCB_ADDREF
Definition: prsht.h:171
#define PSPCB_RELEASE
Definition: prsht.h:37
LPARAM lParam
Definition: prsht.h:190
DWORD dwSize
Definition: prsht.h:177
LPCSTR pszTitle
Definition: prsht.h:188
unsigned int release_called
Definition: propsheet.c:1022
unsigned int addref_called
Definition: propsheet.c:1021
PROPSHEETPAGEA pageA
Definition: propsheet.c:1018
union custom_proppage::@1640 u
LONG_PTR LPARAM
Definition: windef.h:208

Referenced by test_CreatePropertySheetPage().

◆ proppage_callback_w()

static UINT CALLBACK proppage_callback_w ( HWND  hwnd,
UINT  msg,
PROPSHEETPAGEW psp 
)
static

Definition at line 1054 of file propsheet.c.

1055{
1056 struct custom_proppage *cpage = (struct custom_proppage *)psp->lParam;
1057 PROPSHEETPAGEW *psp_orig = &cpage->u.pageW;
1058
1059 ok(hwnd == NULL, "Expected NULL hwnd, got %p\n", hwnd);
1060 ok(psp->lParam && psp->lParam != (LPARAM)psp, "Expected newly allocated page description, got %lx, %p\n",
1061 psp->lParam, psp);
1062 ok(psp_orig->pszTitle == psp->pszTitle, "Expected same page title pointer\n");
1063 ok(!lstrcmpW(psp_orig->pszTitle, psp->pszTitle), "Expected same page title string\n");
1064
1065 switch (msg)
1066 {
1067 case PSPCB_ADDREF:
1068 ok(psp->dwSize > PROPSHEETPAGEW_V1_SIZE, "Expected ADDREF for V2+ only, got size %u\n", psp->dwSize);
1069 cpage->addref_called++;
1070 break;
1071 case PSPCB_RELEASE:
1072 ok(psp->dwSize >= PROPSHEETPAGEW_V1_SIZE, "Unexpected RELEASE, got size %u\n", psp->dwSize);
1073 cpage->release_called++;
1074 break;
1075 default:
1076 ok(0, "Unexpected message %u\n", msg);
1077 }
1078
1079 return 1;
1080}
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define PROPSHEETPAGEW_V1_SIZE
Definition: prsht.h:246
DWORD dwSize
Definition: prsht.h:214
LPARAM lParam
Definition: prsht.h:227
LPCWSTR pszTitle
Definition: prsht.h:225
PROPSHEETPAGEW pageW
Definition: propsheet.c:1019

Referenced by test_CreatePropertySheetPage().

◆ register_parent_wnd_class()

static void register_parent_wnd_class ( void  )
static

Definition at line 235 of file propsheet.c.

236{
237 WNDCLASSA cls;
238
239 cls.style = 0;
241 cls.cbClsExtra = 0;
242 cls.cbWndExtra = 0;
244 cls.hIcon = 0;
247 cls.lpszMenuName = NULL;
248 cls.lpszClassName = "parent class";
249 RegisterClassA(&cls);
250}
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HBRUSH hbrBackground
Definition: winuser.h:3170
HICON hIcon
Definition: winuser.h:3168
HINSTANCE hInstance
Definition: winuser.h:3167
HCURSOR hCursor
Definition: winuser.h:3169
int cbWndExtra
Definition: winuser.h:3166
UINT style
Definition: winuser.h:3163
LPCSTR lpszMenuName
Definition: winuser.h:3171
LPCSTR lpszClassName
Definition: winuser.h:3172
WNDPROC lpfnWndProc
Definition: winuser.h:3164
int cbClsExtra
Definition: winuser.h:3165
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:902
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_ARROW
Definition: winuser.h:687
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2090
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by test_disableowner().

◆ save_message()

static void save_message ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
INT  receiver 
)
static

Definition at line 735 of file propsheet.c.

736{
737 struct message msg = { 0 };
738
739 if (message < WM_USER &&
740 message != WM_GETICON &&
741 message != WM_GETTEXT &&
744 message != WM_PAINT &&
747 (message < WM_NCCREATE || message > WM_NCMBUTTONDBLCLK) &&
748 (message < WM_MOUSEFIRST || message > WM_MOUSEHWHEEL) &&
749 message != 0x90)
750 {
751 msg.message = message;
752 msg.flags = sent|wparam|lparam|id;
753 msg.wParam = wParam;
754 msg.lParam = lParam;
755 msg.id = receiver;
757 }
758}
@ sent
Definition: SystemMenu.c:27
#define add_message(msg)
Definition: SystemMenu.c:98
GLuint id
Definition: glext.h:5910
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: propsheet.c:636
#define PROPSHEET_SEQ_INDEX
Definition: propsheet.c:634
Definition: tftpd.h:60
UINT message
Definition: SystemMenu.c:42
#define WM_PAINT
Definition: winuser.h:1620
#define WM_ERASEBKGND
Definition: winuser.h:1625
#define WM_IME_NOTIFY
Definition: winuser.h:1830
#define WM_GETTEXT
Definition: winuser.h:1618
#define WM_IME_SETCONTEXT
Definition: winuser.h:1829
#define WM_SETCURSOR
Definition: winuser.h:1636
#define WM_USER
Definition: winuser.h:1895
#define WM_NCMBUTTONDBLCLK
Definition: winuser.h:1700

Referenced by page_dlg_proc_messages(), sheet_callback_messages(), and sheet_callback_messages_proc().

◆ sheet_callback()

static int CALLBACK sheet_callback ( HWND  hwnd,
UINT  msg,
LPARAM  lparam 
)
static

Definition at line 70 of file propsheet.c.

71{
72 switch(msg)
73 {
74 case PSCB_PRECREATE:
75 {
76 HMODULE module = GetModuleHandleA("comctl32.dll");
78 HRSRC hrsrc;
79
80 hrsrc = FindResourceA(module, MAKEINTRESOURCEA(1006 /* IDD_PROPSHEET */),
82 size = SizeofResource(module, hrsrc);
83 ok(size != 0, "Failed to get size of propsheet dialog resource\n");
85 ok(buffer_size == 2 * size, "Unexpected template buffer size %u, resource size %u\n",
87 break;
88 }
90 {
91 char caption[256];
92 GetWindowTextA(hwnd, caption, sizeof(caption));
93 ok(!strcmp(caption,"test caption"), "caption: %s\n", caption);
95 return 0;
96 }
97 }
98 return 0;
99}
#define GetProcessHeap()
Definition: compat.h:736
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
GLsizeiptr size
Definition: glext.h:5919
#define RT_DIALOG
Definition: pedump.c:367
#define PSCB_PRECREATE
Definition: prsht.h:76
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:888
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
char * LPSTR
Definition: xmlstorage.h:182

Referenced by test_buttons(), test_nopage(), and test_title().

◆ sheet_callback_messages()

static int CALLBACK sheet_callback_messages ( HWND  hwnd,
UINT  msg,
LPARAM  lParam 
)
static

Definition at line 767 of file propsheet.c.

768{
770
771 switch (msg)
772 {
773 case PSCB_INITIALIZED:
776 return TRUE;
777 }
778
779 return TRUE;
780}
static WNDPROC oldWndProc
Definition: propsheet.c:637
#define RECEIVER_SHEET_CALLBACK
Definition: propsheet.c:629
static LRESULT CALLBACK sheet_callback_messages_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: propsheet.c:760
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define GetWindowLongPtrA
Definition: winuser.h:4828

Referenced by test_messages().

◆ sheet_callback_messages_proc()

static LRESULT CALLBACK sheet_callback_messages_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 760 of file propsheet.c.

761{
763
765}
#define RECEIVER_SHEET_WINPROC
Definition: propsheet.c:630
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by sheet_callback_messages().

◆ START_TEST()

START_TEST ( propsheet  )

Definition at line 1201 of file propsheet.c.

1202{
1203 detect_locale();
1204 if (rtl)
1205 {
1206 /* use locale-specific RTL resources when on an RTL locale */
1207 /* without this, propsheets on RTL locales use English LTR resources */
1208 trace("RTL locale detected\n");
1210 }
1211
1213
1215 test_title();
1216 test_nopage();
1219 test_buttons();
1221 test_messages();
1225}
#define trace
Definition: atltest.h:70
static void test_custom_default_button(void)
Definition: propsheet.c:564
static void test_CreatePropertySheetPage(void)
Definition: propsheet.c:1082
static void test_messages(void)
Definition: propsheet.c:790
static void test_title(void)
Definition: propsheet.c:135
static void test_disableowner(void)
Definition: propsheet.c:252
static void test_nopage(void)
Definition: propsheet.c:174
static void test_buttons(void)
Definition: propsheet.c:471
static void detect_locale(void)
Definition: propsheet.c:46
static void test_wiznavigation(void)
Definition: propsheet.c:343
static void test_PSM_INSERTPAGE(void)
Definition: propsheet.c:920
static void test_PSM_ADDPAGE(void)
Definition: propsheet.c:830
static void init_functions(void)
Definition: propsheet.c:1189
static void test_bad_control_class(void)
Definition: propsheet.c:1149
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition: window.c:1719
#define LAYOUT_RTL
Definition: wingdi.h:1371

◆ test_bad_control_class()

static void test_bad_control_class ( void  )
static

Definition at line 1149 of file propsheet.c.

1150{
1151 PROPSHEETPAGEA psp;
1152 PROPSHEETHEADERA psh;
1153 HPROPSHEETPAGE hpsp;
1154 INT_PTR ret;
1155
1156 memset(&psp, 0, sizeof(psp));
1157 psp.dwSize = sizeof(psp);
1161
1162 hpsp = pCreatePropertySheetPageA(&psp);
1163 ok(hpsp != 0, "CreatePropertySheetPage failed\n");
1164
1165 memset(&psh, 0, sizeof(psh));
1167 psh.nPages = 1;
1169 U3(psh).phpage = &hpsp;
1170
1171#ifndef __REACTOS__ /* FIXME: Inspect why this causes a hang */
1172 ret = pPropertySheetA(&psh);
1173 ok(ret == 0, "got %ld\n", ret);
1174#endif
1175
1176 /* Need to recreate hpsp otherwise the test fails under Windows */
1177 hpsp = pCreatePropertySheetPageA(&psp);
1178 ok(hpsp != 0, "CreatePropertySheetPage failed\n");
1179 U3(psh).phpage = &hpsp;
1180
1181 psh.dwFlags = PSH_MODELESS;
1182 ret = pPropertySheetA(&psh);
1183 ok(ret != 0, "got %ld\n", ret);
1184
1185 ok(IsWindow((HWND)ret), "bad window handle %#lx\n", ret);
1187}
#define U(x)
Definition: wordpad.c:45
#define U3(x)
Definition: wordpad.c:47
static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: propsheet.c:101
#define IDD_PROP_PAGE_BAD_CONTROL
Definition: resources.h:42
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define PROPSHEETHEADERA_V1_SIZE
Definition: prsht.h:290
#define PSH_MODELESS
Definition: prsht.h:50
#define memset(x, y, z)
Definition: compat.h:39
DWORD dwFlags
Definition: prsht.h:259
DWORD dwSize
Definition: prsht.h:258
HWND hwndParent
Definition: prsht.h:260
HINSTANCE hInstance
Definition: prsht.h:179
DLGPROC pfnDlgProc
Definition: prsht.h:189
int32_t INT_PTR
Definition: typedefs.h:64
int ret
BOOL WINAPI IsWindow(_In_opt_ HWND)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
BOOL WINAPI DestroyWindow(_In_ HWND)
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by START_TEST().

◆ test_buttons()

static void test_buttons ( void  )
static

Definition at line 471 of file propsheet.c.

472{
473 HPROPSHEETPAGE hpsp[1];
474 PROPSHEETPAGEA psp;
476 HWND hdlg;
477 HWND button;
478 RECT rc;
479 int prevRight, top;
480
481 memset(&psp, 0, sizeof(psp));
482 psp.dwSize = sizeof(psp);
483 psp.dwFlags = 0;
485 U(psp).pszTemplate = "prop_page1";
486 U2(psp).pszIcon = NULL;
488 psp.lParam = 0;
489
490 hpsp[0] = pCreatePropertySheetPageA(&psp);
491
492 memset(&psh, 0, sizeof(psh));
495 psh.pszCaption = "test caption";
496 psh.nPages = 1;
498 U3(psh).phpage = hpsp;
500
501 hdlg = (HWND)pPropertySheetA(&psh);
502 ok(hdlg != INVALID_HANDLE_VALUE, "got null handle\n");
503
504 /* OK button */
505 button = GetDlgItem(hdlg, IDOK);
506 GetWindowRect(button, &rc);
507 prevRight = rc.right;
508 top = rc.top;
509
510 /* Cancel button */
511 button = GetDlgItem(hdlg, IDCANCEL);
512 GetWindowRect(button, &rc);
513 ok(rc.top == top, "Cancel button should have same top as OK button\n");
514 if (rtl)
515 ok(rc.left < prevRight, "Cancel button should be to the left of OK button\n");
516 else
517 ok(rc.left > prevRight, "Cancel button should be to the right of OK button\n");
518 prevRight = rc.right;
519
521 GetWindowRect(button, &rc);
522 ok(rc.top == top, "Apply button should have same top as OK button\n");
523 if (rtl)
524 ok(rc.left < prevRight, "Apply button should be to the left of Cancel button\n");
525 else
526 ok(rc.left > prevRight, "Apply button should be to the right of Cancel button\n");
527 prevRight = rc.right;
528
529 button = GetDlgItem(hdlg, IDHELP);
530 GetWindowRect(button, &rc);
531 ok(rc.top == top, "Help button should have same top as OK button\n");
532 if (rtl)
533 ok(rc.left < prevRight, "Help button should be to the left of Apply button\n");
534 else
535 ok(rc.left > prevRight, "Help button should be to the right of Apply button\n");
536
537 DestroyWindow(hdlg);
538}
#define U2(x)
Definition: wordpad.c:46
#define IDC_APPLY_BUTTON
Definition: comctl32.h:54
HANDLE HWND
Definition: compat.h:19
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
DWORD button
Definition: button.c:166
static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
Definition: propsheet.c:70
#define PSH_USECALLBACK
Definition: prsht.h:48
#define IDHELP
Definition: resource_2.h:8
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:276
LPCSTR pszCaption
Definition: prsht.h:266
DWORD dwFlags
Definition: prsht.h:178
LONG right
Definition: windef.h:308
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define IDCANCEL
Definition: winuser.h:831
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define IDOK
Definition: winuser.h:830

Referenced by START_TEST().

◆ test_CreatePropertySheetPage()

static void test_CreatePropertySheetPage ( void  )
static

Definition at line 1082 of file propsheet.c.

1083{
1084 static const WCHAR titleW[] = {'T','i','t','l','e',0};
1085 struct custom_proppage page;
1086 HPROPSHEETPAGE hpsp;
1087 BOOL ret;
1088
1089 memset(&page.u.pageA, 0, sizeof(page.u.pageA));
1090 page.u.pageA.dwFlags = PSP_USECALLBACK;
1091 page.u.pageA.pfnDlgProc = page_dlg_proc_messages;
1092 page.u.pageA.pfnCallback = proppage_callback_a;
1093 page.u.pageA.lParam = (LPARAM)&page;
1094 page.u.pageA.pszTitle = "Title";
1095
1096 /* Only minimal size validation is performed */
1097 for (page.u.pageA.dwSize = PROPSHEETPAGEA_V1_SIZE - 1; page.u.pageA.dwSize <= PROPSHEETPAGEA_V4_SIZE + 1; page.u.pageA.dwSize++)
1098 {
1099 page.addref_called = 0;
1100 hpsp = pCreatePropertySheetPageA(&page.u.pageA);
1101
1102 if (page.u.pageA.dwSize < PROPSHEETPAGEA_V1_SIZE)
1103 ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageA.dwSize);
1104 else
1105 {
1106 ok(hpsp != NULL, "Failed to create a page, size %u\n", page.u.pageA.dwSize);
1107 ok(page.addref_called == (page.u.pageA.dwSize > PROPSHEETPAGEA_V1_SIZE) ? 1 : 0, "Expected ADDREF callback message\n");
1108 }
1109
1110 if (hpsp)
1111 {
1112 page.release_called = 0;
1113 ret = pDestroyPropertySheetPage(hpsp);
1114 ok(ret, "Failed to destroy a page\n");
1115 ok(page.release_called == 1, "Expected RELEASE callback message\n");
1116 }
1117 }
1118
1119 memset(&page.u.pageW, 0, sizeof(page.u.pageW));
1120 page.u.pageW.dwFlags = PSP_USECALLBACK;
1121 page.u.pageW.pfnDlgProc = page_dlg_proc_messages;
1122 page.u.pageW.pfnCallback = proppage_callback_w;
1123 page.u.pageW.lParam = (LPARAM)&page;
1124 page.u.pageW.pszTitle = titleW;
1125
1126 for (page.u.pageW.dwSize = PROPSHEETPAGEW_V1_SIZE - 1; page.u.pageW.dwSize <= PROPSHEETPAGEW_V4_SIZE + 1; page.u.pageW.dwSize++)
1127 {
1128 page.addref_called = 0;
1129 hpsp = pCreatePropertySheetPageW(&page.u.pageW);
1130
1131 if (page.u.pageW.dwSize < PROPSHEETPAGEW_V1_SIZE)
1132 ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageW.dwSize);
1133 else
1134 {
1135 ok(hpsp != NULL, "Failed to create a page, size %u\n", page.u.pageW.dwSize);
1136 ok(page.addref_called == (page.u.pageW.dwSize > PROPSHEETPAGEW_V1_SIZE) ? 1 : 0, "Expected ADDREF callback message\n");
1137 }
1138
1139 if (hpsp)
1140 {
1141 page.release_called = 0;
1142 ret = pDestroyPropertySheetPage(hpsp);
1143 ok(ret, "Failed to destroy a page\n");
1144 ok(page.release_called == 1, "Expected RELEASE callback message\n");
1145 }
1146 }
1147}
static const WCHAR titleW[]
Definition: htmlelem.c:1067
static FN_CreatePropertySheetPageW pCreatePropertySheetPageW
Definition: propsheet.c:121
static UINT CALLBACK proppage_callback_a(HWND hwnd, UINT msg, PROPSHEETPAGEA *psp)
Definition: propsheet.c:1025
static UINT CALLBACK proppage_callback_w(HWND hwnd, UINT msg, PROPSHEETPAGEW *psp)
Definition: propsheet.c:1054
static INT_PTR CALLBACK page_dlg_proc_messages(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: propsheet.c:782
#define PROPSHEETPAGEA_V4_SIZE
Definition: prsht.h:212
#define PROPSHEETPAGEW_V4_SIZE
Definition: prsht.h:249
#define PSP_USECALLBACK
Definition: prsht.h:30
Definition: module.h:576
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ test_custom_default_button()

static void test_custom_default_button ( void  )
static

Definition at line 564 of file propsheet.c.

565{
566 HWND hdlg, page;
567 PROPSHEETPAGEA psp[1];
569 MSG msg;
571
572 psp[0].dwSize = sizeof (PROPSHEETPAGEA);
573 psp[0].dwFlags = PSP_USETITLE;
576 U2(psp[0]).pszIcon = NULL;
578 psp[0].pszTitle = "Page1";
579 psp[0].lParam = 0;
580
585 U(psh).pszIcon = NULL;
586 psh.pszCaption = "PropertySheet1";
587 psh.nPages = 1;
588 U3(psh).ppsp = psp;
589 U2(psh).nStartPage = 0;
590
591 /* The goal of the test is to make sure that the Add button is pressed
592 * when the ENTER key is pressed and a different control, a combobox,
593 * has the keyboard focus. */
595
596 /* Create the modeless property sheet. */
597 hdlg = (HWND)pPropertySheetA(&psh);
598 ok(hdlg != INVALID_HANDLE_VALUE, "Cannot create the property sheet\n");
599
600 /* Set the Add button as the default button. */
602
603 /* Make sure the default button is the Add button. */
604 result = SendMessageA(hdlg, DM_GETDEFID, 0, 0);
605 ok(DC_HASDEFID == HIWORD(result), "The property sheet does not have a default button\n");
606 ok(IDC_PS_PUSHBUTTON1 == LOWORD(result), "The default button is not the Add button\n");
607
608 /* At this point, the combobox should have keyboard focus, so we press ENTER.
609 * Pull the lever, Kronk! */
612
613 /* Process all the messages in the queue for this thread. */
614 while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
615 {
616 /* (!PropSheet_IsDialogMessage(hdlg, &msg)) */
617 if (!((BOOL)SendMessageA(hdlg, PSM_ISDIALOGMESSAGE, 0, (LPARAM)&msg)))
618 {
621 }
622 }
623
624 ok(add_button_has_been_pressed, "The Add button has not been pressed!\n");
625
626 DestroyWindow(hdlg);
627}
GLuint64EXT * result
Definition: glext.h:11304
static INT_PTR CALLBACK page_with_custom_default_button_dlg_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: propsheet.c:543
#define IDD_PROP_PAGE_WITH_CUSTOM_DEFAULT_BUTTON
Definition: resources.h:39
#define IDC_PS_COMBO1
Definition: resources.h:49
#define PSM_ISDIALOGMESSAGE
Definition: prsht.h:96
#define PSP_USETITLE
Definition: prsht.h:26
#define PSM_GETCURRENTPAGEHWND
Definition: prsht.h:81
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
struct _PROPSHEETPAGEA PROPSHEETPAGEA
HINSTANCE hInstance
Definition: prsht.h:261
LONG_PTR LRESULT
Definition: windef.h:209
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DC_HASDEFID
Definition: winuser.h:2609
#define VK_RETURN
Definition: winuser.h:2201
#define WM_KEYDOWN
Definition: winuser.h:1715
#define DM_GETDEFID
Definition: winuser.h:2098
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by START_TEST().

◆ test_disableowner()

static void test_disableowner ( void  )
static

Definition at line 252 of file propsheet.c.

253{
254 HPROPSHEETPAGE hpsp[1];
255 PROPSHEETPAGEA psp;
257 INT_PTR p;
258
260 parenthwnd = CreateWindowA("parent class", "", WS_CAPTION | WS_SYSMENU | WS_VISIBLE, 100, 100, 100, 100, GetDesktopWindow(), NULL, GetModuleHandleA(NULL), 0);
261
262 memset(&psp, 0, sizeof(psp));
263 psp.dwSize = sizeof(psp);
264 psp.dwFlags = 0;
266 U(psp).pszTemplate = "prop_page1";
267 U2(psp).pszIcon = NULL;
268 psp.pfnDlgProc = NULL;
269 psp.lParam = 0;
270
271 hpsp[0] = pCreatePropertySheetPageA(&psp);
272
273 memset(&psh, 0, sizeof(psh));
276 psh.pszCaption = "test caption";
277 psh.nPages = 1;
279 U3(psh).phpage = hpsp;
281
282 p = pPropertySheetA(&psh);
283 ok(p == 0, "Expected 0, got %ld\n", p);
284 ok(IsWindowEnabled(parenthwnd) != 0, "parent window should be enabled\n");
286}
GLfloat GLfloat p
Definition: glext.h:8902
static void register_parent_wnd_class(void)
Definition: propsheet.c:235
static int CALLBACK disableowner_callback(HWND hwnd, UINT msg, LPARAM lparam)
Definition: propsheet.c:221
#define WS_CAPTION
Definition: pedump.c:624
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_VISIBLE
Definition: pedump.c:620
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4315

Referenced by START_TEST().

◆ test_messages()

static void test_messages ( void  )
static

Definition at line 790 of file propsheet.c.

791{
792 HPROPSHEETPAGE hpsp[1];
793 PROPSHEETPAGEA psp;
795 HWND hdlg;
796
798
799 memset(&psp, 0, sizeof(psp));
800 psp.dwSize = sizeof(psp);
801 psp.dwFlags = 0;
804 U2(psp).pszIcon = NULL;
806 psp.lParam = 0;
807
808 hpsp[0] = pCreatePropertySheetPageA(&psp);
809
810 memset(&psh, 0, sizeof(psh));
814 psh.pszCaption = "test caption";
815 psh.nPages = 1;
817 U3(psh).phpage = hpsp;
819
820 hdlg = (HWND)pPropertySheetA(&psh);
821 ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
822
823 ShowWindow(hdlg,SW_NORMAL);
824
825 ok_sequence(sequences, PROPSHEET_SEQ_INDEX, property_sheet_seq, "property sheet with custom window proc", TRUE);
826
827 DestroyWindow(hdlg);
828}
#define ok_sequence(exp, contx, todo)
Definition: SystemMenu.c:275
static void init_msg_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:391
#define NUM_MSG_SEQUENCES
Definition: propsheet.c:633
static const struct message property_sheet_seq[]
Definition: propsheet.c:639
static int CALLBACK sheet_callback_messages(HWND hwnd, UINT msg, LPARAM lParam)
Definition: propsheet.c:767
#define IDD_PROP_PAGE_MESSAGE_TEST
Definition: resources.h:40
#define PSH_USEICONID
Definition: prsht.h:42
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
#define PSH_WIZARD
Definition: prsht.h:45
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SW_NORMAL
Definition: winuser.h:769

Referenced by run_test_(), and START_TEST().

◆ test_nopage()

static void test_nopage ( void  )
static

Definition at line 174 of file propsheet.c.

175{
176 HPROPSHEETPAGE hpsp[1];
177 PROPSHEETPAGEA psp;
179 HWND hdlg, hpage;
180 MSG msg;
181
182 memset(&psp, 0, sizeof(psp));
183 psp.dwSize = sizeof(psp);
184 psp.dwFlags = 0;
186 U(psp).pszTemplate = "prop_page1";
187 U2(psp).pszIcon = NULL;
189 psp.lParam = 0;
190
191 hpsp[0] = pCreatePropertySheetPageA(&psp);
192
193 memset(&psh, 0, sizeof(psh));
196 psh.pszCaption = "test caption";
197 psh.nPages = 1;
199 U3(psh).phpage = hpsp;
201
202 hdlg = (HWND)pPropertySheetA(&psh);
203 ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle value %p\n", hdlg);
204
205 ShowWindow(hdlg,SW_NORMAL);
206 SendMessageA(hdlg, PSM_REMOVEPAGE, 0, 0);
207 hpage = /* PropSheet_GetCurrentPageHwnd(hdlg); */
209 active_page = /* PropSheet_HwndToIndex(hdlg, hpage)); */
210 (int)SendMessageA(hdlg, PSM_HWNDTOINDEX, (WPARAM)hpage, 0);
211 ok(hpage == NULL, "expected no current page, got %p, index=%d\n", hpage, active_page);
212 flush_events();
214
215 /* Check that the property sheet was fully redrawn */
217 "expected no pending WM_PAINT messages\n");
218 DestroyWindow(hdlg);
219}
static void flush_events(void)
Definition: propsheet.c:54
#define PSM_REMOVEPAGE
Definition: prsht.h:166
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define RDW_UPDATENOW
Definition: winuser.h:1220
#define RDW_ERASENOW
Definition: winuser.h:1219
#define PM_NOREMOVE
Definition: winuser.h:1195

Referenced by START_TEST().

◆ test_PSM_ADDPAGE()

static void test_PSM_ADDPAGE ( void  )
static

Definition at line 830 of file propsheet.c.

831{
832 HPROPSHEETPAGE hpsp[5];
833 PROPSHEETPAGEA psp;
835 HWND hdlg, tab;
836 BOOL ret;
837 DWORD r;
838
839 memset(&psp, 0, sizeof(psp));
840 psp.dwSize = sizeof(psp);
841 psp.dwFlags = 0;
844 U2(psp).pszIcon = NULL;
846 psp.lParam = 0;
847
848 /* multiple pages with the same data */
849 hpsp[0] = pCreatePropertySheetPageA(&psp);
850 hpsp[1] = pCreatePropertySheetPageA(&psp);
851 hpsp[2] = pCreatePropertySheetPageA(&psp);
852
853 U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_ERROR);
854 hpsp[3] = pCreatePropertySheetPageA(&psp);
855
857 hpsp[4] = pCreatePropertySheetPageA(&psp);
858
859 memset(&psh, 0, sizeof(psh));
861 psh.dwFlags = PSH_MODELESS;
862 psh.pszCaption = "test caption";
863 psh.nPages = 1;
865 U3(psh).phpage = hpsp;
866
867 hdlg = (HWND)pPropertySheetA(&psh);
868 ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
869
870 /* add pages one by one */
871 ret = SendMessageA(hdlg, PSM_ADDPAGE, 0, (LPARAM)hpsp[1]);
872 ok(ret == TRUE, "got %d\n", ret);
873
874 /* try with null and invalid value */
875 ret = SendMessageA(hdlg, PSM_ADDPAGE, 0, 0);
876 ok(ret == FALSE, "got %d\n", ret);
877
878if (0)
879{
880 /* crashes on native */
882}
883 /* check item count */
884 tab = (HWND)SendMessageA(hdlg, PSM_GETTABCONTROL, 0, 0);
885
886 r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
887 ok(r == 2, "got %d\n", r);
888
889 ret = SendMessageA(hdlg, PSM_ADDPAGE, 0, (LPARAM)hpsp[2]);
890 ok(ret == TRUE, "got %d\n", ret);
891
892 r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
893 ok(r == 3, "got %d\n", r);
894
895 /* add property sheet page that can't be created */
896 ret = SendMessageA(hdlg, PSM_ADDPAGE, 0, (LPARAM)hpsp[3]);
897 ok(ret == TRUE, "got %d\n", ret);
898
899 r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
900 ok(r == 4, "got %d\n", r);
901
902 /* select page that can't be created */
903 ret = SendMessageA(hdlg, PSM_SETCURSEL, 3, 1);
904 ok(ret == TRUE, "got %d\n", ret);
905
906 r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
907 ok(r == 3, "got %d\n", r);
908
909 /* test PSP_PREMATURE flag with incorrect property sheet page */
910 ret = SendMessageA(hdlg, PSM_ADDPAGE, 0, (LPARAM)hpsp[4]);
911 ok(ret == FALSE, "got %d\n", ret);
912
913 r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
914 ok(r == 3, "got %d\n", r);
915
916 pDestroyPropertySheetPage(hpsp[4]);
917 DestroyWindow(hdlg);
918}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define IDD_PROP_PAGE_ERROR
Definition: resources.h:41
#define PSM_GETTABCONTROL
Definition: prsht.h:80
#define PSM_ADDPAGE
Definition: prsht.h:165
#define PSP_PREMATURE
Definition: prsht.h:31
#define PSM_SETCURSEL
Definition: prsht.h:167
#define TCM_GETITEMCOUNT
Definition: commctrl.h:3968

Referenced by START_TEST().

◆ test_PSM_INSERTPAGE()

static void test_PSM_INSERTPAGE ( void  )
static

Definition at line 920 of file propsheet.c.

921{
922 HPROPSHEETPAGE hpsp[5];
923 PROPSHEETPAGEA psp;
925 HWND hdlg, tab;
926 BOOL ret;
927 DWORD r;
928
929 memset(&psp, 0, sizeof(psp));
930 psp.dwSize = sizeof(psp);
931 psp.dwFlags = 0;
934 U2(psp).pszIcon = NULL;
936 psp.lParam = 0;
937
938 /* multiple pages with the same data */
939 hpsp[0] = pCreatePropertySheetPageA(&psp);
940 hpsp[1] = pCreatePropertySheetPageA(&psp);
941 hpsp[2] = pCreatePropertySheetPageA(&psp);
942
943 U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_ERROR);
944 hpsp[3] = pCreatePropertySheetPageA(&psp);
945
947 hpsp[4] = pCreatePropertySheetPageA(&psp);
948
949 memset(&psh, 0, sizeof(psh));
951 psh.dwFlags = PSH_MODELESS;
952 psh.pszCaption = "test caption";
953 psh.nPages = 1;
955 U3(psh).phpage = hpsp;
956
957 hdlg = (HWND)pPropertySheetA(&psh);
958 ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
959
960 /* add pages one by one */
961 ret = SendMessageA(hdlg, PSM_INSERTPAGE, 5, (LPARAM)hpsp[1]);
962 ok(ret == TRUE, "got %d\n", ret);
963
964 /* try with invalid values */
965 ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, 0);
966 ok(ret == FALSE, "got %d\n", ret);
967
968if (0)
969{
970 /* crashes on native */
971 ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, (LPARAM)INVALID_HANDLE_VALUE);
972}
973
974 ret = SendMessageA(hdlg, PSM_INSERTPAGE, (WPARAM)INVALID_HANDLE_VALUE, (LPARAM)hpsp[2]);
975 ok(ret == FALSE, "got %d\n", ret);
976
977 /* check item count */
978 tab = (HWND)SendMessageA(hdlg, PSM_GETTABCONTROL, 0, 0);
979
980 r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
981 ok(r == 2, "got %d\n", r);
982
983 ret = SendMessageA(hdlg, PSM_INSERTPAGE, (WPARAM)hpsp[1], (LPARAM)hpsp[2]);
984 ok(ret == TRUE, "got %d\n", ret);
985
986 r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
987 ok(r == 3, "got %d\n", r);
988
989 /* add property sheet page that can't be created */
990 ret = SendMessageA(hdlg, PSM_INSERTPAGE, 1, (LPARAM)hpsp[3]);
991 ok(ret == TRUE, "got %d\n", ret);
992
993 r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
994 ok(r == 4, "got %d\n", r);
995
996 /* select page that can't be created */
997 ret = SendMessageA(hdlg, PSM_SETCURSEL, 1, 0);
998 ok(ret == TRUE, "got %d\n", ret);
999
1000 r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
1001 ok(r == 3, "got %d\n", r);
1002
1003 /* test PSP_PREMATURE flag with incorrect property sheet page */
1004 ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, (LPARAM)hpsp[4]);
1005 ok(ret == FALSE, "got %d\n", ret);
1006
1007 r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
1008 ok(r == 3, "got %d\n", r);
1009
1010 pDestroyPropertySheetPage(hpsp[4]);
1011 DestroyWindow(hdlg);
1012}

Referenced by START_TEST().

◆ test_title()

static void test_title ( void  )
static

Definition at line 135 of file propsheet.c.

136{
137 HPROPSHEETPAGE hpsp[1];
138 PROPSHEETPAGEA psp;
140 HWND hdlg;
141 DWORD style;
142
143 memset(&psp, 0, sizeof(psp));
144 psp.dwSize = sizeof(psp);
145 psp.dwFlags = 0;
147 U(psp).pszTemplate = "prop_page1";
148 U2(psp).pszIcon = NULL;
150 psp.lParam = 0;
151
152 hpsp[0] = pCreatePropertySheetPageA(&psp);
153
154 memset(&psh, 0, sizeof(psh));
157 psh.pszCaption = "test caption";
158 psh.nPages = 1;
160 U3(psh).phpage = hpsp;
162
163 hdlg = (HWND)pPropertySheetA(&psh);
164 ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle value %p\n", hdlg);
165
169 "got unexpected style: %x\n", style);
170
171 DestroyWindow(hdlg);
172}
Arabic default style
Definition: afstyles.h:94
#define WS_POPUP
Definition: pedump.c:616
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define DS_3DLOOK
Definition: winuser.h:367
#define DS_MODALFRAME
Definition: winuser.h:375
#define DS_SETFONT
Definition: winuser.h:378
#define GWL_STYLE
Definition: winuser.h:852
#define DS_CONTEXTHELP
Definition: winuser.h:371

Referenced by START_TEST().

◆ test_wiznavigation()

static void test_wiznavigation ( void  )
static

Definition at line 343 of file propsheet.c.

344{
345 HPROPSHEETPAGE hpsp[4];
346 PROPSHEETPAGEA psp[4];
348 HWND hdlg, control;
349 LONG_PTR controlID;
350 DWORD style;
351 LRESULT defidres;
352 BOOL hwndtoindex_supported = TRUE;
353 const INT nextID = 12324;
354 const INT backID = 12323;
355 HHOOK hook;
356
357 /* set up a hook proc in order to subclass the main dialog early on */
359
360 /* create the property sheet pages */
361 memset(psp, 0, sizeof(PROPSHEETPAGEA) * 4);
362
363 psp[0].dwSize = sizeof(PROPSHEETPAGEA);
365 U(psp[0]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_INTRO);
366 psp[0].pfnDlgProc = nav_page_proc;
367 hpsp[0] = pCreatePropertySheetPageA(&psp[0]);
368
369 psp[1].dwSize = sizeof(PROPSHEETPAGEA);
371 U(psp[1]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_EDIT);
372 psp[1].pfnDlgProc = nav_page_proc;
373 hpsp[1] = pCreatePropertySheetPageA(&psp[1]);
374
375 psp[2].dwSize = sizeof(PROPSHEETPAGEA);
377 U(psp[2]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_RADIO);
378 psp[2].pfnDlgProc = nav_page_proc;
379 hpsp[2] = pCreatePropertySheetPageA(&psp[2]);
380
381 psp[3].dwSize = sizeof(PROPSHEETPAGEA);
383 U(psp[3]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_EXIT);
384 psp[3].pfnDlgProc = nav_page_proc;
385 hpsp[3] = pCreatePropertySheetPageA(&psp[3]);
386
387 /* set up the property sheet dialog */
388 memset(&psh, 0, sizeof(psh));
391 psh.pszCaption = "A Wizard";
392 psh.nPages = 4;
394 U3(psh).phpage = hpsp;
395 hdlg = (HWND)pPropertySheetA(&psh);
396 ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
397
398 ok(active_page == 0, "Active page should be 0. Is: %d\n", active_page);
399
403 "got unexpected style: %x\n", style);
404
405 control = GetFocus();
406 controlID = GetWindowLongPtrA(control, GWLP_ID);
407 ok(controlID == nextID, "Focus should have been set to the Next button. Expected: %d, Found: %ld\n", nextID, controlID);
408
409 /* simulate pressing the Next button */
411 if (!active_page) hwndtoindex_supported = FALSE;
412 if (hwndtoindex_supported)
413 ok(active_page == 1, "Active page should be 1 after pressing Next. Is: %d\n", active_page);
414
415 control = GetFocus();
416 controlID = GetWindowLongPtrA(control, GWLP_ID);
417 ok(controlID == IDC_PS_EDIT1, "Focus should be set to the first item on the second page. Expected: %d, Found: %ld\n", IDC_PS_EDIT1, controlID);
418
419 defidres = SendMessageA(hdlg, DM_GETDEFID, 0, 0);
420 ok(defidres == MAKELRESULT(nextID, DC_HASDEFID), "Expected default button ID to be %d, is %d\n", nextID, LOWORD(defidres));
421
422 /* set the focus to the second edit box on this page */
423 SetFocus(GetNextDlgTabItem(hdlg, control, FALSE));
424
425 /* press next again */
427 if (hwndtoindex_supported)
428 ok(active_page == 2, "Active page should be 2 after pressing Next. Is: %d\n", active_page);
429
430 control = GetFocus();
431 controlID = GetWindowLongPtrA(control, GWLP_ID);
432 ok(controlID == IDC_PS_RADIO1, "Focus should have been set to item on third page. Expected: %d, Found %ld\n", IDC_PS_RADIO1, controlID);
433
434 /* back button */
436 if (hwndtoindex_supported)
437 ok(active_page == 1, "Active page should be 1 after pressing Back. Is: %d\n", active_page);
438
439 control = GetFocus();
440 controlID = GetWindowLongPtrA(control, GWLP_ID);
441 ok(controlID == IDC_PS_EDIT1, "Focus should have been set to the first item on second page. Expected: %d, Found %ld\n", IDC_PS_EDIT1, controlID);
442
443 defidres = SendMessageA(hdlg, DM_GETDEFID, 0, 0);
444 ok(defidres == MAKELRESULT(backID, DC_HASDEFID), "Expected default button ID to be %d, is %d\n", backID, LOWORD(defidres));
445
446 /* press next twice */
448 if (hwndtoindex_supported)
449 ok(active_page == 2, "Active page should be 2 after pressing Next. Is: %d\n", active_page);
451 if (hwndtoindex_supported)
452 ok(active_page == 3, "Active page should be 3 after pressing Next. Is: %d\n", active_page);
453 else
454 active_page = 3;
455
456 control = GetFocus();
457 controlID = GetWindowLongPtrA(control, GWLP_ID);
458 ok(controlID == nextID, "Focus should have been set to the Next button. Expected: %d, Found: %ld\n", nextID, controlID);
459
460 /* try to navigate away, but shouldn't be able to */
462 ok(active_page == 3, "Active page should still be 3 after pressing Back. Is: %d\n", active_page);
463
464 defidres = SendMessageA(hdlg, DM_GETDEFID, 0, 0);
465 ok(defidres == MAKELRESULT(nextID, DC_HASDEFID), "Expected default button ID to be %d, is %d\n", nextID, LOWORD(defidres));
466
467 DestroyWindow(hdlg);
469}
@ hook
Definition: SystemMenu.c:35
static LRESULT CALLBACK hook_proc(int code, WPARAM wp, LPARAM lp)
Definition: propsheet.c:325
static INT_PTR CALLBACK nav_page_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: propsheet.c:288
#define IDD_PROP_PAGE_RADIO
Definition: resources.h:36
#define IDD_PROP_PAGE_EXIT
Definition: resources.h:37
#define IDC_PS_RADIO1
Definition: resources.h:46
#define IDD_PROP_PAGE_EDIT
Definition: resources.h:35
#define IDC_PS_EDIT1
Definition: resources.h:44
#define IDD_PROP_PAGE_INTRO
Definition: resources.h:34
#define PSBTN_NEXT
Definition: prsht.h:147
#define PSBTN_BACK
Definition: prsht.h:146
#define PSM_PRESSBUTTON
Definition: prsht.h:100
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
HWND WINAPI GetFocus(void)
Definition: window.c:1893
HHOOK WINAPI SetWindowsHookExW(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
#define WH_CBT
Definition: winuser.h:35
HWND WINAPI GetNextDlgTabItem(_In_ HWND, _In_opt_ HWND, _In_ BOOL)
#define MAKELRESULT(l, h)
Definition: winuser.h:4010
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
#define GWLP_ID
Definition: winuser.h:860

Referenced by START_TEST().

Variable Documentation

◆ active_page

LONG active_page = -1
static

◆ add_button_has_been_pressed

BOOL add_button_has_been_pressed
static

◆ old_nav_dialog_proc

WNDPROC old_nav_dialog_proc
static

Definition at line 312 of file propsheet.c.

Referenced by hook_proc(), and new_nav_dialog_proc().

◆ oldWndProc

WNDPROC oldWndProc
static

◆ parenthwnd

HWND parenthwnd
static

Definition at line 33 of file propsheet.c.

Referenced by disableowner_callback(), and test_disableowner().

◆ property_sheet_seq

const struct message property_sheet_seq[]
static

Definition at line 639 of file propsheet.c.

Referenced by test_messages().

◆ rtl

◆ sequences

Definition at line 636 of file propsheet.c.

Referenced by save_message(), and test_messages().

◆ sheethwnd

HWND sheethwnd
static

Definition at line 34 of file propsheet.c.

Referenced by page_dlg_proc(), and sheet_callback().