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
return 0L;
}
static void init(void) {
static int init(void)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
InitCommonControls();
INITCOMMONCONTROLSEX iccex;
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();
......
......@@ -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();
......
......@@ -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;
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.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();
......
......@@ -1040,6 +1040,19 @@ static void test_item_position(void)
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();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
......
......@@ -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);
......
......@@ -90,9 +90,21 @@ static void update_window(HWND hWnd)
static void init(void)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
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();
wc.style = CS_HREDRAW | CS_VREDRAW;
......
......@@ -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;
......
......@@ -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;
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;
......
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