Dmitry Timoshkov : comctl32/tests: Add a test for passing dialog template with bad control class to PropertySheet.

Alexandre Julliard julliard at winehq.org
Tue Dec 18 14:51:58 CST 2018


Module: wine
Branch: master
Commit: ca41fd8904962cb2df03682ad7540ba014f8f7ba
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ca41fd8904962cb2df03682ad7540ba014f8f7ba

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Tue Dec 18 18:45:42 2018 +0300

comctl32/tests: Add a test for passing dialog template with bad control class to PropertySheet.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/tests/propsheet.c | 42 +++++++++++++++++++++++++++++++++++++++++
 dlls/comctl32/tests/resources.h |  1 +
 dlls/comctl32/tests/rsrc.rc     |  7 +++++++
 3 files changed, 50 insertions(+)

diff --git a/dlls/comctl32/tests/propsheet.c b/dlls/comctl32/tests/propsheet.c
index 2a4afaa..b5c05b2 100644
--- a/dlls/comctl32/tests/propsheet.c
+++ b/dlls/comctl32/tests/propsheet.c
@@ -1143,6 +1143,47 @@ static void test_CreatePropertySheetPage(void)
     }
 }
 
+static void test_bad_control_class(void)
+{
+    PROPSHEETPAGEA psp;
+    PROPSHEETHEADERA psh;
+    HPROPSHEETPAGE hpsp;
+    INT_PTR ret;
+
+    memset(&psp, 0, sizeof(psp));
+    psp.dwSize = sizeof(psp);
+    psp.hInstance = GetModuleHandleA(NULL);
+    U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_BAD_CONTROL);
+    psp.pfnDlgProc = page_dlg_proc;
+
+    hpsp = pCreatePropertySheetPageA(&psp);
+    ok(hpsp != 0, "CreatePropertySheetPage failed\n");
+
+    memset(&psh, 0, sizeof(psh));
+    psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
+    psh.nPages = 1;
+    psh.hwndParent = GetDesktopWindow();
+    U3(psh).phpage = &hpsp;
+
+if (!strcmp(winetest_platform, "windows")) /* FIXME: enable once Wine is fixed */
+{
+    ret = pPropertySheetA(&psh);
+    ok(ret == 0, "got %ld\n", ret);
+}
+
+    /* Need to recreate hpsp otherwise the test fails under Windows */
+    hpsp = pCreatePropertySheetPageA(&psp);
+    ok(hpsp != 0, "CreatePropertySheetPage failed\n");
+    U3(psh).phpage = &hpsp;
+
+    psh.dwFlags = PSH_MODELESS;
+    ret = pPropertySheetA(&psh);
+    ok(ret != 0, "got %ld\n", ret);
+
+    ok(IsWindow((HWND)ret), "bad window handle %#lx\n", ret);
+    DestroyWindow((HWND)ret);
+}
+
 static void init_functions(void)
 {
     HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
@@ -1168,6 +1209,7 @@ START_TEST(propsheet)
 
     init_functions();
 
+    test_bad_control_class();
     test_title();
     test_nopage();
     test_disableowner();
diff --git a/dlls/comctl32/tests/resources.h b/dlls/comctl32/tests/resources.h
index 3a89cd7..53522c0 100644
--- a/dlls/comctl32/tests/resources.h
+++ b/dlls/comctl32/tests/resources.h
@@ -39,6 +39,7 @@
 #define IDD_PROP_PAGE_WITH_CUSTOM_DEFAULT_BUTTON 34
 #define IDD_PROP_PAGE_MESSAGE_TEST 35
 #define IDD_PROP_PAGE_ERROR 36
+#define IDD_PROP_PAGE_BAD_CONTROL 37
 
 #define IDC_PS_EDIT1 1000
 #define IDC_PS_EDIT2 1001
diff --git a/dlls/comctl32/tests/rsrc.rc b/dlls/comctl32/tests/rsrc.rc
index 327aa22..6eb4fe8 100644
--- a/dlls/comctl32/tests/rsrc.rc
+++ b/dlls/comctl32/tests/rsrc.rc
@@ -78,6 +78,13 @@ FONT 8, "MS Shell Dlg"
 {
 }
 
+IDD_PROP_PAGE_BAD_CONTROL DIALOG 0, 0, 100, 100
+STYLE WS_POPUP | WS_CAPTION | WS_CLIPSIBLINGS | WS_VISIBLE
+FONT 8, "MS Shell Dlg"
+{
+    CONTROL "", -1, "invalid class", 0, 0, 0, 0, 0
+}
+
 STRINGTABLE 
 {
     IDS_TBADD1           "abc"




More information about the wine-cvs mailing list