comctl32/tests: Call InitCommonControlsEx() if available, fall back to InitCommonControls() for the older controls, and skip the tests altogether for the newer ones.

This commit is contained in:
Francois Gouget 2008-02-05 11:59:47 +01:00 committed by Alexandre Julliard
parent fb36abaee9
commit e5b4c0f84b
8 changed files with 121 additions and 15 deletions

View File

@ -187,10 +187,23 @@ static LRESULT CALLBACK ComboExTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, L
return 0L;
}
static void init(void) {
static int init(void)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
INITCOMMONCONTROLSEX iccex;
InitCommonControls();
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (!pInitCommonControlsEx)
{
skip("InitCommonControlsEx() is missing. Skipping the tests\n");
return 0;
}
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_USEREX_CLASSES;
pInitCommonControlsEx(&iccex);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
@ -209,7 +222,7 @@ static void init(void) {
assert(hComboExParentWnd != NULL);
hMainHinst = GetModuleHandleA(NULL);
return 1;
}
static void cleanup(void)
@ -227,7 +240,8 @@ static void cleanup(void)
START_TEST(comboex)
{
init();
if (!init())
return;
test_comboboxex();

View File

@ -560,7 +560,21 @@ static void test_datetime_control(void)
START_TEST(datetime)
{
InitCommonControls();
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
INITCOMMONCONTROLSEX iccex;
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (!pInitCommonControlsEx)
{
skip("InitCommonControlsEx() is missing. Skipping the tests\n");
return;
}
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_DATE_CLASSES;
pInitCommonControlsEx(&iccex);
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
test_datetime_control();

View File

@ -1480,10 +1480,24 @@ static LRESULT CALLBACK HeaderTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
return 0L;
}
static void init(void) {
static int init(void)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
INITCOMMONCONTROLSEX iccex;
InitCommonControls();
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (!pInitCommonControlsEx)
{
skip("InitCommonControlsEx() is missing. Skipping the tests\n");
return 0;
}
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_USEREX_CLASSES;
pInitCommonControlsEx(&iccex);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
@ -1503,13 +1517,15 @@ static void init(void) {
NULL, NULL, GetModuleHandleA(NULL), 0);
assert(hHeaderParentWnd != NULL);
ShowWindow(hHeaderParentWnd, SW_SHOW);
return 1;
}
START_TEST(header)
{
HWND parent_hwnd;
init();
if (!init())
return;
test_header_control();
test_header_order();

View File

@ -1040,7 +1040,20 @@ static void test_item_position(void)
START_TEST(listview)
{
InitCommonControls();
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (pInitCommonControlsEx)
{
INITCOMMONCONTROLSEX iccex;
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_LISTVIEW_CLASSES;
pInitCommonControlsEx(&iccex);
}
else
InitCommonControls();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);

View File

@ -315,7 +315,6 @@ static void test_monthcal(void)
SYSTEMTIME st[2], st1[2];
int res, month_range;
InitCommonControls();
hwnd = CreateWindowA(MONTHCAL_CLASSA, "MonthCal", WS_POPUP | WS_VISIBLE, CW_USEDEFAULT,
0, 300, 300, 0, 0, NULL, NULL);
ok(hwnd != NULL, "Failed to create MonthCal\n");
@ -478,8 +477,6 @@ static HWND create_monthcal_control(DWORD style, HWND parent_window)
struct subclass_info *info;
HWND hwnd;
InitCommonControls();
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
@ -1109,7 +1106,22 @@ static void test_monthcal_MaxSelDay(HWND hwnd)
START_TEST(monthcal)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
INITCOMMONCONTROLSEX iccex;
HWND hwnd, parent_wnd;
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (!pInitCommonControlsEx)
{
skip("InitCommonControlsEx() is missing. Skipping the tests\n");
return;
}
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_DATE_CLASSES;
pInitCommonControlsEx(&iccex);
test_monthcal();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);

View File

@ -90,10 +90,22 @@ static void update_window(HWND hWnd)
static void init(void)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
RECT rect;
InitCommonControls();
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (pInitCommonControlsEx)
{
INITCOMMONCONTROLSEX iccex;
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_PROGRESS_CLASS;
pInitCommonControlsEx(&iccex);
}
else
InitCommonControls();
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;

View File

@ -786,11 +786,23 @@ static void bandinfo_test(void)
START_TEST(rebar)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
INITCOMMONCONTROLSEX iccex;
WNDCLASSA wc;
MSG msg;
RECT rc;
InitCommonControls();
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (!pInitCommonControlsEx)
{
skip("InitCommonControlsEx() is missing. Skipping the tests\n");
return;
}
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_COOL_CLASSES;
pInitCommonControlsEx(&iccex);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;

View File

@ -649,10 +649,23 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
START_TEST(treeview)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
MSG msg;
InitCommonControls();
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (pInitCommonControlsEx)
{
INITCOMMONCONTROLSEX iccex;
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_TREEVIEW_CLASSES;
pInitCommonControlsEx(&iccex);
}
else
InitCommonControls();
init_msg_sequences(MsgSequences, NUM_MSG_SEQUENCES);
wc.style = CS_HREDRAW | CS_VREDRAW;