Commit e5b4c0f8 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

comctl32/tests: Call InitCommonControlsEx() if available, fall back to…

comctl32/tests: Call InitCommonControlsEx() if available, fall back to InitCommonControls() for the older controls, and skip the tests altogether for the newer ones.
parent fb36abae
...@@ -187,10 +187,23 @@ static LRESULT CALLBACK ComboExTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, L ...@@ -187,10 +187,23 @@ static LRESULT CALLBACK ComboExTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, L
return 0L; return 0L;
} }
static void init(void) { static int init(void)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc; 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.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
...@@ -209,7 +222,7 @@ static void init(void) { ...@@ -209,7 +222,7 @@ static void init(void) {
assert(hComboExParentWnd != NULL); assert(hComboExParentWnd != NULL);
hMainHinst = GetModuleHandleA(NULL); hMainHinst = GetModuleHandleA(NULL);
return 1;
} }
static void cleanup(void) static void cleanup(void)
...@@ -227,7 +240,8 @@ static void cleanup(void) ...@@ -227,7 +240,8 @@ static void cleanup(void)
START_TEST(comboex) START_TEST(comboex)
{ {
init(); if (!init())
return;
test_comboboxex(); test_comboboxex();
......
...@@ -560,7 +560,21 @@ static void test_datetime_control(void) ...@@ -560,7 +560,21 @@ static void test_datetime_control(void)
START_TEST(datetime) 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); init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
test_datetime_control(); test_datetime_control();
......
...@@ -1480,10 +1480,24 @@ static LRESULT CALLBACK HeaderTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LP ...@@ -1480,10 +1480,24 @@ static LRESULT CALLBACK HeaderTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
return 0L; return 0L;
} }
static void init(void) { static int init(void)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc; WNDCLASSA wc;
INITCOMMONCONTROLSEX iccex;
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (!pInitCommonControlsEx)
{
skip("InitCommonControlsEx() is missing. Skipping the tests\n");
return 0;
}
InitCommonControls(); iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_USEREX_CLASSES;
pInitCommonControlsEx(&iccex);
wc.style = CS_HREDRAW | CS_VREDRAW; wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
...@@ -1503,13 +1517,15 @@ static void init(void) { ...@@ -1503,13 +1517,15 @@ static void init(void) {
NULL, NULL, GetModuleHandleA(NULL), 0); NULL, NULL, GetModuleHandleA(NULL), 0);
assert(hHeaderParentWnd != NULL); assert(hHeaderParentWnd != NULL);
ShowWindow(hHeaderParentWnd, SW_SHOW); ShowWindow(hHeaderParentWnd, SW_SHOW);
return 1;
} }
START_TEST(header) START_TEST(header)
{ {
HWND parent_hwnd; HWND parent_hwnd;
init(); if (!init())
return;
test_header_control(); test_header_control();
test_header_order(); test_header_order();
......
...@@ -1040,6 +1040,19 @@ static void test_item_position(void) ...@@ -1040,6 +1040,19 @@ static void test_item_position(void)
START_TEST(listview) START_TEST(listview)
{ {
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(); InitCommonControls();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES); init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
......
...@@ -315,7 +315,6 @@ static void test_monthcal(void) ...@@ -315,7 +315,6 @@ static void test_monthcal(void)
SYSTEMTIME st[2], st1[2]; SYSTEMTIME st[2], st1[2];
int res, month_range; int res, month_range;
InitCommonControls();
hwnd = CreateWindowA(MONTHCAL_CLASSA, "MonthCal", WS_POPUP | WS_VISIBLE, CW_USEDEFAULT, hwnd = CreateWindowA(MONTHCAL_CLASSA, "MonthCal", WS_POPUP | WS_VISIBLE, CW_USEDEFAULT,
0, 300, 300, 0, 0, NULL, NULL); 0, 300, 300, 0, 0, NULL, NULL);
ok(hwnd != NULL, "Failed to create MonthCal\n"); ok(hwnd != NULL, "Failed to create MonthCal\n");
...@@ -478,8 +477,6 @@ static HWND create_monthcal_control(DWORD style, HWND parent_window) ...@@ -478,8 +477,6 @@ static HWND create_monthcal_control(DWORD style, HWND parent_window)
struct subclass_info *info; struct subclass_info *info;
HWND hwnd; HWND hwnd;
InitCommonControls();
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info)); info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info) if (!info)
return NULL; return NULL;
...@@ -1109,7 +1106,22 @@ static void test_monthcal_MaxSelDay(HWND hwnd) ...@@ -1109,7 +1106,22 @@ static void test_monthcal_MaxSelDay(HWND hwnd)
START_TEST(monthcal) START_TEST(monthcal)
{ {
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
INITCOMMONCONTROLSEX iccex;
HWND hwnd, parent_wnd; 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(); test_monthcal();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES); init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
......
...@@ -90,9 +90,21 @@ static void update_window(HWND hWnd) ...@@ -90,9 +90,21 @@ static void update_window(HWND hWnd)
static void init(void) static void init(void)
{ {
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc; WNDCLASSA wc;
RECT rect; RECT rect;
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(); InitCommonControls();
wc.style = CS_HREDRAW | CS_VREDRAW; wc.style = CS_HREDRAW | CS_VREDRAW;
......
...@@ -786,11 +786,23 @@ static void bandinfo_test(void) ...@@ -786,11 +786,23 @@ static void bandinfo_test(void)
START_TEST(rebar) START_TEST(rebar)
{ {
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
INITCOMMONCONTROLSEX iccex;
WNDCLASSA wc; WNDCLASSA wc;
MSG msg; MSG msg;
RECT rc; 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.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
......
...@@ -649,10 +649,23 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa ...@@ -649,10 +649,23 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
START_TEST(treeview) START_TEST(treeview)
{ {
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc; WNDCLASSA wc;
MSG msg; MSG msg;
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(); InitCommonControls();
init_msg_sequences(MsgSequences, NUM_MSG_SEQUENCES); init_msg_sequences(MsgSequences, NUM_MSG_SEQUENCES);
wc.style = CS_HREDRAW | CS_VREDRAW; wc.style = CS_HREDRAW | CS_VREDRAW;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment