mirror of
https://github.com/reactos/reactos.git
synced 2024-11-23 11:33:31 +08:00
[SDK] Add some missing propsheet fields + validate struct sizes
This commit is contained in:
parent
db55933b0c
commit
cd3c1e94ff
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: Test for property sheet
|
||||
* PURPOSE: Test for v6 property sheet
|
||||
* COPYRIGHT: Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
|
||||
*/
|
||||
|
||||
#include "wine/test.h"
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
@ -73,17 +74,82 @@ Page1DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define CHECK_STRUCT_SIZE(x, y) C_ASSERT((x) == (y))
|
||||
#else
|
||||
// Can't do this compile time, thanks gcc
|
||||
// 'error: non-nested function with variably modified type'
|
||||
#define CHECK_STRUCT_SIZE(x, y) ok((x) == (y), "Wrong size for %s, got %u, expected %u\n", #x, y, x)
|
||||
#endif
|
||||
|
||||
// Validate struct sizes
|
||||
static void test_StructSizes()
|
||||
{
|
||||
#ifdef _M_X64
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V1_SIZE, 72);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V2_SIZE, 88);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V3_SIZE, 96);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V4_SIZE, 104);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETHEADERA_V1_SIZE, 72);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETHEADERA_V2_SIZE, 96);
|
||||
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V1_SIZE, 72);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V2_SIZE, 88);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V3_SIZE, 96);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V4_SIZE, 104);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETHEADERW_V1_SIZE, 72);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETHEADERW_V2_SIZE, 96);
|
||||
#else
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V1_SIZE, 40);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V2_SIZE, 48);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V3_SIZE, 52);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V4_SIZE, 56);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETHEADERA_V1_SIZE, 40);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETHEADERA_V2_SIZE, 52);
|
||||
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V1_SIZE, 40);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V2_SIZE, 48);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V3_SIZE, 52);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V4_SIZE, 56);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETHEADERW_V1_SIZE, 40);
|
||||
CHECK_STRUCT_SIZE(PROPSHEETHEADERW_V2_SIZE, 52);
|
||||
#endif
|
||||
}
|
||||
|
||||
typedef HPROPSHEETPAGE (WINAPI *FN_CreatePropertySheetPageW)(LPCPROPSHEETPAGEW);
|
||||
typedef int (WINAPI *FN_PropertySheetW)(LPCPROPSHEETHEADERW);
|
||||
static FN_CreatePropertySheetPageW pCreatePropertySheetPageW;
|
||||
static FN_PropertySheetW pPropertySheetW;
|
||||
|
||||
// Show that the Apply button is not enabled by default
|
||||
static void test_ApplyButtonDisabled()
|
||||
{
|
||||
PROPSHEETPAGEW psp = {0};
|
||||
PROPSHEETHEADERW header = {0};
|
||||
HPROPSHEETPAGE hpsp[1];
|
||||
|
||||
psp.dwSize = sizeof(psp);
|
||||
psp.dwFlags = PSP_DEFAULT;
|
||||
psp.hInstance = GetModuleHandleW(NULL);
|
||||
psp.pszTemplate = MAKEINTRESOURCEW(1);
|
||||
psp.pfnDlgProc = Page1DlgProc;
|
||||
hpsp[0] = pCreatePropertySheetPageW(&psp);
|
||||
ok(hpsp[0] != NULL, "hpsp[0] was NULL.\n");
|
||||
|
||||
header.dwSize = sizeof(header);
|
||||
header.dwFlags = 0;
|
||||
header.hInstance = GetModuleHandleW(NULL);
|
||||
header.hwndParent = NULL;
|
||||
header.nPages = ARRAYSIZE(hpsp);
|
||||
header.phpage = hpsp;
|
||||
header.pszCaption = L"propsheet";
|
||||
ok(pPropertySheetW(&header) > 0, "PropertySheet returned non-positive value.\n");
|
||||
}
|
||||
|
||||
|
||||
START_TEST(propsheet)
|
||||
{
|
||||
PROPSHEETPAGEW psp;
|
||||
PROPSHEETHEADERW header;
|
||||
HPROPSHEETPAGE hpsp[1];
|
||||
HMODULE hComCtl32;
|
||||
FN_CreatePropertySheetPageW pCreatePropertySheetPageW;
|
||||
FN_PropertySheetW pPropertySheetW;
|
||||
|
||||
hComCtl32 = LoadLibraryW(L"comctl32.dll");
|
||||
pCreatePropertySheetPageW = (FN_CreatePropertySheetPageW)GetProcAddress(hComCtl32, "CreatePropertySheetPageW");
|
||||
@ -98,24 +164,8 @@ START_TEST(propsheet)
|
||||
return;
|
||||
}
|
||||
|
||||
ZeroMemory(&psp, sizeof(psp));
|
||||
psp.dwSize = sizeof(psp);
|
||||
psp.dwFlags = PSP_DEFAULT;
|
||||
psp.hInstance = GetModuleHandleW(NULL);
|
||||
psp.pszTemplate = MAKEINTRESOURCEW(1);
|
||||
psp.pfnDlgProc = Page1DlgProc;
|
||||
hpsp[0] = (*pCreatePropertySheetPageW)(&psp);
|
||||
ok(hpsp[0] != NULL, "hpsp[0] was NULL.\n");
|
||||
|
||||
ZeroMemory(&header, sizeof(header));
|
||||
header.dwSize = sizeof(header);
|
||||
header.dwFlags = 0;
|
||||
header.hInstance = GetModuleHandleW(NULL);
|
||||
header.hwndParent = NULL;
|
||||
header.nPages = ARRAYSIZE(hpsp);
|
||||
header.phpage = hpsp;
|
||||
header.pszCaption = L"propsheet";
|
||||
ok((*pPropertySheetW)(&header) > 0, "PropertySheet returned non-positive value.\n");
|
||||
test_StructSizes();
|
||||
test_ApplyButtonDisabled();
|
||||
|
||||
FreeLibrary(hComCtl32);
|
||||
}
|
||||
|
@ -194,6 +194,15 @@ typedef struct _PROPSHEETPAGEA {
|
||||
LPCSTR pszHeaderTitle;
|
||||
LPCSTR pszHeaderSubTitle;
|
||||
#endif
|
||||
#if (_WIN32_IE >= 0x0501)
|
||||
HANDLE hActCtx;
|
||||
#endif
|
||||
#if (_WIN32_IE >= 0x0600)
|
||||
_ANONYMOUS_UNION union {
|
||||
HBITMAP hbmHeader;
|
||||
LPCSTR pszbmHeader;
|
||||
} DUMMYUNIONNAME3;
|
||||
#endif
|
||||
} PROPSHEETPAGEA,*LPPROPSHEETPAGEA,
|
||||
PROPSHEETPAGEA_LATEST, *LPPROPSHEETPAGEA_LATEST;
|
||||
typedef const PROPSHEETPAGEA *LPCPROPSHEETPAGEA, *LPCPROPSHEETPAGEA_LATEST;
|
||||
@ -222,6 +231,15 @@ typedef struct _PROPSHEETPAGEW {
|
||||
LPCWSTR pszHeaderTitle;
|
||||
LPCWSTR pszHeaderSubTitle;
|
||||
#endif
|
||||
#if (_WIN32_IE >= 0x0501)
|
||||
HANDLE hActCtx;
|
||||
#endif
|
||||
#if (_WIN32_IE >= 0x0600)
|
||||
_ANONYMOUS_UNION union {
|
||||
HBITMAP hbmHeader;
|
||||
LPCWSTR pszbmHeader;
|
||||
} DUMMYUNIONNAME3;
|
||||
#endif
|
||||
} PROPSHEETPAGEW,*LPPROPSHEETPAGEW,
|
||||
PROPSHEETPAGEW_LATEST, *LPPROPSHEETPAGEW_LATEST;
|
||||
typedef const PROPSHEETPAGEW *LPCPROPSHEETPAGEW, *LPCPROPSHEETPAGEW_LATEST;
|
||||
|
Loading…
Reference in New Issue
Block a user