1 /* Unit test suite for property sheet control.
3 * Copyright 2006 Huw Davies
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/test.h"
25 static int CALLBACK
sheet_callback(HWND hwnd
, UINT msg
, LPARAM lparam
)
29 case PSCB_INITIALIZED
:
32 GetWindowTextA(hwnd
, caption
, sizeof(caption
));
33 ok(!strcmp(caption
,"test caption"), "caption: %s\n", caption
);
40 static INT_PTR CALLBACK
page_dlg_proc(HWND hwnd
, UINT msg
, WPARAM wparam
,
47 HWND sheet
= GetParent(hwnd
);
49 GetWindowTextA(sheet
, caption
, sizeof(caption
));
50 ok(!strcmp(caption
,"test caption"), "caption: %s\n", caption
);
56 NMHDR
*nmhdr
= (NMHDR
*)lparam
;
70 static void test_title(void)
72 HPROPSHEETPAGE hpsp
[1];
77 memset(&psp
, 0, sizeof(psp
));
78 psp
.dwSize
= sizeof(psp
);
80 psp
.hInstance
= GetModuleHandleW(NULL
);
81 U(psp
).pszTemplate
= "prop_page1";
82 U2(psp
).pszIcon
= NULL
;
83 psp
.pfnDlgProc
= page_dlg_proc
;
86 hpsp
[0] = CreatePropertySheetPageA(&psp
);
88 memset(&psh
, 0, sizeof(psh
));
89 psh
.dwSize
= sizeof(psh
);
90 psh
.dwFlags
= PSH_MODELESS
| PSH_USECALLBACK
;
91 psh
.pszCaption
= "test caption";
93 psh
.hwndParent
= GetDesktopWindow();
94 U3(psh
).phpage
= hpsp
;
95 psh
.pfnCallback
= sheet_callback
;
97 hdlg
= (HWND
)PropertySheetA(&psh
);
101 static void test_nopage(void)
103 HPROPSHEETPAGE hpsp
[1];
105 PROPSHEETHEADERA psh
;
108 memset(&psp
, 0, sizeof(psp
));
109 psp
.dwSize
= sizeof(psp
);
111 psp
.hInstance
= GetModuleHandleW(NULL
);
112 U(psp
).pszTemplate
= "prop_page1";
113 U2(psp
).pszIcon
= NULL
;
114 psp
.pfnDlgProc
= page_dlg_proc
;
117 hpsp
[0] = CreatePropertySheetPageA(&psp
);
119 memset(&psh
, 0, sizeof(psh
));
120 psh
.dwSize
= sizeof(psh
);
121 psh
.dwFlags
= PSH_MODELESS
| PSH_USECALLBACK
;
122 psh
.pszCaption
= "test caption";
124 psh
.hwndParent
= GetDesktopWindow();
125 U3(psh
).phpage
= hpsp
;
126 psh
.pfnCallback
= sheet_callback
;
128 hdlg
= (HWND
)PropertySheetA(&psh
);
129 ShowWindow(hdlg
,SW_NORMAL
);
130 SendMessage(hdlg
, PSM_REMOVEPAGE
, 0, 0);
131 RedrawWindow(hdlg
,NULL
,NULL
,RDW_UPDATENOW
|RDW_ERASENOW
);
135 START_TEST(propsheet
)