mirror of
https://github.com/reactos/wine.git
synced 2025-01-18 17:54:42 +00:00
comctl32/tests: Some tests for property page initialization.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e1023765c3
commit
ad7a1a0e3d
@ -987,6 +987,147 @@ if (0)
|
||||
DestroyWindow(hdlg);
|
||||
}
|
||||
|
||||
struct custom_proppage
|
||||
{
|
||||
union
|
||||
{
|
||||
PROPSHEETPAGEA pageA;
|
||||
PROPSHEETPAGEW pageW;
|
||||
} u;
|
||||
unsigned int addref_called;
|
||||
unsigned int release_called;
|
||||
};
|
||||
|
||||
static UINT CALLBACK proppage_callback_a(HWND hwnd, UINT msg, PROPSHEETPAGEA *psp)
|
||||
{
|
||||
struct custom_proppage *cpage = (struct custom_proppage *)psp->lParam;
|
||||
PROPSHEETPAGEA *psp_orig = &cpage->u.pageA;
|
||||
|
||||
ok(hwnd == NULL, "Expected NULL hwnd, got %p\n", hwnd);
|
||||
|
||||
ok(psp->lParam && psp->lParam != (LPARAM)psp, "Expected newly allocated page description, got %lx, %p\n",
|
||||
psp->lParam, psp);
|
||||
ok(psp_orig->pszTitle == psp->pszTitle, "Expected same page title pointer\n");
|
||||
ok(!lstrcmpA(psp_orig->pszTitle, psp->pszTitle), "Expected same page title string\n");
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case PSPCB_ADDREF:
|
||||
ok(psp->dwSize > PROPSHEETPAGEA_V1_SIZE, "Expected ADDREF for V2+ only, got size %u\n", psp->dwSize);
|
||||
cpage->addref_called++;
|
||||
break;
|
||||
case PSPCB_RELEASE:
|
||||
ok(psp->dwSize >= PROPSHEETPAGEA_V1_SIZE, "Unexpected RELEASE, got size %u\n", psp->dwSize);
|
||||
cpage->release_called++;
|
||||
break;
|
||||
default:
|
||||
ok(0, "Unexpected message %u\n", msg);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static UINT CALLBACK proppage_callback_w(HWND hwnd, UINT msg, PROPSHEETPAGEW *psp)
|
||||
{
|
||||
struct custom_proppage *cpage = (struct custom_proppage *)psp->lParam;
|
||||
PROPSHEETPAGEW *psp_orig = &cpage->u.pageW;
|
||||
|
||||
ok(hwnd == NULL, "Expected NULL hwnd, got %p\n", hwnd);
|
||||
ok(psp->lParam && psp->lParam != (LPARAM)psp, "Expected newly allocated page description, got %lx, %p\n",
|
||||
psp->lParam, psp);
|
||||
ok(psp_orig->pszTitle == psp->pszTitle, "Expected same page title pointer\n");
|
||||
ok(!lstrcmpW(psp_orig->pszTitle, psp->pszTitle), "Expected same page title string\n");
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case PSPCB_ADDREF:
|
||||
ok(psp->dwSize > PROPSHEETPAGEW_V1_SIZE, "Expected ADDREF for V2+ only, got size %u\n", psp->dwSize);
|
||||
cpage->addref_called++;
|
||||
break;
|
||||
case PSPCB_RELEASE:
|
||||
ok(psp->dwSize >= PROPSHEETPAGEW_V1_SIZE, "Unexpected RELEASE, got size %u\n", psp->dwSize);
|
||||
cpage->release_called++;
|
||||
break;
|
||||
default:
|
||||
ok(0, "Unexpected message %u\n", msg);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void test_CreatePropertySheetPage(void)
|
||||
{
|
||||
static const WCHAR titleW[] = {'T','i','t','l','e',0};
|
||||
struct custom_proppage page;
|
||||
HPROPSHEETPAGE hpsp;
|
||||
BOOL ret;
|
||||
|
||||
memset(&page.u.pageA, 0, sizeof(page.u.pageA));
|
||||
page.u.pageA.dwFlags = PSP_USECALLBACK;
|
||||
page.u.pageA.pfnDlgProc = page_dlg_proc_messages;
|
||||
page.u.pageA.pfnCallback = proppage_callback_a;
|
||||
page.u.pageA.lParam = (LPARAM)&page;
|
||||
page.u.pageA.pszTitle = "Title";
|
||||
|
||||
/* Only minimal size validation is performed */
|
||||
for (page.u.pageA.dwSize = PROPSHEETPAGEA_V1_SIZE - 1; page.u.pageA.dwSize <= PROPSHEETPAGEA_V4_SIZE + 1; page.u.pageA.dwSize++)
|
||||
{
|
||||
page.addref_called = 0;
|
||||
hpsp = CreatePropertySheetPageA(&page.u.pageA);
|
||||
|
||||
if (page.u.pageA.dwSize < PROPSHEETPAGEA_V1_SIZE)
|
||||
todo_wine
|
||||
ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageA.dwSize);
|
||||
else
|
||||
{
|
||||
ok(hpsp != NULL, "Failed to create a page, size %u\n", page.u.pageA.dwSize);
|
||||
todo_wine_if(page.u.pageA.dwSize > PROPSHEETPAGEA_V1_SIZE)
|
||||
ok(page.addref_called == (page.u.pageA.dwSize > PROPSHEETPAGEA_V1_SIZE) ? 1 : 0, "Expected ADDREF callback message\n");
|
||||
}
|
||||
|
||||
if (hpsp)
|
||||
{
|
||||
page.release_called = 0;
|
||||
ret = DestroyPropertySheetPage(hpsp);
|
||||
ok(ret, "Failed to destroy a page\n");
|
||||
todo_wine
|
||||
ok(page.release_called == 1, "Expected RELEASE callback message\n");
|
||||
}
|
||||
}
|
||||
|
||||
memset(&page.u.pageW, 0, sizeof(page.u.pageW));
|
||||
page.u.pageW.dwFlags = PSP_USECALLBACK;
|
||||
page.u.pageW.pfnDlgProc = page_dlg_proc_messages;
|
||||
page.u.pageW.pfnCallback = proppage_callback_w;
|
||||
page.u.pageW.lParam = (LPARAM)&page;
|
||||
page.u.pageW.pszTitle = titleW;
|
||||
|
||||
for (page.u.pageW.dwSize = PROPSHEETPAGEW_V1_SIZE - 1; page.u.pageW.dwSize <= PROPSHEETPAGEW_V4_SIZE + 1; page.u.pageW.dwSize++)
|
||||
{
|
||||
page.addref_called = 0;
|
||||
hpsp = CreatePropertySheetPageW(&page.u.pageW);
|
||||
|
||||
if (page.u.pageW.dwSize < PROPSHEETPAGEW_V1_SIZE)
|
||||
todo_wine
|
||||
ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageW.dwSize);
|
||||
else
|
||||
{
|
||||
ok(hpsp != NULL, "Failed to create a page, size %u\n", page.u.pageW.dwSize);
|
||||
todo_wine_if(page.u.pageW.dwSize > PROPSHEETPAGEW_V1_SIZE)
|
||||
ok(page.addref_called == (page.u.pageW.dwSize > PROPSHEETPAGEW_V1_SIZE) ? 1 : 0, "Expected ADDREF callback message\n");
|
||||
}
|
||||
|
||||
if (hpsp)
|
||||
{
|
||||
page.release_called = 0;
|
||||
ret = DestroyPropertySheetPage(hpsp);
|
||||
ok(ret, "Failed to destroy a page\n");
|
||||
todo_wine
|
||||
ok(page.release_called == 1, "Expected RELEASE callback message\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(propsheet)
|
||||
{
|
||||
test_title();
|
||||
@ -998,4 +1139,5 @@ START_TEST(propsheet)
|
||||
test_messages();
|
||||
test_PSM_ADDPAGE();
|
||||
test_PSM_INSERTPAGE();
|
||||
test_CreatePropertySheetPage();
|
||||
}
|
||||
|
@ -293,6 +293,7 @@ DECL_PRSHT_TYPE_AW(LPCPROPSHEETPAGE, LATEST)
|
||||
#define PSP_USEFUSIONCONTEXT 0x00004000
|
||||
#define PSP_COMMANDLINKS 0x00040000
|
||||
|
||||
#define PSPCB_ADDREF 0
|
||||
#define PSPCB_RELEASE 1
|
||||
#define PSPCB_CREATE 2
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user