Update the address of the Free Software Foundation.
[wine.git] / dlls / comctl32 / tests / propsheet.c
blob79be3379e7e47a2ff767c9904cd19405f9f14bd5
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
20 #define NONAMELESSUNION
21 #define NONAMELESSSTRUCT
23 #include <windows.h>
24 #include <commctrl.h>
26 #include "wine/test.h"
28 static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
30 switch(msg)
32 case PSCB_INITIALIZED:
34 char caption[256];
35 GetWindowTextA(hwnd, caption, sizeof(caption));
36 ok(!strcmp(caption,"test caption"), "caption: %s\n", caption);
37 return 0;
40 return 0;
43 static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam,
44 LPARAM lparam)
46 switch(msg)
48 case WM_INITDIALOG:
50 HWND sheet = GetParent(hwnd);
51 char caption[256];
52 GetWindowTextA(sheet, caption, sizeof(caption));
53 ok(!strcmp(caption,"test caption"), "caption: %s\n", caption);
54 return TRUE;
57 case WM_NOTIFY:
59 NMHDR *nmhdr = (NMHDR *)lparam;
60 switch(nmhdr->code)
62 case PSN_APPLY:
63 return TRUE;
64 default:
65 return FALSE;
68 default:
69 return FALSE;
73 static void test_title(void)
75 HPROPSHEETPAGE hpsp[1];
76 PROPSHEETPAGEA psp;
77 PROPSHEETHEADERA psh;
78 HWND hdlg;
80 memset(&psp, 0, sizeof(psp));
81 psp.dwSize = sizeof(psp);
82 psp.dwFlags = 0;
83 psp.hInstance = GetModuleHandleW(NULL);
84 psp.u.pszTemplate = "prop_page1";
85 psp.u2.pszIcon = NULL;
86 psp.pfnDlgProc = page_dlg_proc;
87 psp.lParam = 0;
89 hpsp[0] = CreatePropertySheetPageA(&psp);
91 memset(&psh, 0, sizeof(psh));
92 psh.dwSize = sizeof(psh);
93 psh.dwFlags = PSH_MODELESS | PSH_USECALLBACK;
94 psh.pszCaption = "test caption";
95 psh.nPages = 1;
96 psh.hwndParent = GetDesktopWindow();
97 psh.u3.phpage = hpsp;
98 psh.pfnCallback = sheet_callback;
100 hdlg = (HWND)PropertySheetA(&psh);
101 DestroyWindow(hdlg);
104 START_TEST(propsheet)
106 test_title();