~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/comctl32/tests/propsheet.c

Version: ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~ [ wine-1.0-rc5 ] ~ [ wine-1.0-rc4 ] ~ [ wine-1.0-rc3 ] ~ [ wine-1.0-rc2 ] ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  1 /* Unit test suite for property sheet control.
  2  *
  3  * Copyright 2006 Huw Davies
  4  *
  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.
  9  *
 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.
 14  *
 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
 18  */
 19 
 20 #include <windows.h>
 21 #include <commctrl.h>
 22 
 23 #include "wine/test.h"
 24 
 25 static HWND parent;
 26 
 27 static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
 28 {
 29     switch(msg)
 30     {
 31     case PSCB_INITIALIZED:
 32       {
 33         char caption[256];
 34         GetWindowTextA(hwnd, caption, sizeof(caption));
 35         ok(!strcmp(caption,"test caption"), "caption: %s\n", caption);
 36         return 0;
 37       }
 38     }
 39     return 0;
 40 }
 41         
 42 static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam,
 43                                       LPARAM lparam)
 44 {
 45     switch(msg)
 46     {
 47     case WM_INITDIALOG:
 48       {
 49         HWND sheet = GetParent(hwnd);
 50         char caption[256];
 51         GetWindowTextA(sheet, caption, sizeof(caption));
 52         ok(!strcmp(caption,"test caption"), "caption: %s\n", caption);
 53         return TRUE;
 54       }
 55 
 56     case WM_NOTIFY:
 57       {
 58         NMHDR *nmhdr = (NMHDR *)lparam;
 59         switch(nmhdr->code)
 60         {
 61         case PSN_APPLY:
 62             return TRUE;
 63         default:
 64             return FALSE;
 65         }
 66       }
 67     default:
 68         return FALSE;
 69     }
 70 }
 71 
 72 static void test_title(void)
 73 {
 74     HPROPSHEETPAGE hpsp[1];
 75     PROPSHEETPAGEA psp;
 76     PROPSHEETHEADERA psh;
 77     HWND hdlg;
 78 
 79     memset(&psp, 0, sizeof(psp));
 80     psp.dwSize = sizeof(psp);
 81     psp.dwFlags = 0;
 82     psp.hInstance = GetModuleHandleW(NULL);
 83     U(psp).pszTemplate = "prop_page1";
 84     U2(psp).pszIcon = NULL;
 85     psp.pfnDlgProc = page_dlg_proc;
 86     psp.lParam = 0;
 87 
 88     hpsp[0] = CreatePropertySheetPageA(&psp);
 89 
 90     memset(&psh, 0, sizeof(psh));
 91     psh.dwSize = sizeof(psh);
 92     psh.dwFlags = PSH_MODELESS | PSH_USECALLBACK;
 93     psh.pszCaption = "test caption";
 94     psh.nPages = 1;
 95     psh.hwndParent = GetDesktopWindow();
 96     U3(psh).phpage = hpsp;
 97     psh.pfnCallback = sheet_callback;
 98 
 99     hdlg = (HWND)PropertySheetA(&psh);
100     DestroyWindow(hdlg);
101 }
102 
103 static void test_nopage(void)
104 {
105     HPROPSHEETPAGE hpsp[1];
106     PROPSHEETPAGEA psp;
107     PROPSHEETHEADERA psh;
108     HWND hdlg;
109 
110     memset(&psp, 0, sizeof(psp));
111     psp.dwSize = sizeof(psp);
112     psp.dwFlags = 0;
113     psp.hInstance = GetModuleHandleW(NULL);
114     U(psp).pszTemplate = "prop_page1";
115     U2(psp).pszIcon = NULL;
116     psp.pfnDlgProc = page_dlg_proc;
117     psp.lParam = 0;
118 
119     hpsp[0] = CreatePropertySheetPageA(&psp);
120 
121     memset(&psh, 0, sizeof(psh));
122     psh.dwSize = sizeof(psh);
123     psh.dwFlags = PSH_MODELESS | PSH_USECALLBACK;
124     psh.pszCaption = "test caption";
125     psh.nPages = 1;
126     psh.hwndParent = GetDesktopWindow();
127     U3(psh).phpage = hpsp;
128     psh.pfnCallback = sheet_callback;
129 
130     hdlg = (HWND)PropertySheetA(&psh);
131     ShowWindow(hdlg,SW_NORMAL);
132     SendMessage(hdlg, PSM_REMOVEPAGE, 0, 0);
133     RedrawWindow(hdlg,NULL,NULL,RDW_UPDATENOW|RDW_ERASENOW);
134     DestroyWindow(hdlg);
135 }
136 
137 static int CALLBACK disableowner_callback(HWND hwnd, UINT msg, LPARAM lparam)
138 {
139     switch(msg)
140     {
141     case PSCB_INITIALIZED:
142       {
143         ok(IsWindowEnabled(parent) == 0, "parent window should be disabled\n");
144         PostQuitMessage(0);
145         return FALSE;
146       }
147     }
148     return FALSE;
149 }
150 
151 static void register_parent_wnd_class(void)
152 {
153     WNDCLASSA cls;
154 
155     cls.style = 0;
156     cls.lpfnWndProc = DefWindowProcA;
157     cls.cbClsExtra = 0;
158     cls.cbWndExtra = 0;
159     cls.hInstance = GetModuleHandleA(NULL);
160     cls.hIcon = 0;
161     cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
162     cls.hbrBackground = GetStockObject(WHITE_BRUSH);
163     cls.lpszMenuName = NULL;
164     cls.lpszClassName = "parent class";
165     RegisterClassA(&cls);
166 }
167 
168 static void test_disableowner(void)
169 {
170     HPROPSHEETPAGE hpsp[1];
171     PROPSHEETPAGEA psp;
172     PROPSHEETHEADERA psh;
173 
174     register_parent_wnd_class();
175     parent = CreateWindowA("parent class", "", WS_CAPTION | WS_SYSMENU | WS_VISIBLE, 100, 100, 100, 100, GetDesktopWindow(), NULL, GetModuleHandleA(NULL), 0);
176 
177     memset(&psp, 0, sizeof(psp));
178     psp.dwSize = sizeof(psp);
179     psp.dwFlags = 0;
180     psp.hInstance = GetModuleHandleW(NULL);
181     U(psp).pszTemplate = "prop_page1";
182     U2(psp).pszIcon = NULL;
183     psp.pfnDlgProc = NULL;
184     psp.lParam = 0;
185 
186     hpsp[0] = CreatePropertySheetPageA(&psp);
187 
188     memset(&psh, 0, sizeof(psh));
189     psh.dwSize = sizeof(psh);
190     psh.dwFlags = PSH_USECALLBACK;
191     psh.pszCaption = "test caption";
192     psh.nPages = 1;
193     psh.hwndParent = parent;
194     U3(psh).phpage = hpsp;
195     psh.pfnCallback = disableowner_callback;
196 
197     PropertySheetA(&psh);
198     ok(IsWindowEnabled(parent) != 0, "parent window should be enabled\n");
199     DestroyWindow(parent);
200 }
201 
202 START_TEST(propsheet)
203 {
204     test_title();
205     test_nopage();
206     test_disableowner();
207 }
208 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.