Autosyncing with Wine HEAD
[reactos.git] / rostests / winetests / comctl32 / propsheet.c
index cbf6812..8627351 100644 (file)
@@ -17,9 +17,6 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#define NONAMELESSUNION
-#define NONAMELESSSTRUCT
-
 #include <windows.h>
 #include <commctrl.h>
 
@@ -39,7 +36,7 @@ static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
     }
     return 0;
 }
-
+        
 static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam,
                                       LPARAM lparam)
 {
@@ -81,8 +78,39 @@ static void test_title(void)
     psp.dwSize = sizeof(psp);
     psp.dwFlags = 0;
     psp.hInstance = GetModuleHandleW(NULL);
-    psp.u.pszTemplate = "prop_page1";
-    psp.u2.pszIcon = NULL;
+    U(psp).pszTemplate = "prop_page1";
+    U2(psp).pszIcon = NULL;
+    psp.pfnDlgProc = page_dlg_proc;
+    psp.lParam = 0;
+
+    hpsp[0] = CreatePropertySheetPageA(&psp);
+
+    memset(&psh, 0, sizeof(psh));
+    psh.dwSize = sizeof(psh);
+    psh.dwFlags = PSH_MODELESS | PSH_USECALLBACK;
+    psh.pszCaption = "test caption";
+    psh.nPages = 1;
+    psh.hwndParent = GetDesktopWindow();
+    U3(psh).phpage = hpsp;
+    psh.pfnCallback = sheet_callback;
+
+    hdlg = (HWND)PropertySheetA(&psh);
+    DestroyWindow(hdlg);
+}
+
+static void test_nopage(void)
+{
+    HPROPSHEETPAGE hpsp[1];
+    PROPSHEETPAGEA psp;
+    PROPSHEETHEADERA psh;
+    HWND hdlg;
+
+    memset(&psp, 0, sizeof(psp));
+    psp.dwSize = sizeof(psp);
+    psp.dwFlags = 0;
+    psp.hInstance = GetModuleHandleW(NULL);
+    U(psp).pszTemplate = "prop_page1";
+    U2(psp).pszIcon = NULL;
     psp.pfnDlgProc = page_dlg_proc;
     psp.lParam = 0;
 
@@ -94,14 +122,18 @@ static void test_title(void)
     psh.pszCaption = "test caption";
     psh.nPages = 1;
     psh.hwndParent = GetDesktopWindow();
-    psh.u3.phpage = hpsp;
+    U3(psh).phpage = hpsp;
     psh.pfnCallback = sheet_callback;
 
     hdlg = (HWND)PropertySheetA(&psh);
+    ShowWindow(hdlg,SW_NORMAL);
+    SendMessage(hdlg, PSM_REMOVEPAGE, 0, 0);
+    RedrawWindow(hdlg,NULL,NULL,RDW_UPDATENOW|RDW_ERASENOW);
     DestroyWindow(hdlg);
 }
 
 START_TEST(propsheet)
 {
     test_title();
+    test_nopage();
 }