mirror of
https://github.com/reactos/reactos.git
synced 2024-12-22 10:33:30 +08:00
[COMCTL32_WINETEST] Sync with Wine Staging 3.3. CORE-14434
This commit is contained in:
parent
c3b4d356eb
commit
f37104dadf
@ -17,7 +17,15 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "commctrl.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#define SEARCHING_AVI_INDEX 151 /* From shell32 resource library */
|
||||
#define INVALID_AVI_INDEX 0xffff
|
||||
@ -100,26 +108,6 @@ static void create_animate(DWORD parent_style, DWORD animate_style)
|
||||
update_window(hAnimateParentWnd);
|
||||
}
|
||||
|
||||
static void init(void)
|
||||
{
|
||||
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_ANIMATE_CLASS;
|
||||
pInitCommonControlsEx(&iccex);
|
||||
}
|
||||
else
|
||||
InitCommonControls();
|
||||
|
||||
shell32 = LoadLibraryA("Shell32.dll");
|
||||
}
|
||||
|
||||
static void destroy_animate(void)
|
||||
{
|
||||
MSG msg;
|
||||
@ -167,7 +155,7 @@ static void test_play(void)
|
||||
|
||||
START_TEST(animate)
|
||||
{
|
||||
init();
|
||||
shell32 = LoadLibraryA("Shell32.dll");
|
||||
|
||||
test_play();
|
||||
|
||||
|
@ -22,13 +22,10 @@
|
||||
|
||||
#undef USE_WINE_TODOS
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <wingdi.h>
|
||||
#include <winuser.h>
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
#include "msg.h"
|
||||
|
||||
@ -59,20 +56,14 @@ struct wndclass_redirect_data
|
||||
/* returned pointer is valid as long as activation context is alive */
|
||||
static WCHAR* get_versioned_classname(const WCHAR *name)
|
||||
{
|
||||
BOOL (WINAPI *pFindActCtxSectionStringW)(DWORD,const GUID *,ULONG,LPCWSTR,PACTCTX_SECTION_KEYED_DATA);
|
||||
struct wndclass_redirect_data *wnddata;
|
||||
ACTCTX_SECTION_KEYED_DATA data;
|
||||
BOOL ret;
|
||||
|
||||
pFindActCtxSectionStringW = (void*)GetProcAddress(GetModuleHandleA("kernel32"), "FindActCtxSectionStringW");
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.cbSize = sizeof(data);
|
||||
|
||||
ret = pFindActCtxSectionStringW(0, NULL,
|
||||
ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION,
|
||||
name, &data);
|
||||
ok(ret, "got %d, error %u\n", ret, GetLastError());
|
||||
ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, name, &data);
|
||||
ok(ret, "Failed to find class redirection section, error %u\n", GetLastError());
|
||||
wnddata = (struct wndclass_redirect_data*)data.lpData;
|
||||
return (WCHAR*)((BYTE*)wnddata + wnddata->name_offset);
|
||||
}
|
||||
@ -361,8 +352,6 @@ static const struct message setstate_seq[] =
|
||||
{ BM_SETSTATE, sent },
|
||||
{ WM_APP, sent|wparam|lparam, 0, 0 },
|
||||
{ WM_PAINT, sent },
|
||||
{ WM_NCPAINT, sent|optional }, /* FIXME: Wine sends it */
|
||||
{ WM_ERASEBKGND, sent|defwinproc|optional },
|
||||
{ WM_PAINT, sent|optional },
|
||||
{ 0 }
|
||||
};
|
||||
@ -383,8 +372,6 @@ static const struct message setstate_user_seq[] =
|
||||
{ WM_COMMAND, sent|wparam|parent, MAKEWPARAM(ID_BUTTON, BN_HILITE) },
|
||||
{ WM_APP, sent|wparam|lparam, 0, 0 },
|
||||
{ WM_PAINT, sent },
|
||||
{ WM_NCPAINT, sent|optional }, /* FIXME: Wine sends it */
|
||||
{ WM_ERASEBKGND, sent|defwinproc|optional },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
@ -455,8 +442,7 @@ static const struct message setcheck_radio_redraw_seq[] =
|
||||
{ WM_STYLECHANGED, sent|wparam|defwinproc, GWL_STYLE },
|
||||
{ WM_APP, sent|wparam|lparam, 0, 0 },
|
||||
{ WM_PAINT, sent },
|
||||
{ WM_NCPAINT, sent|optional }, /* FIXME: Wine sends it */
|
||||
{ WM_ERASEBKGND, sent|defwinproc|optional },
|
||||
{ WM_NCPAINT, sent|defwinproc|optional }, /* FIXME: Wine sends it */
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
@ -470,7 +456,7 @@ static HWND create_button(DWORD style, HWND parent)
|
||||
style |= WS_CHILD|BS_NOTIFY;
|
||||
menuid = (HMENU)ID_BUTTON;
|
||||
}
|
||||
hwnd = CreateWindowExA(0, "Button", "test", style, 0, 0, 50, 14, parent, menuid, 0, NULL);
|
||||
hwnd = CreateWindowExA(0, WC_BUTTONA, "test", style, 0, 0, 50, 14, parent, menuid, 0, NULL);
|
||||
ok(hwnd != NULL, "failed to create a button, 0x%08x, %p\n", style, parent);
|
||||
pSetWindowSubclass(hwnd, button_subclass_proc, 0, 0);
|
||||
return hwnd;
|
||||
@ -522,12 +508,25 @@ static void test_button_messages(void)
|
||||
{ BS_OWNERDRAW, DLGC_BUTTON,
|
||||
setfocus_ownerdraw_seq, killfocus_ownerdraw_seq, setstyle_ownerdraw_seq,
|
||||
setstate_ownerdraw_seq, clearstate_ownerdraw_seq, setcheck_ignored_seq },
|
||||
{ BS_SPLITBUTTON, DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON | DLGC_WANTARROWS,
|
||||
setfocus_seq, killfocus_seq, setstyle_seq,
|
||||
setstate_seq, setstate_seq, setcheck_ignored_seq },
|
||||
{ BS_DEFSPLITBUTTON, DLGC_BUTTON | DLGC_DEFPUSHBUTTON | DLGC_WANTARROWS,
|
||||
setfocus_seq, killfocus_seq, setstyle_seq,
|
||||
setstate_seq, setstate_seq, setcheck_ignored_seq },
|
||||
{ BS_COMMANDLINK, DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON,
|
||||
setfocus_seq, killfocus_seq, setstyle_seq,
|
||||
setstate_seq, setstate_seq, setcheck_ignored_seq },
|
||||
{ BS_DEFCOMMANDLINK, DLGC_BUTTON | DLGC_DEFPUSHBUTTON,
|
||||
setfocus_seq, killfocus_seq, setstyle_seq,
|
||||
setstate_seq, setstate_seq, setcheck_ignored_seq },
|
||||
};
|
||||
LOGFONTA logfont = { 0 };
|
||||
const struct message *seq;
|
||||
HFONT zfont, hfont2;
|
||||
unsigned int i;
|
||||
HWND hwnd, parent;
|
||||
DWORD dlg_code;
|
||||
HFONT zfont;
|
||||
BOOL todo;
|
||||
|
||||
/* selection with VK_SPACE should capture button window */
|
||||
@ -544,10 +543,19 @@ static void test_button_messages(void)
|
||||
100, 100, 200, 200, 0, 0, 0, NULL);
|
||||
ok(parent != 0, "Failed to create parent window\n");
|
||||
|
||||
logfont.lfHeight = -12;
|
||||
logfont.lfWeight = FW_NORMAL;
|
||||
strcpy(logfont.lfFaceName, "Tahoma");
|
||||
|
||||
hfont2 = CreateFontIndirectA(&logfont);
|
||||
ok(hfont2 != NULL, "Failed to create Tahoma font\n");
|
||||
|
||||
for (i = 0; i < sizeof(button)/sizeof(button[0]); i++)
|
||||
{
|
||||
HFONT prevfont, hfont;
|
||||
MSG msg;
|
||||
DWORD style, state;
|
||||
HDC hdc;
|
||||
|
||||
trace("%d: button test sequence\n", i);
|
||||
hwnd = create_button(button[i].style, parent);
|
||||
@ -561,7 +569,15 @@ static void test_button_messages(void)
|
||||
ok(style == button[i].style, "expected style %x got %x\n", button[i].style, style);
|
||||
|
||||
dlg_code = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0);
|
||||
ok(dlg_code == button[i].dlg_code, "%u: wrong dlg_code %08x\n", i, dlg_code);
|
||||
if (button[i].style == BS_SPLITBUTTON ||
|
||||
button[i].style == BS_DEFSPLITBUTTON ||
|
||||
button[i].style == BS_COMMANDLINK ||
|
||||
button[i].style == BS_DEFCOMMANDLINK)
|
||||
{
|
||||
ok(dlg_code == button[i].dlg_code || broken(dlg_code == DLGC_BUTTON) /* WinXP */, "%u: wrong dlg_code %08x\n", i, dlg_code);
|
||||
}
|
||||
else
|
||||
ok(dlg_code == button[i].dlg_code, "%u: wrong dlg_code %08x\n", i, dlg_code);
|
||||
|
||||
ShowWindow(hwnd, SW_SHOW);
|
||||
UpdateWindow(hwnd);
|
||||
@ -587,7 +603,8 @@ static void test_button_messages(void)
|
||||
SendMessageA(hwnd, BM_SETSTYLE, button[i].style | BS_BOTTOM, TRUE);
|
||||
SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
|
||||
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setstyle, "BM_SETSTYLE on a button", TRUE);
|
||||
todo = button[i].style == BS_OWNERDRAW;
|
||||
ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setstyle, "BM_SETSTYLE on a button", todo);
|
||||
|
||||
style = GetWindowLongA(hwnd, GWL_STYLE);
|
||||
style &= ~(WS_VISIBLE | WS_CHILD | BS_NOTIFY);
|
||||
@ -602,7 +619,7 @@ static void test_button_messages(void)
|
||||
SendMessageA(hwnd, BM_SETSTATE, TRUE, 0);
|
||||
SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
|
||||
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setstate, "BM_SETSTATE/TRUE on a button", TRUE);
|
||||
ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setstate, "BM_SETSTATE/TRUE on a button", FALSE);
|
||||
|
||||
state = SendMessageA(hwnd, BM_GETSTATE, 0, 0);
|
||||
ok(state == BST_PUSHED, "expected state 0x0004, got %04x\n", state);
|
||||
@ -616,7 +633,7 @@ static void test_button_messages(void)
|
||||
SendMessageA(hwnd, BM_SETSTATE, FALSE, 0);
|
||||
SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
|
||||
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].clearstate, "BM_SETSTATE/FALSE on a button", TRUE);
|
||||
ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].clearstate, "BM_SETSTATE/FALSE on a button", FALSE);
|
||||
|
||||
state = SendMessageA(hwnd, BM_GETSTATE, 0, 0);
|
||||
ok(state == 0, "expected state 0, got %04x\n", state);
|
||||
@ -634,17 +651,14 @@ static void test_button_messages(void)
|
||||
button[i].style == BS_AUTORADIOBUTTON)
|
||||
{
|
||||
seq = setcheck_radio_seq;
|
||||
todo = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
seq = setcheck_ignored_seq;
|
||||
todo = FALSE;
|
||||
}
|
||||
|
||||
SendMessageA(hwnd, BM_SETCHECK, BST_UNCHECKED, 0);
|
||||
SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
|
||||
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
ok_sequence(sequences, COMBINED_SEQ_INDEX, seq, "BM_SETCHECK on a button", todo);
|
||||
ok_sequence(sequences, COMBINED_SEQ_INDEX, seq, "BM_SETCHECK on a button", FALSE);
|
||||
|
||||
state = SendMessageA(hwnd, BM_GETCHECK, 0, 0);
|
||||
ok(state == BST_UNCHECKED, "expected BST_UNCHECKED, got %04x\n", state);
|
||||
@ -658,23 +672,23 @@ static void test_button_messages(void)
|
||||
SendMessageA(hwnd, BM_SETCHECK, BST_CHECKED, 0);
|
||||
SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
|
||||
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setcheck, "BM_SETCHECK on a button", FALSE);
|
||||
|
||||
state = SendMessageA(hwnd, BM_GETCHECK, 0, 0);
|
||||
if (button[i].style == BS_PUSHBUTTON ||
|
||||
button[i].style == BS_DEFPUSHBUTTON ||
|
||||
button[i].style == BS_GROUPBOX ||
|
||||
button[i].style == BS_USERBUTTON ||
|
||||
button[i].style == BS_OWNERDRAW)
|
||||
button[i].style == BS_OWNERDRAW ||
|
||||
button[i].style == BS_SPLITBUTTON ||
|
||||
button[i].style == BS_DEFSPLITBUTTON ||
|
||||
button[i].style == BS_COMMANDLINK ||
|
||||
button[i].style == BS_DEFCOMMANDLINK)
|
||||
{
|
||||
ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setcheck, "BM_SETCHECK on a button", FALSE);
|
||||
state = SendMessageA(hwnd, BM_GETCHECK, 0, 0);
|
||||
ok(state == BST_UNCHECKED, "expected check BST_UNCHECKED, got %04x\n", state);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setcheck, "BM_SETCHECK on a button", TRUE);
|
||||
state = SendMessageA(hwnd, BM_GETCHECK, 0, 0);
|
||||
ok(state == BST_CHECKED, "expected check BST_CHECKED, got %04x\n", state);
|
||||
}
|
||||
|
||||
style = GetWindowLongA(hwnd, GWL_STYLE);
|
||||
style &= ~(WS_CHILD | BS_NOTIFY | WS_VISIBLE);
|
||||
@ -684,9 +698,32 @@ static void test_button_messages(void)
|
||||
else
|
||||
ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style);
|
||||
|
||||
/* Test that original font is not selected back after painting */
|
||||
hfont = (HFONT)SendMessageA(hwnd, WM_GETFONT, 0, 0);
|
||||
ok(hfont == NULL, "Unexpected control font.\n");
|
||||
|
||||
SendMessageA(hwnd, WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT), 0);
|
||||
|
||||
hdc = CreateCompatibleDC(0);
|
||||
|
||||
prevfont = SelectObject(hdc, hfont2);
|
||||
SendMessageA(hwnd, WM_PRINTCLIENT, (WPARAM)hdc, 0);
|
||||
ok(hfont2 != GetCurrentObject(hdc, OBJ_FONT) || broken(hfont2 == GetCurrentObject(hdc, OBJ_FONT)) /* WinXP */,
|
||||
"button[%u]: unexpected font selected after WM_PRINTCLIENT\n", i);
|
||||
SelectObject(hdc, prevfont);
|
||||
|
||||
prevfont = SelectObject(hdc, hfont2);
|
||||
SendMessageA(hwnd, WM_PAINT, (WPARAM)hdc, 0);
|
||||
ok(hfont2 != GetCurrentObject(hdc, OBJ_FONT) || broken(hfont2 == GetCurrentObject(hdc, OBJ_FONT)) /* WinXP */,
|
||||
"button[%u]: unexpected font selected after WM_PAINT\n", i);
|
||||
SelectObject(hdc, prevfont);
|
||||
|
||||
DeleteDC(hdc);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
DeleteObject(hfont2);
|
||||
DestroyWindow(parent);
|
||||
|
||||
hwnd = create_button(BS_PUSHBUTTON, NULL);
|
||||
@ -726,21 +763,22 @@ static void test_button_class(void)
|
||||
|
||||
ret = GetClassInfoExA(NULL, WC_BUTTONA, &exA);
|
||||
ok(ret, "got %d\n", ret);
|
||||
todo_wine
|
||||
ok(IS_WNDPROC_HANDLE(exA.lpfnWndProc), "got %p\n", exA.lpfnWndProc);
|
||||
ok(exA.cbClsExtra == 0, "Unexpected class bytes %d.\n", exA.cbClsExtra);
|
||||
ok(exA.cbWndExtra == sizeof(void *), "Unexpected window bytes %d.\n", exA.cbWndExtra);
|
||||
|
||||
ret = GetClassInfoExW(NULL, WC_BUTTONW, &exW);
|
||||
ok(ret, "got %d\n", ret);
|
||||
ok(!IS_WNDPROC_HANDLE(exW.lpfnWndProc), "got %p\n", exW.lpfnWndProc);
|
||||
ok(exW.cbClsExtra == 0, "Unexpected class bytes %d.\n", exW.cbClsExtra);
|
||||
ok(exW.cbWndExtra == sizeof(void *), "Unexpected window bytes %d.\n", exW.cbWndExtra);
|
||||
|
||||
/* check that versioned class is also accessible */
|
||||
nameW = get_versioned_classname(WC_BUTTONW);
|
||||
ok(lstrcmpW(nameW, WC_BUTTONW), "got %s\n", wine_dbgstr_w(nameW));
|
||||
|
||||
ret = GetClassInfoExW(NULL, nameW, &ex2W);
|
||||
todo_wine
|
||||
ok(ret, "got %d\n", ret);
|
||||
if (ret) /* TODO: remove once Wine is fixed */
|
||||
ok(ex2W.lpfnWndProc == exW.lpfnWndProc, "got %p, %p\n", exW.lpfnWndProc, ex2W.lpfnWndProc);
|
||||
|
||||
/* Check reported class name */
|
||||
@ -756,10 +794,8 @@ if (ret) /* TODO: remove once Wine is fixed */
|
||||
|
||||
/* explicitly create with versioned class name */
|
||||
hwnd = CreateWindowExW(0, nameW, testW, BS_CHECKBOX, 0, 0, 50, 14, NULL, 0, 0, NULL);
|
||||
todo_wine
|
||||
ok(hwnd != NULL, "failed to create a window %s\n", wine_dbgstr_w(nameW));
|
||||
if (hwnd)
|
||||
{
|
||||
|
||||
len = GetClassNameA(hwnd, buffA, sizeof(buffA));
|
||||
ok(len == strlen(buffA), "got %d\n", len);
|
||||
ok(!strcmp(buffA, "Button"), "got %s\n", buffA);
|
||||
@ -770,7 +806,6 @@ if (hwnd)
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
}
|
||||
|
||||
static void register_parent_class(void)
|
||||
{
|
||||
|
@ -18,7 +18,14 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
#include "msg.h"
|
||||
|
||||
#define EDITBOX_SEQ_INDEX 0
|
||||
#define NUM_MSG_SEQUENCES 1
|
||||
@ -150,7 +157,7 @@ static void test_comboex(void)
|
||||
*out_of_range_item = "Out of Range Item";
|
||||
|
||||
/* Allocate space for result */
|
||||
textBuffer = HeapAlloc(GetProcessHeap(), 0, MAX_CHARS);
|
||||
textBuffer = heap_alloc(MAX_CHARS);
|
||||
|
||||
/* Basic comboboxex test */
|
||||
myHwnd = createComboEx(WS_BORDER | WS_VISIBLE | WS_CHILD | CBS_DROPDOWN);
|
||||
@ -236,7 +243,7 @@ static void test_comboex(void)
|
||||
|
||||
|
||||
/* Cleanup */
|
||||
HeapFree(GetProcessHeap(), 0, textBuffer);
|
||||
heap_free(textBuffer);
|
||||
DestroyWindow(myHwnd);
|
||||
}
|
||||
|
||||
@ -473,25 +480,20 @@ static LRESULT CALLBACK ComboExTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, L
|
||||
return 0L;
|
||||
}
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
#define X2(f, ord) p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
|
||||
X2(SetWindowSubclass, 410);
|
||||
#undef X
|
||||
#undef X2
|
||||
}
|
||||
|
||||
static BOOL init(void)
|
||||
{
|
||||
HMODULE hComctl32;
|
||||
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
WNDCLASSA wc;
|
||||
INITCOMMONCONTROLSEX iccex;
|
||||
|
||||
hComctl32 = GetModuleHandleA("comctl32.dll");
|
||||
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
|
||||
if (!pInitCommonControlsEx)
|
||||
{
|
||||
win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
|
||||
return FALSE;
|
||||
}
|
||||
iccex.dwSize = sizeof(iccex);
|
||||
iccex.dwICC = ICC_USEREX_CLASSES;
|
||||
pInitCommonControlsEx(&iccex);
|
||||
|
||||
pSetWindowSubclass = (void*)GetProcAddress(hComctl32, (LPSTR)410);
|
||||
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.cbClsExtra = 0;
|
||||
@ -505,7 +507,7 @@ static BOOL init(void)
|
||||
wc.lpfnWndProc = ComboExTestWndProc;
|
||||
RegisterClassA(&wc);
|
||||
|
||||
hMainWnd = CreateWindowA("static", "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0);
|
||||
hMainWnd = CreateWindowA(WC_STATICA, "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0);
|
||||
ShowWindow(hMainWnd, SW_SHOW);
|
||||
|
||||
hComboExParentWnd = CreateWindowExA(0, ComboExTestClass, "ComboEx test", WS_OVERLAPPEDWINDOW|WS_VISIBLE,
|
||||
@ -604,7 +606,7 @@ static void test_comboex_get_set_item(void)
|
||||
|
||||
static HWND create_combobox(DWORD style)
|
||||
{
|
||||
return CreateWindowA("ComboBox", "Combo", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
|
||||
return CreateWindowA(WC_COMBOBOXA, "Combo", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
|
||||
}
|
||||
|
||||
static int font_height(HFONT hFont)
|
||||
@ -1033,7 +1035,7 @@ static void test_combo_editselection_focus(DWORD style)
|
||||
get_combobox_info(hCombo, &cbInfo);
|
||||
hEdit = cbInfo.hwndItem;
|
||||
|
||||
hButton = CreateWindowA("Button", "OK", WS_VISIBLE|WS_CHILD|BS_DEFPUSHBUTTON,
|
||||
hButton = CreateWindowA(WC_BUTTONA, "OK", WS_VISIBLE|WS_CHILD|BS_DEFPUSHBUTTON,
|
||||
5, 50, 100, 20, hMainWnd, NULL,
|
||||
(HINSTANCE)GetWindowLongPtrA(hMainWnd, GWLP_HINSTANCE), NULL);
|
||||
|
||||
@ -1149,11 +1151,121 @@ static void test_combo_WS_VSCROLL(void)
|
||||
DestroyWindow(hCombo);
|
||||
}
|
||||
|
||||
static void test_combo_dropdown_size(DWORD style)
|
||||
{
|
||||
static const char wine_test[] = "Wine Test";
|
||||
HWND hCombo, hList;
|
||||
COMBOBOXINFO cbInfo;
|
||||
int i, test, ret;
|
||||
|
||||
static const struct list_size_info
|
||||
{
|
||||
int num_items;
|
||||
int height_combo;
|
||||
int limit;
|
||||
} info_height[] = {
|
||||
{33, 50, -1},
|
||||
{35, 50, 40},
|
||||
{15, 50, 3},
|
||||
};
|
||||
|
||||
for (test = 0; test < sizeof(info_height) / sizeof(info_height[0]); test++)
|
||||
{
|
||||
const struct list_size_info *info_test = &info_height[test];
|
||||
int height_item; /* Height of a list item */
|
||||
int height_list; /* Height of the list we got */
|
||||
int expected_height_list;
|
||||
RECT rect_list_client;
|
||||
int min_visible_expected;
|
||||
|
||||
hCombo = CreateWindowA(WC_COMBOBOXA, "Combo", CBS_DROPDOWN | WS_VISIBLE | WS_CHILD | style, 5, 5, 100,
|
||||
info_test->height_combo, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
|
||||
|
||||
min_visible_expected = SendMessageA(hCombo, CB_GETMINVISIBLE, 0, 0);
|
||||
todo_wine
|
||||
ok(min_visible_expected == 30, "Unexpected number of items %d.\n", min_visible_expected);
|
||||
|
||||
cbInfo.cbSize = sizeof(COMBOBOXINFO);
|
||||
ret = SendMessageA(hCombo, CB_GETCOMBOBOXINFO, 0, (LPARAM)&cbInfo);
|
||||
ok(ret, "Failed to get combo info, %d\n", ret);
|
||||
|
||||
hList = cbInfo.hwndList;
|
||||
for (i = 0; i < info_test->num_items; i++)
|
||||
{
|
||||
ret = SendMessageA(hCombo, CB_ADDSTRING, 0, (LPARAM) wine_test);
|
||||
ok(ret == i, "Failed to add string %d, returned %d.\n", i, ret);
|
||||
}
|
||||
|
||||
if (info_test->limit != -1)
|
||||
{
|
||||
int min_visible_actual;
|
||||
min_visible_expected = info_test->limit;
|
||||
|
||||
ret = SendMessageA(hCombo, CB_SETMINVISIBLE, min_visible_expected, 0);
|
||||
todo_wine
|
||||
ok(ret, "Failed to set visible limit.\n");
|
||||
min_visible_actual = SendMessageA(hCombo, CB_GETMINVISIBLE, 0, 0);
|
||||
todo_wine
|
||||
ok(min_visible_expected == min_visible_actual, "test %d: unexpected number of items %d.\n",
|
||||
test, min_visible_actual);
|
||||
}
|
||||
|
||||
ret = SendMessageA(hCombo, CB_SHOWDROPDOWN, TRUE,0);
|
||||
ok(ret, "Failed to show dropdown.\n");
|
||||
ret = SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0);
|
||||
ok(ret, "Unexpected dropped state.\n");
|
||||
|
||||
GetClientRect(hList, &rect_list_client);
|
||||
height_list = rect_list_client.bottom - rect_list_client.top;
|
||||
height_item = (int)SendMessageA(hList, LB_GETITEMHEIGHT, 0, 0);
|
||||
|
||||
if (style & CBS_NOINTEGRALHEIGHT)
|
||||
{
|
||||
RECT rect_list_complete;
|
||||
int list_height_nonclient;
|
||||
int list_height_calculated;
|
||||
int edit_padding_size = cbInfo.rcItem.top; /* edit client rect top is the padding it has to its parent
|
||||
We assume it's the same on the bottom */
|
||||
|
||||
GetWindowRect(hList, &rect_list_complete);
|
||||
|
||||
list_height_nonclient = (rect_list_complete.bottom - rect_list_complete.top)
|
||||
- (rect_list_client.bottom - rect_list_client.top);
|
||||
|
||||
/* Calculate the expected client size of the listbox popup from the size of the combobox. */
|
||||
list_height_calculated = info_test->height_combo /* Take height we created combobox with */
|
||||
- (cbInfo.rcItem.bottom - cbInfo.rcItem.top) /* Subtract size of edit control */
|
||||
- list_height_nonclient /* Subtract list nonclient area */
|
||||
- edit_padding_size * 2; /* subtract space around the edit control */
|
||||
|
||||
expected_height_list = min(list_height_calculated, height_item * info_test->num_items);
|
||||
if (expected_height_list < 0)
|
||||
expected_height_list = 0;
|
||||
|
||||
todo_wine
|
||||
ok(expected_height_list == height_list, "Test %d, expected list height to be %d, got %d\n",
|
||||
test, expected_height_list, height_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
expected_height_list = min(info_test->num_items, min_visible_expected) * height_item;
|
||||
|
||||
todo_wine
|
||||
ok(expected_height_list == height_list, "Test %d, expected list height to be %d, got %d\n",
|
||||
test, expected_height_list, height_list);
|
||||
}
|
||||
|
||||
DestroyWindow(hCombo);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(combo)
|
||||
{
|
||||
ULONG_PTR ctx_cookie;
|
||||
HANDLE hCtx;
|
||||
|
||||
init_functions();
|
||||
|
||||
if (!init())
|
||||
return;
|
||||
|
||||
@ -1188,6 +1300,8 @@ START_TEST(combo)
|
||||
test_combo_listbox_styles(CBS_SIMPLE);
|
||||
test_combo_listbox_styles(CBS_DROPDOWN);
|
||||
test_combo_listbox_styles(CBS_DROPDOWNLIST);
|
||||
test_combo_dropdown_size(0);
|
||||
test_combo_dropdown_size(CBS_NOINTEGRALHEIGHT);
|
||||
|
||||
cleanup();
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
|
@ -17,7 +17,12 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "msg.h"
|
||||
#include "v6util.h"
|
||||
|
||||
#define expect(EXPECTED, GOT) ok((GOT)==(EXPECTED), "Expected %d, got %ld\n", (EXPECTED), (GOT))
|
||||
|
||||
@ -26,6 +31,8 @@
|
||||
#define NUM_MSG_SEQUENCES 1
|
||||
#define DATETIME_SEQ_INDEX 0
|
||||
|
||||
static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
|
||||
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
|
||||
|
||||
static const struct message test_dtm_set_format_seq[] = {
|
||||
@ -773,19 +780,23 @@ static void test_dts_shownone(void)
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
X(InitCommonControlsEx);
|
||||
#undef X
|
||||
}
|
||||
|
||||
START_TEST(datetime)
|
||||
{
|
||||
HMODULE hComctl32;
|
||||
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
INITCOMMONCONTROLSEX iccex;
|
||||
ULONG_PTR cookie;
|
||||
HANDLE ctxt;
|
||||
|
||||
init_functions();
|
||||
|
||||
hComctl32 = GetModuleHandleA("comctl32.dll");
|
||||
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
|
||||
if (!pInitCommonControlsEx)
|
||||
{
|
||||
win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
|
||||
return;
|
||||
}
|
||||
iccex.dwSize = sizeof(iccex);
|
||||
iccex.dwICC = ICC_DATE_CLASSES;
|
||||
pInitCommonControlsEx(&iccex);
|
||||
@ -802,4 +813,16 @@ START_TEST(datetime)
|
||||
test_dtm_set_and_get_systemtime_with_limits();
|
||||
test_wm_set_get_text();
|
||||
test_dts_shownone();
|
||||
|
||||
if (!load_v6_module(&cookie, &ctxt))
|
||||
return;
|
||||
|
||||
test_dtm_set_format();
|
||||
test_dtm_set_and_get_mccolor();
|
||||
test_dtm_set_and_get_mcfont();
|
||||
test_dtm_get_monthcal();
|
||||
test_wm_set_get_text();
|
||||
test_dts_shownone();
|
||||
|
||||
unload_v6_module(cookie, ctxt);
|
||||
}
|
||||
|
@ -19,7 +19,18 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#define COBJMACROS
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "commctrl.h"
|
||||
#include "objidl.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
|
||||
|
||||
@ -49,38 +60,33 @@ static INT (WINAPI *pDPA_Search)(HDPA,PVOID,INT,PFNDPACOMPARE,LPARAM,UINT);
|
||||
static BOOL (WINAPI *pDPA_SetPtr)(HDPA,INT,PVOID);
|
||||
static BOOL (WINAPI *pDPA_Sort)(HDPA,PFNDPACOMPARE,LPARAM);
|
||||
|
||||
#define COMCTL32_GET_PROC(func, ord) \
|
||||
((p ## func = (PVOID)GetProcAddress(hcomctl32,(LPCSTR)ord)) ? 1 \
|
||||
: (trace( #func " not exported\n"), 0))
|
||||
|
||||
static BOOL InitFunctionPtrs(HMODULE hcomctl32)
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X2(f, ord) p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
|
||||
/* 4.00+ */
|
||||
if(COMCTL32_GET_PROC(DPA_Clone, 331) &&
|
||||
COMCTL32_GET_PROC(DPA_Create, 328) &&
|
||||
COMCTL32_GET_PROC(DPA_CreateEx, 340) &&
|
||||
COMCTL32_GET_PROC(DPA_DeleteAllPtrs, 337) &&
|
||||
COMCTL32_GET_PROC(DPA_DeletePtr, 336) &&
|
||||
COMCTL32_GET_PROC(DPA_Destroy, 329) &&
|
||||
COMCTL32_GET_PROC(DPA_GetPtr, 332) &&
|
||||
COMCTL32_GET_PROC(DPA_GetPtrIndex, 333) &&
|
||||
COMCTL32_GET_PROC(DPA_Grow, 330) &&
|
||||
COMCTL32_GET_PROC(DPA_InsertPtr, 334) &&
|
||||
COMCTL32_GET_PROC(DPA_Search, 339) &&
|
||||
COMCTL32_GET_PROC(DPA_SetPtr, 335) &&
|
||||
COMCTL32_GET_PROC(DPA_Sort, 338))
|
||||
{
|
||||
/* 4.71+ */
|
||||
COMCTL32_GET_PROC(DPA_DestroyCallback, 386) &&
|
||||
COMCTL32_GET_PROC(DPA_EnumCallback, 385) &&
|
||||
COMCTL32_GET_PROC(DPA_LoadStream, 9) &&
|
||||
COMCTL32_GET_PROC(DPA_Merge, 11) &&
|
||||
COMCTL32_GET_PROC(DPA_SaveStream, 10);
|
||||
X2(DPA_Clone, 331);
|
||||
X2(DPA_Create, 328);
|
||||
X2(DPA_CreateEx, 340);
|
||||
X2(DPA_DeleteAllPtrs, 337);
|
||||
X2(DPA_DeletePtr, 336);
|
||||
X2(DPA_Destroy, 329);
|
||||
X2(DPA_GetPtr, 332);
|
||||
X2(DPA_GetPtrIndex, 333);
|
||||
X2(DPA_Grow, 330);
|
||||
X2(DPA_InsertPtr, 334);
|
||||
X2(DPA_Search, 339);
|
||||
X2(DPA_SetPtr, 335);
|
||||
X2(DPA_Sort, 338);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
/* 4.71+ */
|
||||
X2(DPA_DestroyCallback, 386);
|
||||
X2(DPA_EnumCallback, 385);
|
||||
X2(DPA_LoadStream, 9);
|
||||
X2(DPA_Merge, 11);
|
||||
X2(DPA_SaveStream, 10);
|
||||
#undef X2
|
||||
}
|
||||
|
||||
/* Callbacks */
|
||||
@ -618,7 +624,7 @@ static void test_DPA_LoadStream(void)
|
||||
dpa = NULL;
|
||||
hRes = pDPA_LoadStream(&dpa, CB_Load, pStm, NULL);
|
||||
expect(S_OK, hRes);
|
||||
DPA_Destroy(dpa);
|
||||
pDPA_Destroy(dpa);
|
||||
|
||||
/* try with altered dwData2 field */
|
||||
header.dwSize = sizeof(header);
|
||||
@ -732,15 +738,10 @@ if (0) {
|
||||
|
||||
START_TEST(dpa)
|
||||
{
|
||||
HMODULE hcomctl32;
|
||||
ULONG_PTR cookie;
|
||||
HANDLE ctxt;
|
||||
|
||||
hcomctl32 = GetModuleHandleA("comctl32.dll");
|
||||
|
||||
if(!InitFunctionPtrs(hcomctl32))
|
||||
{
|
||||
win_skip("Needed functions are not available\n");
|
||||
return;
|
||||
}
|
||||
init_functions();
|
||||
|
||||
test_dpa();
|
||||
test_DPA_Merge();
|
||||
@ -748,4 +749,18 @@ START_TEST(dpa)
|
||||
test_DPA_DestroyCallback();
|
||||
test_DPA_LoadStream();
|
||||
test_DPA_SaveStream();
|
||||
|
||||
if (!load_v6_module(&cookie, &ctxt))
|
||||
return;
|
||||
|
||||
init_functions();
|
||||
|
||||
test_dpa();
|
||||
test_DPA_Merge();
|
||||
test_DPA_EnumCallback();
|
||||
test_DPA_DestroyCallback();
|
||||
test_DPA_LoadStream();
|
||||
test_DPA_SaveStream();
|
||||
|
||||
unload_v6_module(cookie, ctxt);
|
||||
}
|
||||
|
@ -18,7 +18,12 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
#include "msg.h"
|
||||
|
||||
#ifndef ES_COMBO
|
||||
#define ES_COMBO 0x200
|
||||
@ -28,6 +33,20 @@
|
||||
#define ID_EDITTEST2 99
|
||||
#define MAXLEN 200
|
||||
|
||||
enum seq_index
|
||||
{
|
||||
COMBINED_SEQ_INDEX = 0,
|
||||
NUM_MSG_SEQUENCES,
|
||||
};
|
||||
|
||||
enum msg_id
|
||||
{
|
||||
PARENT_ID,
|
||||
EDIT_ID,
|
||||
};
|
||||
|
||||
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
|
||||
|
||||
struct edit_notify {
|
||||
int en_change, en_maxtext, en_update;
|
||||
};
|
||||
@ -540,14 +559,10 @@ static HWND create_editcontrol (DWORD style, DWORD exstyle)
|
||||
{
|
||||
HWND handle;
|
||||
|
||||
handle = CreateWindowExA(exstyle,
|
||||
"EDIT",
|
||||
"Test Text",
|
||||
style,
|
||||
10, 10, 300, 300,
|
||||
NULL, NULL, hinst, NULL);
|
||||
handle = CreateWindowExA(exstyle, WC_EDITA, "Text Text", style, 10, 10, 300, 300,
|
||||
NULL, NULL, hinst, NULL);
|
||||
ok (handle != NULL, "CreateWindow EDIT Control failed\n");
|
||||
assert (handle);
|
||||
|
||||
if (winetest_interactive)
|
||||
ShowWindow (handle, SW_SHOW);
|
||||
return handle;
|
||||
@ -582,7 +597,6 @@ static HWND create_child_editcontrol (DWORD style, DWORD exstyle)
|
||||
rect.right - rect.left, rect.bottom - rect.top,
|
||||
NULL, NULL, hinst, NULL);
|
||||
ok (parentWnd != NULL, "CreateWindow EDIT Test failed\n");
|
||||
assert(parentWnd);
|
||||
|
||||
editWnd = CreateWindowExA(exstyle,
|
||||
"EDIT",
|
||||
@ -591,7 +605,6 @@ static HWND create_child_editcontrol (DWORD style, DWORD exstyle)
|
||||
0, 0, 300, 300,
|
||||
parentWnd, NULL, hinst, NULL);
|
||||
ok (editWnd != NULL, "CreateWindow EDIT Test Text failed\n");
|
||||
assert(editWnd);
|
||||
if (winetest_interactive)
|
||||
ShowWindow (parentWnd, SW_SHOW);
|
||||
return editWnd;
|
||||
@ -738,15 +751,14 @@ static void test_edit_control_2(void)
|
||||
/* Create main and edit windows. */
|
||||
hwndMain = CreateWindowA(szEditTest2Class, "ET2", WS_OVERLAPPEDWINDOW,
|
||||
0, 0, 200, 200, NULL, NULL, hinst, NULL);
|
||||
assert(hwndMain);
|
||||
ok(hwndMain != NULL, "Failed to create control parent.\n");
|
||||
if (winetest_interactive)
|
||||
ShowWindow (hwndMain, SW_SHOW);
|
||||
|
||||
hwndET2 = CreateWindowA("EDIT", NULL,
|
||||
WS_CHILD|WS_BORDER|ES_LEFT|ES_AUTOHSCROLL,
|
||||
0, 0, w, h, /* important this not be 0 size. */
|
||||
hwndMain, (HMENU) ID_EDITTEST2, hinst, NULL);
|
||||
assert(hwndET2);
|
||||
hwndET2 = CreateWindowA(WC_EDITA, NULL, WS_CHILD|WS_BORDER|ES_LEFT|ES_AUTOHSCROLL,
|
||||
0, 0, w, h, /* important this not be 0 size. */
|
||||
hwndMain, (HMENU) ID_EDITTEST2, hinst, NULL);
|
||||
ok(hwndET2 != NULL, "Failed to create Edit control.\n");
|
||||
if (winetest_interactive)
|
||||
ShowWindow (hwndET2, SW_SHOW);
|
||||
|
||||
@ -868,6 +880,66 @@ static LRESULT CALLBACK edit3_wnd_procA(HWND hWnd, UINT msg, WPARAM wParam, LPAR
|
||||
return DefWindowProcA(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static LONG defwndproc_counter = 0;
|
||||
struct message msg = { 0 };
|
||||
LRESULT ret;
|
||||
|
||||
msg.message = message;
|
||||
msg.flags = sent|wparam|id;
|
||||
if (defwndproc_counter) msg.flags |= defwinproc;
|
||||
msg.wParam = wParam;
|
||||
msg.id = PARENT_ID;
|
||||
|
||||
if (message != WM_IME_SETCONTEXT &&
|
||||
message != WM_IME_NOTIFY &&
|
||||
message != WM_GETICON &&
|
||||
message != WM_DWMNCRENDERINGCHANGED &&
|
||||
message != WM_GETMINMAXINFO &&
|
||||
message != WM_PAINT &&
|
||||
message != WM_CTLCOLOREDIT &&
|
||||
message < 0xc000)
|
||||
{
|
||||
add_message(sequences, COMBINED_SEQ_INDEX, &msg);
|
||||
}
|
||||
|
||||
defwndproc_counter++;
|
||||
ret = DefWindowProcA(hwnd, message, wParam, lParam);
|
||||
defwndproc_counter--;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK edit_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||
static LONG defwndproc_counter = 0;
|
||||
struct message msg = { 0 };
|
||||
LRESULT ret;
|
||||
|
||||
msg.message = message;
|
||||
msg.flags = sent|wparam|id;
|
||||
if (defwndproc_counter) msg.flags |= defwinproc;
|
||||
msg.wParam = wParam;
|
||||
msg.id = EDIT_ID;
|
||||
|
||||
if (message != WM_IME_SETCONTEXT &&
|
||||
message != WM_IME_NOTIFY)
|
||||
{
|
||||
add_message(sequences, COMBINED_SEQ_INDEX, &msg);
|
||||
}
|
||||
|
||||
defwndproc_counter++;
|
||||
if (IsWindowUnicode(hwnd))
|
||||
ret = CallWindowProcW(oldproc, hwnd, message, wParam, lParam);
|
||||
else
|
||||
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
||||
defwndproc_counter--;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Test behaviour of WM_SETTEXT, WM_REPLACESEL and notifications sent in response
|
||||
* to these messages.
|
||||
*/
|
||||
@ -891,16 +963,11 @@ static void test_edit_control_3(void)
|
||||
0,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 10, 10,
|
||||
NULL, NULL, NULL, NULL);
|
||||
assert(hParent);
|
||||
ok(hParent != NULL, "Failed to create control parent.\n");
|
||||
|
||||
trace("EDIT: Single line, no ES_AUTOHSCROLL\n");
|
||||
hWnd = CreateWindowExA(0,
|
||||
"EDIT",
|
||||
NULL,
|
||||
0,
|
||||
10, 10, 50, 50,
|
||||
hParent, NULL, NULL, NULL);
|
||||
assert(hWnd);
|
||||
hWnd = CreateWindowExA(0, WC_EDITA, NULL, 0, 10, 10, 50, 50, hParent, NULL, NULL, NULL);
|
||||
ok(hWnd != NULL, "Failed to create Edit control.\n");
|
||||
|
||||
zero_notify();
|
||||
SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str);
|
||||
@ -949,13 +1016,8 @@ static void test_edit_control_3(void)
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
trace("EDIT: Single line, ES_AUTOHSCROLL\n");
|
||||
hWnd = CreateWindowExA(0,
|
||||
"EDIT",
|
||||
NULL,
|
||||
ES_AUTOHSCROLL,
|
||||
10, 10, 50, 50,
|
||||
hParent, NULL, NULL, NULL);
|
||||
assert(hWnd);
|
||||
hWnd = CreateWindowExA(0, WC_EDITA, NULL, ES_AUTOHSCROLL, 10, 10, 50, 50, hParent, NULL, NULL, NULL);
|
||||
ok(hWnd != NULL, "Failed to create Edit control.\n");
|
||||
|
||||
zero_notify();
|
||||
SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str);
|
||||
@ -1000,13 +1062,10 @@ static void test_edit_control_3(void)
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
trace("EDIT: Multline, no ES_AUTOHSCROLL, no ES_AUTOVSCROLL\n");
|
||||
hWnd = CreateWindowExA(0,
|
||||
"EDIT",
|
||||
NULL,
|
||||
ES_MULTILINE,
|
||||
hWnd = CreateWindowExA(0, WC_EDITA, NULL, ES_MULTILINE,
|
||||
10, 10, (50 * dpi) / 96, (50 * dpi) / 96,
|
||||
hParent, NULL, NULL, NULL);
|
||||
assert(hWnd);
|
||||
ok(hWnd != NULL, "Failed to create Edit control.\n");
|
||||
|
||||
zero_notify();
|
||||
SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str);
|
||||
@ -1050,13 +1109,10 @@ static void test_edit_control_3(void)
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
trace("EDIT: Multline, ES_AUTOHSCROLL, no ES_AUTOVSCROLL\n");
|
||||
hWnd = CreateWindowExA(0,
|
||||
"EDIT",
|
||||
NULL,
|
||||
ES_MULTILINE | ES_AUTOHSCROLL,
|
||||
hWnd = CreateWindowExA(0, WC_EDITA, NULL, ES_MULTILINE | ES_AUTOHSCROLL,
|
||||
10, 10, (50 * dpi) / 96, (50 * dpi) / 96,
|
||||
hParent, NULL, NULL, NULL);
|
||||
assert(hWnd);
|
||||
ok(hWnd != NULL, "Failed to create Edit control.\n");
|
||||
|
||||
zero_notify();
|
||||
SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str2);
|
||||
@ -1095,13 +1151,9 @@ static void test_edit_control_3(void)
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
trace("EDIT: Multline, ES_AUTOHSCROLL and ES_AUTOVSCROLL\n");
|
||||
hWnd = CreateWindowExA(0,
|
||||
"EDIT",
|
||||
NULL,
|
||||
ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL,
|
||||
10, 10, 50, 50,
|
||||
hParent, NULL, NULL, NULL);
|
||||
assert(hWnd);
|
||||
hWnd = CreateWindowExA(0, WC_EDITA, NULL, ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL,
|
||||
10, 10, 50, 50, hParent, NULL, NULL, NULL);
|
||||
ok(hWnd != NULL, "Failed to create Edit control.\n");
|
||||
|
||||
zero_notify();
|
||||
SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str2);
|
||||
@ -1284,13 +1336,9 @@ static void test_edit_control_5(void)
|
||||
RECT rc;
|
||||
|
||||
/* first show that a non-child won't do for this test */
|
||||
hWnd = CreateWindowExA(0,
|
||||
"EDIT",
|
||||
str,
|
||||
0,
|
||||
10, 10, 1, 1,
|
||||
NULL, NULL, NULL, NULL);
|
||||
assert(hWnd);
|
||||
hWnd = CreateWindowExA(0, WC_EDITA, str, 0, 10, 10, 1, 1, NULL, NULL, NULL, NULL);
|
||||
ok(hWnd != NULL, "Failed to create Edit control.\n");
|
||||
|
||||
/* size of non-child edit control is (much) bigger than requested */
|
||||
GetWindowRect( hWnd, &rc);
|
||||
ok( rc.right - rc.left > 20, "size of the window (%d) is smaller than expected\n",
|
||||
@ -1304,16 +1352,13 @@ static void test_edit_control_5(void)
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
250, 250,
|
||||
NULL, NULL, hinst, NULL);
|
||||
assert(parentWnd);
|
||||
ok(parentWnd != NULL, "Failed to create control parent.\n");
|
||||
ShowWindow( parentWnd, SW_SHOW);
|
||||
/* single line */
|
||||
hWnd = CreateWindowExA(0,
|
||||
"EDIT",
|
||||
str, WS_VISIBLE | WS_BORDER |
|
||||
WS_CHILD,
|
||||
hWnd = CreateWindowExA(0, WC_EDITA, str, WS_VISIBLE | WS_BORDER | WS_CHILD,
|
||||
rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top,
|
||||
parentWnd, NULL, NULL, NULL);
|
||||
assert(hWnd);
|
||||
ok(hWnd != NULL, "Failed to create Edit control.\n");
|
||||
GetClientRect( hWnd, &rc);
|
||||
ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top,
|
||||
"Client rectangle not the expected size %s\n", wine_dbgstr_rect( &rc ));
|
||||
@ -1321,13 +1366,10 @@ static void test_edit_control_5(void)
|
||||
ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
|
||||
DestroyWindow(hWnd);
|
||||
/* multi line */
|
||||
hWnd = CreateWindowExA(0,
|
||||
"EDIT",
|
||||
str,
|
||||
WS_CHILD | ES_MULTILINE,
|
||||
hWnd = CreateWindowExA(0, WC_EDITA, str, WS_CHILD | ES_MULTILINE,
|
||||
rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top,
|
||||
parentWnd, NULL, NULL, NULL);
|
||||
assert(hWnd);
|
||||
ok(hWnd != NULL, "Failed to create Edit control.\n");
|
||||
GetClientRect( hWnd, &rc);
|
||||
ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top,
|
||||
"Client rectangle not the expected size %s\n", wine_dbgstr_rect( &rc ));
|
||||
@ -1412,14 +1454,9 @@ static void test_edit_control_scroll(void)
|
||||
/* Check the return value when EM_SCROLL doesn't scroll
|
||||
* anything. Should not return true unless any lines were actually
|
||||
* scrolled. */
|
||||
hwEdit = CreateWindowA(
|
||||
"EDIT",
|
||||
single_line_str,
|
||||
WS_VSCROLL | ES_MULTILINE,
|
||||
1, 1, 100, 100,
|
||||
NULL, NULL, hinst, NULL);
|
||||
|
||||
assert(hwEdit);
|
||||
hwEdit = CreateWindowA(WC_EDITA, single_line_str, WS_VSCROLL | ES_MULTILINE,
|
||||
1, 1, 100, 100, NULL, NULL, hinst, NULL);
|
||||
ok(hwEdit != NULL, "Failed to create Edit control.\n");
|
||||
|
||||
ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
|
||||
ok(!ret, "Returned %x, expected 0.\n", ret);
|
||||
@ -1438,13 +1475,9 @@ static void test_edit_control_scroll(void)
|
||||
/* SB_PAGEDOWN while at the beginning of a buffer with few lines
|
||||
should not cause EM_SCROLL to return a negative value of
|
||||
scrolled lines that would put us "before" the beginning. */
|
||||
hwEdit = CreateWindowA(
|
||||
"EDIT",
|
||||
multiline_str,
|
||||
WS_VSCROLL | ES_MULTILINE,
|
||||
0, 0, 100, 100,
|
||||
NULL, NULL, hinst, NULL);
|
||||
assert(hwEdit);
|
||||
hwEdit = CreateWindowA(WC_EDITA, multiline_str, WS_VSCROLL | ES_MULTILINE,
|
||||
0, 0, 100, 100, NULL, NULL, hinst, NULL);
|
||||
ok(hwEdit != NULL, "Failed to create Edit control.\n");
|
||||
|
||||
ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
|
||||
ok(!ret, "Returned %x, expected 0.\n", ret);
|
||||
@ -2365,13 +2398,12 @@ static void test_contextmenu(void)
|
||||
|
||||
hwndMain = CreateWindowA(szEditTest4Class, "ET4", WS_OVERLAPPEDWINDOW|WS_VISIBLE,
|
||||
0, 0, 200, 200, NULL, NULL, hinst, NULL);
|
||||
assert(hwndMain);
|
||||
ok(hwndMain != NULL, "Failed to create control parent.\n");
|
||||
|
||||
hwndEdit = CreateWindowA("EDIT", NULL,
|
||||
WS_CHILD|WS_BORDER|WS_VISIBLE|ES_LEFT|ES_AUTOHSCROLL,
|
||||
hwndEdit = CreateWindowA(WC_EDITA, NULL, WS_CHILD|WS_BORDER|WS_VISIBLE|ES_LEFT|ES_AUTOHSCROLL,
|
||||
0, 0, 150, 50, /* important this not be 0 size. */
|
||||
hwndMain, (HMENU) ID_EDITTEST2, hinst, NULL);
|
||||
assert(hwndEdit);
|
||||
ok(hwndEdit != NULL, "Failed to create Edit control.\n");
|
||||
|
||||
SetFocus(NULL);
|
||||
SetCapture(hwndMain);
|
||||
@ -2408,6 +2440,7 @@ static BOOL register_classes(void)
|
||||
WNDCLASSA test3;
|
||||
WNDCLASSA test4;
|
||||
WNDCLASSA text_position;
|
||||
WNDCLASSA wc;
|
||||
|
||||
test2.style = 0;
|
||||
test2.lpfnWndProc = ET2_WndProc;
|
||||
@ -2457,6 +2490,12 @@ static BOOL register_classes(void)
|
||||
text_position.lpfnWndProc = DefWindowProcA;
|
||||
if (!RegisterClassA(&text_position)) return FALSE;
|
||||
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
wc.lpfnWndProc = parent_wnd_proc;
|
||||
wc.hInstance = GetModuleHandleA(NULL);
|
||||
wc.lpszClassName = "ParentWnd";
|
||||
if (!RegisterClassA(&wc)) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2750,7 +2789,6 @@ static void test_EM_GETHANDLE(void)
|
||||
buffer = LocalLock(hmem);
|
||||
ok(buffer != NULL, "got %p (expected != NULL)\n", buffer);
|
||||
len = lstrlenW(buffer);
|
||||
todo_wine
|
||||
ok(len == lstrlenW(str1W) && !lstrcmpW(buffer, str1W), "Unexpected buffer contents %s, length %d.\n",
|
||||
wine_dbgstr_w(buffer), len);
|
||||
LocalUnlock(hmem);
|
||||
@ -2775,7 +2813,6 @@ todo_wine
|
||||
|
||||
lstrcpyA(current, str0);
|
||||
r = SendMessageA(hEdit, WM_GETTEXT, sizeof(current), (LPARAM)current);
|
||||
todo_wine
|
||||
ok(r == lstrlenA(str1_1) && !lstrcmpA(current, str1_1),
|
||||
"Unexpected retval %d and text \"%s\" (expected %d and \"%s\")\n", r, current, lstrlenA(str1_1), str1_1);
|
||||
|
||||
@ -2784,7 +2821,6 @@ todo_wine
|
||||
ok(r, "Failed to set text.\n");
|
||||
|
||||
buffer = LocalLock(hmem);
|
||||
todo_wine
|
||||
ok(buffer != NULL && buffer[0] == '1', "Unexpected buffer contents\n");
|
||||
LocalUnlock(hmem);
|
||||
|
||||
@ -2792,7 +2828,6 @@ todo_wine
|
||||
ok(r, "Failed to replace selection.\n");
|
||||
|
||||
buffer = LocalLock(hmem);
|
||||
todo_wine
|
||||
ok(buffer != NULL && buffer[0] == '2', "Unexpected buffer contents\n");
|
||||
LocalUnlock(hmem);
|
||||
|
||||
@ -2814,12 +2849,10 @@ todo_wine
|
||||
SendMessageA(hEdit, EM_SETHANDLE, (WPARAM)halloc, 0);
|
||||
|
||||
len = SendMessageA(hEdit, WM_GETTEXTLENGTH, 0, 0);
|
||||
todo_wine
|
||||
ok(len == lstrlenA(str2), "got %d (expected %d)\n", len, lstrlenA(str2));
|
||||
|
||||
lstrcpyA(current, str0);
|
||||
r = SendMessageA(hEdit, WM_GETTEXT, sizeof(current), (LPARAM)current);
|
||||
todo_wine
|
||||
ok(r == lstrlenA(str2) && !lstrcmpA(current, str2),
|
||||
"got %d and \"%s\" (expected %d and \"%s\")\n", r, current, lstrlenA(str2), str2);
|
||||
|
||||
@ -2944,7 +2977,6 @@ static void test_EM_GETLINE(void)
|
||||
char buff[16];
|
||||
int r;
|
||||
|
||||
todo_wine_if(i == 0)
|
||||
ok(IsWindowUnicode(hwnd[i]), "Expected unicode window.\n");
|
||||
|
||||
SendMessageA(hwnd[i], WM_SETTEXT, 0, (LPARAM)str);
|
||||
@ -2977,6 +3009,91 @@ static void test_EM_GETLINE(void)
|
||||
}
|
||||
}
|
||||
|
||||
static int CALLBACK test_wordbreak_procA(char *text, int current, int length, int code)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void test_wordbreak_proc(void)
|
||||
{
|
||||
EDITWORDBREAKPROCA proc;
|
||||
LRESULT ret;
|
||||
HWND hwnd;
|
||||
|
||||
hwnd = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
|
||||
|
||||
proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0);
|
||||
ok(proc == NULL, "Unexpected wordbreak proc %p.\n", proc);
|
||||
|
||||
ret = SendMessageA(hwnd, EM_SETWORDBREAKPROC, 0, (LPARAM)test_wordbreak_procA);
|
||||
ok(ret == 1, "Unexpected return value %ld.\n", ret);
|
||||
|
||||
proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0);
|
||||
ok(proc == test_wordbreak_procA, "Unexpected wordbreak proc %p.\n", proc);
|
||||
|
||||
ret = SendMessageA(hwnd, EM_SETWORDBREAKPROC, 0, 0);
|
||||
ok(ret == 1, "Unexpected return value %ld.\n", ret);
|
||||
|
||||
proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0);
|
||||
ok(proc == NULL, "Unexpected wordbreak proc %p.\n", proc);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static const struct message setfocus_combined_seq[] =
|
||||
{
|
||||
{ WM_KILLFOCUS, sent|id, 0, 0, PARENT_ID },
|
||||
{ WM_SETFOCUS, sent|id, 0, 0, EDIT_ID },
|
||||
{ WM_COMMAND, sent|wparam|id, MAKEWPARAM(1, EN_SETFOCUS), 0, PARENT_ID },
|
||||
{ WM_PAINT, sent|id, 0, 0, EDIT_ID },
|
||||
{ WM_NCPAINT, sent|id|defwinproc|optional, 0, 0, EDIT_ID },
|
||||
{ WM_ERASEBKGND, sent|id|defwinproc|optional, 0, 0, EDIT_ID },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message killfocus_combined_seq[] =
|
||||
{
|
||||
{ WM_KILLFOCUS, sent|id, 0, 0, EDIT_ID },
|
||||
{ WM_COMMAND, sent|wparam|id, MAKEWPARAM(1, EN_KILLFOCUS), 0, PARENT_ID },
|
||||
{ WM_SETFOCUS, sent|id, 0, 0, PARENT_ID },
|
||||
{ WM_PAINT, sent|id, 0, 0, EDIT_ID },
|
||||
{ WM_NCPAINT, sent|id|defwinproc|optional, 0, 0, EDIT_ID },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void test_change_focus(void)
|
||||
{
|
||||
HWND hwnd, parent_wnd;
|
||||
WNDPROC oldproc;
|
||||
MSG msg;
|
||||
|
||||
parent_wnd = CreateWindowA("ParentWnd", "", WS_OVERLAPPEDWINDOW,
|
||||
0, 0, 200, 200, NULL, NULL, GetModuleHandleA(NULL), NULL);
|
||||
ok(parent_wnd != NULL, "Failed to create control parent.\n");
|
||||
SetWindowPos(parent_wnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
|
||||
ShowWindow(parent_wnd, SW_SHOW);
|
||||
|
||||
hwnd = CreateWindowExA(0, WC_EDITA, "Test", WS_CHILD | WS_VISIBLE, 0, 0, 100, 100,
|
||||
parent_wnd, (HMENU)1, GetModuleHandleA(NULL), NULL);
|
||||
ok(hwnd != NULL, "Failed to create Edit control.\n");
|
||||
|
||||
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)edit_subclass_proc);
|
||||
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||
|
||||
SetFocus(parent_wnd);
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
SetFocus(hwnd);
|
||||
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
ok_sequence(sequences, COMBINED_SEQ_INDEX, setfocus_combined_seq, "Set focus", TRUE);
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
SetFocus(parent_wnd);
|
||||
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
ok_sequence(sequences, COMBINED_SEQ_INDEX, killfocus_combined_seq, "Kill focus", TRUE);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
START_TEST(edit)
|
||||
{
|
||||
ULONG_PTR ctx_cookie;
|
||||
@ -2986,6 +3103,8 @@ START_TEST(edit)
|
||||
if (!load_v6_module(&ctx_cookie, &hCtx))
|
||||
return;
|
||||
|
||||
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
hinst = GetModuleHandleA(NULL);
|
||||
b = register_classes();
|
||||
ok(b, "Failed to register test classes.\n");
|
||||
@ -3017,6 +3136,8 @@ START_TEST(edit)
|
||||
test_EM_GETHANDLE();
|
||||
test_paste();
|
||||
test_EM_GETLINE();
|
||||
test_wordbreak_proc();
|
||||
test_change_focus();
|
||||
|
||||
UnregisterWindowClasses();
|
||||
|
||||
|
@ -18,7 +18,16 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
#include "msg.h"
|
||||
|
||||
static HIMAGELIST (WINAPI *pImageList_Create)(int, int, UINT, int, int);
|
||||
static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
|
||||
|
||||
typedef struct tagEXPECTEDNOTIFY
|
||||
{
|
||||
@ -526,58 +535,79 @@ static HWND create_custom_header_control(HWND hParent, BOOL preloadHeaderItems)
|
||||
return childHandle;
|
||||
}
|
||||
|
||||
static void check_auto_format(void)
|
||||
static void header_item_getback(HWND hwnd, UINT mask, HDITEMA *item)
|
||||
{
|
||||
HDITEMA hdiCreate;
|
||||
HDITEMA hdiRead;
|
||||
static CHAR text[] = "Test";
|
||||
ZeroMemory(&hdiCreate, sizeof(HDITEMA));
|
||||
int ret;
|
||||
|
||||
ret = SendMessageA(hwnd, HDM_INSERTITEMA, 0, (LPARAM)item);
|
||||
ok(ret != -1, "Failed to add header item.\n");
|
||||
|
||||
memset(item, 0, sizeof(*item));
|
||||
item->mask = mask;
|
||||
|
||||
ret = SendMessageA(hwnd, HDM_GETITEMA, 0, (LPARAM)item);
|
||||
ok(ret != 0, "Failed to get item data.\n");
|
||||
ret = SendMessageA(hwnd, HDM_DELETEITEM, 0, 0);
|
||||
ok(ret != 0, "Failed to delete item.\n");
|
||||
}
|
||||
|
||||
static void test_item_auto_format(HWND parent)
|
||||
{
|
||||
static char text[] = "Test";
|
||||
HDITEMA item;
|
||||
HBITMAP hbm;
|
||||
HWND hwnd;
|
||||
|
||||
hwnd = create_custom_header_control(parent, FALSE);
|
||||
|
||||
/* Windows implicitly sets some format bits in INSERTITEM */
|
||||
|
||||
/* HDF_STRING is automatically set and cleared for no text */
|
||||
hdiCreate.mask = HDI_TEXT|HDI_WIDTH|HDI_FORMAT;
|
||||
hdiCreate.pszText = text;
|
||||
hdiCreate.cxy = 100;
|
||||
hdiCreate.fmt=HDF_CENTER;
|
||||
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
|
||||
ok(hdiRead.fmt == (HDF_STRING|HDF_CENTER), "HDF_STRING not set automatically (fmt=%x)\n", hdiRead.fmt);
|
||||
item.mask = HDI_TEXT | HDI_WIDTH | HDI_FORMAT;
|
||||
item.pszText = text;
|
||||
item.cxy = 100;
|
||||
item.fmt = HDF_CENTER;
|
||||
header_item_getback(hwnd, HDI_FORMAT, &item);
|
||||
ok(item.fmt == (HDF_STRING | HDF_CENTER), "Unexpected item format mask %#x.\n", item.fmt);
|
||||
|
||||
hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
|
||||
hdiCreate.pszText = text;
|
||||
hdiCreate.fmt = HDF_CENTER|HDF_STRING;
|
||||
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
|
||||
ok(hdiRead.fmt == (HDF_CENTER), "HDF_STRING should be automatically cleared (fmt=%x)\n", hdiRead.fmt);
|
||||
item.mask = HDI_WIDTH | HDI_FORMAT;
|
||||
item.pszText = text;
|
||||
item.fmt = HDF_CENTER | HDF_STRING;
|
||||
header_item_getback(hwnd, HDI_FORMAT, &item);
|
||||
ok(item.fmt == HDF_CENTER, "Unexpected item format mask %#x.\n", item.fmt);
|
||||
|
||||
/* HDF_BITMAP is automatically set and cleared for a NULL bitmap or no bitmap */
|
||||
hdiCreate.mask = HDI_BITMAP|HDI_WIDTH|HDI_FORMAT;
|
||||
hdiCreate.hbm = CreateBitmap(16, 16, 1, 8, NULL);
|
||||
hdiCreate.fmt = HDF_CENTER;
|
||||
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
|
||||
ok(hdiRead.fmt == (HDF_BITMAP|HDF_CENTER), "HDF_BITMAP not set automatically (fmt=%x)\n", hdiRead.fmt);
|
||||
DeleteObject(hdiCreate.hbm);
|
||||
item.mask = HDI_BITMAP | HDI_WIDTH | HDI_FORMAT;
|
||||
item.hbm = hbm = CreateBitmap(16, 16, 1, 8, NULL);
|
||||
item.fmt = HDF_CENTER;
|
||||
header_item_getback(hwnd, HDI_FORMAT, &item);
|
||||
ok(item.fmt == (HDF_BITMAP | HDF_CENTER), "Unexpected item format mask %#x.\n", item.fmt);
|
||||
DeleteObject(hbm);
|
||||
|
||||
hdiCreate.hbm = NULL;
|
||||
hdiCreate.fmt = HDF_CENTER|HDF_BITMAP;
|
||||
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
|
||||
ok(hdiRead.fmt == HDF_CENTER, "HDF_BITMAP not cleared automatically for NULL bitmap (fmt=%x)\n", hdiRead.fmt);
|
||||
item.mask = HDI_BITMAP | HDI_WIDTH | HDI_FORMAT;
|
||||
item.hbm = NULL;
|
||||
item.fmt = HDF_CENTER | HDF_BITMAP;
|
||||
header_item_getback(hwnd, HDI_FORMAT, &item);
|
||||
ok(item.fmt == HDF_CENTER, "Unexpected item format mask %#x.\n", item.fmt);
|
||||
|
||||
hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
|
||||
hdiCreate.fmt = HDF_CENTER|HDF_BITMAP;
|
||||
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
|
||||
ok(hdiRead.fmt == HDF_CENTER, "HDF_BITMAP not cleared automatically for no bitmap (fmt=%x)\n", hdiRead.fmt);
|
||||
item.mask = HDI_WIDTH | HDI_FORMAT;
|
||||
item.fmt = HDF_CENTER | HDF_BITMAP;
|
||||
header_item_getback(hwnd, HDI_FORMAT, &item);
|
||||
ok(item.fmt == HDF_CENTER, "Unexpected item format mask %#x.\n", item.fmt);
|
||||
|
||||
/* HDF_IMAGE is automatically set but not cleared */
|
||||
hdiCreate.mask = HDI_IMAGE|HDI_WIDTH|HDI_FORMAT;
|
||||
hdiCreate.iImage = 17;
|
||||
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
|
||||
ok(hdiRead.fmt == (HDF_IMAGE|HDF_CENTER), "HDF_IMAGE not set automatically (fmt=%x)\n", hdiRead.fmt);
|
||||
item.mask = HDI_IMAGE | HDI_WIDTH | HDI_FORMAT;
|
||||
item.iImage = 17;
|
||||
header_item_getback(hwnd, HDI_FORMAT, &item);
|
||||
ok(item.fmt == (HDF_IMAGE | HDF_CENTER), "Unexpected item format mask %#x.\n", item.fmt);
|
||||
|
||||
hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
|
||||
hdiCreate.fmt = HDF_CENTER|HDF_IMAGE;
|
||||
hdiCreate.iImage = 0;
|
||||
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
|
||||
ok(hdiRead.fmt == (HDF_CENTER|HDF_IMAGE), "HDF_IMAGE shouldn't be cleared automatically (fmt=%x)\n", hdiRead.fmt);
|
||||
item.mask = HDI_WIDTH | HDI_FORMAT;
|
||||
item.fmt = HDF_CENTER | HDF_IMAGE;
|
||||
item.iImage = 0;
|
||||
header_item_getback(hwnd, HDI_FORMAT, &item);
|
||||
ok(item.fmt == (HDF_CENTER | HDF_IMAGE), "Unexpected item format mask %#x.\n", item.fmt);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void check_auto_fields(void)
|
||||
@ -759,7 +789,6 @@ static void test_header_control (void)
|
||||
/* unexpected notifies cleared by notifies_received in setItem */
|
||||
delItem(hWndHeader, 0);
|
||||
|
||||
check_auto_format();
|
||||
TEST_GET_ITEMCOUNT(6);
|
||||
check_auto_fields();
|
||||
TEST_GET_ITEMCOUNT(6);
|
||||
@ -947,7 +976,7 @@ static void test_hdm_sethotdivider(HWND hParent)
|
||||
|
||||
static void test_hdm_imageMessages(HWND hParent)
|
||||
{
|
||||
HIMAGELIST hImageList = ImageList_Create (4, 4, 0, 1, 0);
|
||||
HIMAGELIST hImageList = pImageList_Create (4, 4, 0, 1, 0);
|
||||
HIMAGELIST hIml;
|
||||
BOOL wasValid;
|
||||
HWND hChild;
|
||||
@ -967,13 +996,13 @@ static void test_hdm_imageMessages(HWND hParent)
|
||||
|
||||
hIml = (HIMAGELIST) SendMessageA(hChild, HDM_CREATEDRAGIMAGE, 0, 0);
|
||||
ok(hIml != NULL, "Expected non-NULL handle, got %p\n", hIml);
|
||||
ImageList_Destroy(hIml);
|
||||
pImageList_Destroy(hIml);
|
||||
|
||||
ok_sequence(sequences, HEADER_SEQ_INDEX, imageMessages_seq, "imageMessages sequence testing", FALSE);
|
||||
|
||||
DestroyWindow(hChild);
|
||||
|
||||
wasValid = ImageList_Destroy(hImageList);
|
||||
wasValid = pImageList_Destroy(hImageList);
|
||||
ok(wasValid, "Header must not free image list at destruction!\n");
|
||||
}
|
||||
|
||||
@ -1638,28 +1667,23 @@ static LRESULT CALLBACK HeaderTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
|
||||
return 0L;
|
||||
}
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
X(ImageList_Create);
|
||||
X(ImageList_Destroy);
|
||||
#undef X
|
||||
}
|
||||
|
||||
static BOOL init(void)
|
||||
{
|
||||
HMODULE hComctl32;
|
||||
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
WNDCLASSA wc;
|
||||
INITCOMMONCONTROLSEX iccex;
|
||||
TEXTMETRICA tm;
|
||||
HFONT hOldFont;
|
||||
HDC hdc;
|
||||
|
||||
hComctl32 = GetModuleHandleA("comctl32.dll");
|
||||
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
|
||||
if (!pInitCommonControlsEx)
|
||||
{
|
||||
win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
iccex.dwSize = sizeof(iccex);
|
||||
iccex.dwICC = ICC_USEREX_CLASSES;
|
||||
pInitCommonControlsEx(&iccex);
|
||||
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
@ -1815,17 +1839,21 @@ START_TEST(header)
|
||||
ULONG_PTR ctx_cookie;
|
||||
HANDLE hCtx;
|
||||
|
||||
init_functions();
|
||||
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
if (!init())
|
||||
return;
|
||||
|
||||
test_header_control();
|
||||
test_item_auto_format(hHeaderParentWnd);
|
||||
test_header_order();
|
||||
test_hdm_orderarray();
|
||||
test_customdraw();
|
||||
|
||||
DestroyWindow(hHeaderParentWnd);
|
||||
|
||||
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
parent_hwnd = create_custom_parent_window();
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, create_parent_wnd_seq, "create parent windows", FALSE);
|
||||
|
||||
@ -1846,9 +1874,12 @@ START_TEST(header)
|
||||
return;
|
||||
}
|
||||
|
||||
init_functions();
|
||||
|
||||
/* comctl32 version 6 tests start here */
|
||||
test_hdf_fixedwidth(parent_hwnd);
|
||||
test_hds_nosizing(parent_hwnd);
|
||||
test_item_auto_format(parent_hwnd);
|
||||
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
|
||||
|
@ -21,13 +21,29 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#define COBJMACROS
|
||||
#define CONST_VTABLE
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "objbase.h"
|
||||
#include "commctrl.h" /* must be included after objbase.h to get ImageList_Write */
|
||||
#include "initguid.h"
|
||||
#include "commoncontrols.h"
|
||||
#include "shellapi.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
#include "resources.h"
|
||||
|
||||
#ifdef __REACTOS__
|
||||
#include <ole2.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#include <initguid.h>
|
||||
#include <commoncontrols.h>
|
||||
#endif
|
||||
|
||||
#define IMAGELIST_MAGIC (('L' << 8) | 'I')
|
||||
|
||||
@ -73,6 +89,7 @@ static BOOL (WINAPI *pImageList_Write)(HIMAGELIST, IStream *);
|
||||
static HIMAGELIST (WINAPI *pImageList_Read)(IStream *);
|
||||
static BOOL (WINAPI *pImageList_Copy)(HIMAGELIST, int, HIMAGELIST, int, UINT);
|
||||
static HIMAGELIST (WINAPI *pImageList_LoadImageW)(HINSTANCE, LPCWSTR, int, int, COLORREF, UINT, UINT);
|
||||
static BOOL (WINAPI *pImageList_Draw)(HIMAGELIST,INT,HDC,INT,INT,UINT);
|
||||
|
||||
static HINSTANCE hinst;
|
||||
|
||||
@ -193,7 +210,7 @@ static HDC show_image(HWND hwnd, HIMAGELIST himl, int idx, int size,
|
||||
|
||||
SetWindowTextA(hwnd, loc);
|
||||
hdc = GetDC(hwnd);
|
||||
ImageList_Draw(himl, idx, hdc, 0, 0, ILD_TRANSPARENT);
|
||||
pImageList_Draw(himl, idx, hdc, 0, 0, ILD_TRANSPARENT);
|
||||
|
||||
force_redraw(hwnd);
|
||||
|
||||
@ -492,8 +509,8 @@ static void test_DrawIndirect(void)
|
||||
ok(hbm3 != 0, "no bitmap 3\n");
|
||||
|
||||
/* add three */
|
||||
ok(0 == ImageList_Add(himl, hbm1, 0),"failed to add bitmap 1\n");
|
||||
ok(1 == ImageList_Add(himl, hbm2, 0),"failed to add bitmap 2\n");
|
||||
ok(0 == pImageList_Add(himl, hbm1, 0),"failed to add bitmap 1\n");
|
||||
ok(1 == pImageList_Add(himl, hbm2, 0),"failed to add bitmap 2\n");
|
||||
|
||||
if (pImageList_SetImageCount)
|
||||
{
|
||||
@ -886,16 +903,30 @@ static BOOL is_v6_header(const ILHEAD *header)
|
||||
|
||||
static void check_ilhead_data(const ILHEAD *ilh, INT cx, INT cy, INT cur, INT max, INT grow, INT flags)
|
||||
{
|
||||
INT grow_aligned;
|
||||
|
||||
ok(ilh->usMagic == IMAGELIST_MAGIC, "wrong usMagic %4x (expected %02x)\n", ilh->usMagic, IMAGELIST_MAGIC);
|
||||
ok(ilh->usVersion == 0x101 ||
|
||||
ilh->usVersion == 0x600 || /* WinXP/W2k3 */
|
||||
ilh->usVersion == 0x620, "Unknown usVersion %#x.\n", ilh->usVersion);
|
||||
ok(ilh->cCurImage == cur, "wrong cCurImage %d (expected %d)\n", ilh->cCurImage, cur);
|
||||
if (!is_v6_header(ilh))
|
||||
|
||||
grow = max(grow, 1);
|
||||
grow_aligned = (WORD)(grow + 3) & ~3;
|
||||
|
||||
if (is_v6_header(ilh))
|
||||
{
|
||||
ok(ilh->cMaxImage == max, "wrong cMaxImage %d (expected %d)\n", ilh->cMaxImage, max);
|
||||
ok(ilh->cGrow == grow, "Unexpected cGrow %d (expected %d)\n", ilh->cGrow, grow);
|
||||
grow = (WORD)(grow + 2 + 3) & ~3;
|
||||
ok(ilh->cGrow == grow || broken(ilh->cGrow == grow_aligned) /* XP/Vista */,
|
||||
"Unexpected cGrow %d, expected %d\n", ilh->cGrow, grow);
|
||||
}
|
||||
else
|
||||
{
|
||||
grow = (WORD)(grow + 3) & ~3;
|
||||
ok(ilh->cMaxImage == max, "wrong cMaxImage %d (expected %d)\n", ilh->cMaxImage, max);
|
||||
ok(ilh->cGrow == grow_aligned, "Unexpected cGrow %d, expected %d\n", ilh->cGrow, grow_aligned);
|
||||
}
|
||||
|
||||
ok(ilh->cx == cx, "wrong cx %d (expected %d)\n", ilh->cx, cx);
|
||||
ok(ilh->cy == cy, "wrong cy %d (expected %d)\n", ilh->cy, cy);
|
||||
ok(ilh->bkcolor == CLR_NONE, "wrong bkcolor %x\n", ilh->bkcolor);
|
||||
@ -956,6 +987,7 @@ static inline void imagelist_get_bitmap_size(const ILHEAD *header, SIZE *sz)
|
||||
}
|
||||
}
|
||||
|
||||
/* Grow argument matches what was used when imagelist was created. */
|
||||
static void check_iml_data(HIMAGELIST himl, INT cx, INT cy, INT cur, INT max, INT grow,
|
||||
INT flags, const char *comment)
|
||||
{
|
||||
@ -1017,103 +1049,106 @@ static void check_iml_data(HIMAGELIST himl, INT cx, INT cy, INT cur, INT max, IN
|
||||
cleanup_memstream(&stream);
|
||||
}
|
||||
|
||||
static void image_list_init(HIMAGELIST himl)
|
||||
static void image_list_add_bitmap(HIMAGELIST himl, BYTE grey, int i)
|
||||
{
|
||||
HBITMAP hbm;
|
||||
char comment[16];
|
||||
INT n = 1;
|
||||
DWORD i;
|
||||
HBITMAP hbm;
|
||||
int ret;
|
||||
|
||||
sprintf(comment, "%d", i);
|
||||
hbm = create_bitmap(BMP_CX, BMP_CX, RGB(grey, grey, grey), comment);
|
||||
ret = pImageList_Add(himl, hbm, NULL);
|
||||
ok(ret != -1, "Failed to add image to imagelist.\n");
|
||||
DeleteObject(hbm);
|
||||
}
|
||||
|
||||
static void image_list_init(HIMAGELIST himl, INT grow)
|
||||
{
|
||||
unsigned int i;
|
||||
static const struct test_data
|
||||
{
|
||||
BYTE grey;
|
||||
INT cx, cy, cur, max, grow, bpp;
|
||||
INT cx, cy, cur, max, bpp;
|
||||
const char *comment;
|
||||
} td[] =
|
||||
{
|
||||
{ 255, BMP_CX, BMP_CX, 1, 2, 4, 24, "total 1" },
|
||||
{ 170, BMP_CX, BMP_CX, 2, 7, 4, 24, "total 2" },
|
||||
{ 85, BMP_CX, BMP_CX, 3, 7, 4, 24, "total 3" },
|
||||
{ 0, BMP_CX, BMP_CX, 4, 7, 4, 24, "total 4" },
|
||||
{ 0, BMP_CX, BMP_CX, 5, 7, 4, 24, "total 5" },
|
||||
{ 85, BMP_CX, BMP_CX, 6, 7, 4, 24, "total 6" },
|
||||
{ 170, BMP_CX, BMP_CX, 7, 12, 4, 24, "total 7" },
|
||||
{ 255, BMP_CX, BMP_CX, 8, 12, 4, 24, "total 8" },
|
||||
{ 255, BMP_CX, BMP_CX, 9, 12, 4, 24, "total 9" },
|
||||
{ 170, BMP_CX, BMP_CX, 10, 12, 4, 24, "total 10" },
|
||||
{ 85, BMP_CX, BMP_CX, 11, 12, 4, 24, "total 11" },
|
||||
{ 0, BMP_CX, BMP_CX, 12, 17, 4, 24, "total 12" },
|
||||
{ 0, BMP_CX, BMP_CX, 13, 17, 4, 24, "total 13" },
|
||||
{ 85, BMP_CX, BMP_CX, 14, 17, 4, 24, "total 14" },
|
||||
{ 170, BMP_CX, BMP_CX, 15, 17, 4, 24, "total 15" },
|
||||
{ 255, BMP_CX, BMP_CX, 16, 17, 4, 24, "total 16" },
|
||||
{ 255, BMP_CX, BMP_CX, 17, 22, 4, 24, "total 17" },
|
||||
{ 170, BMP_CX, BMP_CX, 18, 22, 4, 24, "total 18" },
|
||||
{ 85, BMP_CX, BMP_CX, 19, 22, 4, 24, "total 19" },
|
||||
{ 0, BMP_CX, BMP_CX, 20, 22, 4, 24, "total 20" },
|
||||
{ 0, BMP_CX, BMP_CX, 21, 22, 4, 24, "total 21" },
|
||||
{ 85, BMP_CX, BMP_CX, 22, 27, 4, 24, "total 22" },
|
||||
{ 170, BMP_CX, BMP_CX, 23, 27, 4, 24, "total 23" },
|
||||
{ 255, BMP_CX, BMP_CX, 24, 27, 4, 24, "total 24" }
|
||||
{ 255, BMP_CX, BMP_CX, 1, 2, 24, "total 1" },
|
||||
{ 170, BMP_CX, BMP_CX, 2, 7, 24, "total 2" },
|
||||
{ 85, BMP_CX, BMP_CX, 3, 7, 24, "total 3" },
|
||||
{ 0, BMP_CX, BMP_CX, 4, 7, 24, "total 4" },
|
||||
{ 0, BMP_CX, BMP_CX, 5, 7, 24, "total 5" },
|
||||
{ 85, BMP_CX, BMP_CX, 6, 7, 24, "total 6" },
|
||||
{ 170, BMP_CX, BMP_CX, 7, 12, 24, "total 7" },
|
||||
{ 255, BMP_CX, BMP_CX, 8, 12, 24, "total 8" },
|
||||
{ 255, BMP_CX, BMP_CX, 9, 12, 24, "total 9" },
|
||||
{ 170, BMP_CX, BMP_CX, 10, 12, 24, "total 10" },
|
||||
{ 85, BMP_CX, BMP_CX, 11, 12, 24, "total 11" },
|
||||
{ 0, BMP_CX, BMP_CX, 12, 17, 24, "total 12" },
|
||||
{ 0, BMP_CX, BMP_CX, 13, 17, 24, "total 13" },
|
||||
{ 85, BMP_CX, BMP_CX, 14, 17, 24, "total 14" },
|
||||
{ 170, BMP_CX, BMP_CX, 15, 17, 24, "total 15" },
|
||||
{ 255, BMP_CX, BMP_CX, 16, 17, 24, "total 16" },
|
||||
{ 255, BMP_CX, BMP_CX, 17, 22, 24, "total 17" },
|
||||
{ 170, BMP_CX, BMP_CX, 18, 22, 24, "total 18" },
|
||||
{ 85, BMP_CX, BMP_CX, 19, 22, 24, "total 19" },
|
||||
{ 0, BMP_CX, BMP_CX, 20, 22, 24, "total 20" },
|
||||
{ 0, BMP_CX, BMP_CX, 21, 22, 24, "total 21" },
|
||||
{ 85, BMP_CX, BMP_CX, 22, 27, 24, "total 22" },
|
||||
{ 170, BMP_CX, BMP_CX, 23, 27, 24, "total 23" },
|
||||
{ 255, BMP_CX, BMP_CX, 24, 27, 24, "total 24" }
|
||||
};
|
||||
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, 4, ILC_COLOR24, "total 0");
|
||||
|
||||
#define add_bitmap(grey) \
|
||||
sprintf(comment, "%d", n++); \
|
||||
hbm = create_bitmap(BMP_CX, BMP_CX, RGB((grey),(grey),(grey)), comment); \
|
||||
ImageList_Add(himl, hbm, NULL); \
|
||||
DeleteObject(hbm);
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, grow, ILC_COLOR24, "total 0");
|
||||
|
||||
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
|
||||
{
|
||||
add_bitmap(td[i].grey);
|
||||
check_iml_data(himl, td[i].cx, td[i].cy, td[i].cur, td[i].max, td[i].grow, td[i].bpp, td[i].comment);
|
||||
image_list_add_bitmap(himl, td[i].grey, i + 1);
|
||||
check_iml_data(himl, td[i].cx, td[i].cy, td[i].cur, td[i].max, grow, td[i].bpp, td[i].comment);
|
||||
}
|
||||
#undef add_bitmap
|
||||
}
|
||||
|
||||
static void test_imagelist_storage(void)
|
||||
{
|
||||
HIMAGELIST himl;
|
||||
INT ret, grow;
|
||||
HBITMAP hbm;
|
||||
HICON icon;
|
||||
INT ret;
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 1, 1);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, 4, ILC_COLOR24, "empty");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, 1, ILC_COLOR24, "empty");
|
||||
|
||||
image_list_init(himl);
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 24, 27, 4, ILC_COLOR24, "orig");
|
||||
image_list_init(himl, 1);
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 24, 27, 1, ILC_COLOR24, "orig");
|
||||
|
||||
ret = pImageList_Remove(himl, 4);
|
||||
ok(ret, "ImageList_Remove failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 23, 27, 4, ILC_COLOR24, "1");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 23, 27, 1, ILC_COLOR24, "1");
|
||||
|
||||
ret = pImageList_Remove(himl, 5);
|
||||
ok(ret, "ImageList_Remove failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 22, 27, 4, ILC_COLOR24, "2");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 22, 27, 1, ILC_COLOR24, "2");
|
||||
|
||||
ret = pImageList_Remove(himl, 6);
|
||||
ok(ret, "ImageList_Remove failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 21, 27, 4, ILC_COLOR24, "3");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 21, 27, 1, ILC_COLOR24, "3");
|
||||
|
||||
ret = pImageList_Remove(himl, 7);
|
||||
ok(ret, "ImageList_Remove failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 4, ILC_COLOR24, "4");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 1, ILC_COLOR24, "4");
|
||||
|
||||
ret = pImageList_Remove(himl, -2);
|
||||
ok(!ret, "ImageList_Remove(-2) should fail\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 4, ILC_COLOR24, "5");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 1, ILC_COLOR24, "5");
|
||||
|
||||
ret = pImageList_Remove(himl, 20);
|
||||
ok(!ret, "ImageList_Remove(20) should fail\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 4, ILC_COLOR24, "6");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 1, ILC_COLOR24, "6");
|
||||
|
||||
ret = pImageList_Remove(himl, -1);
|
||||
ok(ret, "ImageList_Remove(-1) failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 4, 4, ILC_COLOR24, "7");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 4, 1, ILC_COLOR24, "7");
|
||||
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
@ -1147,13 +1182,13 @@ static void test_imagelist_storage(void)
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 207, 209);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 208, 212, ILC_COLOR24, "init 207 grow 209");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 208, 209, ILC_COLOR24, "init 207 grow 209");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 209, 207);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 210, 208, ILC_COLOR24, "init 209 grow 207");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 210, 207, ILC_COLOR24, "init 209 grow 207");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
|
||||
@ -1165,13 +1200,13 @@ static void test_imagelist_storage(void)
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 5, 9);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 6, 12, ILC_COLOR24, "init 5 grow 9");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 6, 9, ILC_COLOR24, "init 5 grow 9");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 9, 5);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 10, 8, ILC_COLOR24, "init 9 grow 5");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 10, 5, ILC_COLOR24, "init 9 grow 5");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
|
||||
@ -1183,79 +1218,88 @@ static void test_imagelist_storage(void)
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 4, 2);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR24, "init 4 grow 2");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 2, ILC_COLOR24, "init 4 grow 2");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR8, 4, 2);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR8, "bpp 8");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 2, ILC_COLOR8, "bpp 8");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4, 4, 2);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR4, "bpp 4");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 2, ILC_COLOR4, "bpp 4");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, 0, 4, 2);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR4, "bpp default");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 2, ILC_COLOR4, "bpp default");
|
||||
icon = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
|
||||
ok( pImageList_ReplaceIcon(himl, -1, icon) == 0, "Failed to add icon.\n");
|
||||
ok( pImageList_ReplaceIcon(himl, -1, icon) == 1, "Failed to add icon.\n");
|
||||
DestroyIcon( icon );
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 4, ILC_COLOR4, "bpp default");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 2, ILC_COLOR4, "bpp default");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24|ILC_MASK, 4, 2);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR24|ILC_MASK, "bpp 24 + mask");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 2, ILC_COLOR24|ILC_MASK, "bpp 24 + mask");
|
||||
icon = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
|
||||
ok( pImageList_ReplaceIcon(himl, -1, icon) == 0, "Failed to add icon.\n");
|
||||
ok( pImageList_ReplaceIcon(himl, -1, icon) == 1, "Failed to add icon.\n");
|
||||
DestroyIcon( icon );
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 4, ILC_COLOR24|ILC_MASK, "bpp 24 + mask");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 2, ILC_COLOR24|ILC_MASK, "bpp 24 + mask");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 4, 2);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR4|ILC_MASK, "bpp 4 + mask");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 2, ILC_COLOR4|ILC_MASK, "bpp 4 + mask");
|
||||
icon = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
|
||||
ok( pImageList_ReplaceIcon(himl, -1, icon) == 0, "Failed to add icon.\n");
|
||||
ok( pImageList_ReplaceIcon(himl, -1, icon) == 1, "Failed to add icon.\n");
|
||||
DestroyIcon( icon );
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 4, ILC_COLOR4|ILC_MASK, "bpp 4 + mask");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 2, ILC_COLOR4|ILC_MASK, "bpp 4 + mask");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, 99);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99");
|
||||
icon = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
|
||||
ok( pImageList_ReplaceIcon(himl, -1, icon) == 0, "Failed to add icon.\n");
|
||||
ok( pImageList_ReplaceIcon(himl, -1, icon) == 1, "Failed to add icon.\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 2, 3, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99 2 icons");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 2, 3, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99 2 icons");
|
||||
ok( pImageList_ReplaceIcon(himl, -1, icon) == 2, "Failed to add icon\n");
|
||||
DestroyIcon( icon );
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 3, 104, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99 3 icons");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 3, 104, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99 3 icons");
|
||||
ok( pImageList_Remove(himl, -1) == TRUE, "Failed to remove icon.\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 100, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99 empty");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 100, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99 empty");
|
||||
ok( pImageList_SetImageCount(himl, 22) == TRUE, "Failed to set image count.\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 22, 23, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99 set count 22");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 22, 23, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99 set count 22");
|
||||
ok( pImageList_SetImageCount(himl, 0) == TRUE, "Failed to set image count.\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 1, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99 set count 0");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 1, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99 set count 0");
|
||||
ok( pImageList_SetImageCount(himl, 42) == TRUE, "Failed to set image count.\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 42, 43, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99 set count 42");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 42, 43, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99 set count 42");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
|
||||
for (grow = 1; grow <= 16; grow++)
|
||||
{
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, grow);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, grow, ILC_COLOR4|ILC_MASK, "grow test");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
}
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, -20);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 4, ILC_COLOR4|ILC_MASK, "init 2 grow -20");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, -20, ILC_COLOR4|ILC_MASK, "init 2 grow -20");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
|
||||
@ -1264,13 +1308,13 @@ static void test_imagelist_storage(void)
|
||||
{
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, 65536+12);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 12, ILC_COLOR4|ILC_MASK, "init 2 grow 65536+12");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 65536+12, ILC_COLOR4|ILC_MASK, "init 2 grow 65536+12");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
|
||||
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, 65535);
|
||||
ok(himl != 0, "ImageList_Create failed\n");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 0, ILC_COLOR4|ILC_MASK, "init 2 grow 65535");
|
||||
check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 65535, ILC_COLOR4|ILC_MASK, "init 2 grow 65535");
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
}
|
||||
@ -1537,7 +1581,7 @@ cleanup:
|
||||
|
||||
if(himl)
|
||||
{
|
||||
ret = ImageList_Destroy(himl);
|
||||
ret = pImageList_Destroy(himl);
|
||||
ok(ret, "ImageList_Destroy failed\n");
|
||||
}
|
||||
}
|
||||
@ -1560,21 +1604,21 @@ static void test_iimagelist(void)
|
||||
imgl = (IImageList*)createImageList(32, 32);
|
||||
ret = IImageList_AddRef(imgl);
|
||||
ok(ret == 2, "Expected 2, got %d\n", ret);
|
||||
ret = ImageList_Destroy((HIMAGELIST)imgl);
|
||||
ret = pImageList_Destroy((HIMAGELIST)imgl);
|
||||
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
|
||||
ret = ImageList_Destroy((HIMAGELIST)imgl);
|
||||
ret = pImageList_Destroy((HIMAGELIST)imgl);
|
||||
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
|
||||
ret = ImageList_Destroy((HIMAGELIST)imgl);
|
||||
ret = pImageList_Destroy((HIMAGELIST)imgl);
|
||||
ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
|
||||
|
||||
imgl = (IImageList*)createImageList(32, 32);
|
||||
ret = IImageList_AddRef(imgl);
|
||||
ok(ret == 2, "Expected 2, got %d\n", ret);
|
||||
ret = ImageList_Destroy((HIMAGELIST)imgl);
|
||||
ret = pImageList_Destroy((HIMAGELIST)imgl);
|
||||
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
|
||||
ret = IImageList_Release(imgl);
|
||||
ok(ret == 0, "Expected 0, got %d\n", ret);
|
||||
ret = ImageList_Destroy((HIMAGELIST)imgl);
|
||||
ret = pImageList_Destroy((HIMAGELIST)imgl);
|
||||
ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
|
||||
|
||||
/* ref counting, HIMAGELIST_QueryInterface adds a reference */
|
||||
@ -1635,7 +1679,7 @@ static void test_IImageList_Add_Remove(void)
|
||||
int ret;
|
||||
|
||||
/* create an imagelist to play with */
|
||||
himl = ImageList_Create(84, 84, ILC_COLOR16, 0, 3);
|
||||
himl = pImageList_Create(84, 84, ILC_COLOR16, 0, 3);
|
||||
ok(himl != 0,"failed to create imagelist\n");
|
||||
|
||||
imgl = (IImageList *) himl;
|
||||
@ -1689,7 +1733,7 @@ static void test_IImageList_Get_SetImageCount(void)
|
||||
INT ret;
|
||||
|
||||
/* create an imagelist to play with */
|
||||
himl = ImageList_Create(84, 84, ILC_COLOR16, 0, 3);
|
||||
himl = pImageList_Create(84, 84, ILC_COLOR16, 0, 3);
|
||||
ok(himl != 0,"failed to create imagelist\n");
|
||||
|
||||
imgl = (IImageList *) himl;
|
||||
@ -1734,7 +1778,7 @@ static void test_IImageList_Draw(void)
|
||||
ok(hdc!=NULL, "couldn't get DC\n");
|
||||
|
||||
/* create an imagelist to play with */
|
||||
himl = ImageList_Create(48, 48, ILC_COLOR16, 0, 3);
|
||||
himl = pImageList_Create(48, 48, ILC_COLOR16, 0, 3);
|
||||
ok(himl!=0,"failed to create imagelist\n");
|
||||
|
||||
imgl = (IImageList *) himl;
|
||||
@ -1811,10 +1855,10 @@ static void test_IImageList_Merge(void)
|
||||
HRESULT hr;
|
||||
int ret;
|
||||
|
||||
himl1 = ImageList_Create(32,32,0,0,3);
|
||||
himl1 = pImageList_Create(32,32,0,0,3);
|
||||
ok(himl1 != NULL,"failed to create himl1\n");
|
||||
|
||||
himl2 = ImageList_Create(32,32,0,0,3);
|
||||
himl2 = pImageList_Create(32,32,0,0,3);
|
||||
ok(himl2 != NULL,"failed to create himl2\n");
|
||||
|
||||
hicon1 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
|
||||
@ -1848,7 +1892,7 @@ if (0)
|
||||
|
||||
/* Same happens if himl2 is empty */
|
||||
IImageList_Release(imgl2);
|
||||
himl2 = ImageList_Create(32,32,0,0,3);
|
||||
himl2 = pImageList_Create(32,32,0,0,3);
|
||||
ok(himl2 != NULL,"failed to recreate himl2\n");
|
||||
|
||||
imgl2 = (IImageList *) himl2;
|
||||
@ -2007,9 +2051,9 @@ static void check_color_table(const char *name, HDC hdc, HIMAGELIST himl, UINT i
|
||||
ok((bmi->bmiColors[i].rgbRed == expect[i].rgbRed &&
|
||||
bmi->bmiColors[i].rgbGreen == expect[i].rgbGreen &&
|
||||
bmi->bmiColors[i].rgbBlue == expect[i].rgbBlue) ||
|
||||
broken(bmi->bmiColors[i].rgbRed == broken_expect[i].rgbRed &&
|
||||
(broken_expect && broken(bmi->bmiColors[i].rgbRed == broken_expect[i].rgbRed &&
|
||||
bmi->bmiColors[i].rgbGreen == broken_expect[i].rgbGreen &&
|
||||
bmi->bmiColors[i].rgbBlue == broken_expect[i].rgbBlue),
|
||||
bmi->bmiColors[i].rgbBlue == broken_expect[i].rgbBlue)),
|
||||
"%d: %s: got color[%d] %02x %02x %02x expect %02x %02x %02x\n", depth, name, i,
|
||||
bmi->bmiColors[i].rgbRed, bmi->bmiColors[i].rgbGreen, bmi->bmiColors[i].rgbBlue,
|
||||
expect[i].rgbRed, expect[i].rgbGreen, expect[i].rgbBlue);
|
||||
@ -2346,7 +2390,7 @@ static void test_IImageList_GetIconSize(void)
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = GetModuleHandleA("comctl32.dll");
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
#define X2(f, ord) p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
|
||||
@ -2375,6 +2419,7 @@ static void init_functions(void)
|
||||
X(ImageList_LoadImageW);
|
||||
X(ImageList_CoCreateInstance);
|
||||
X(HIMAGELIST_QueryInterface);
|
||||
X(ImageList_Draw);
|
||||
#undef X
|
||||
#undef X2
|
||||
}
|
||||
@ -2388,8 +2433,6 @@ START_TEST(imagelist)
|
||||
|
||||
hinst = GetModuleHandleA(NULL);
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
test_create_destroy();
|
||||
test_begindrag();
|
||||
test_hotspot();
|
||||
|
@ -17,7 +17,12 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
|
||||
#define expect(expected, got) ok(expected == got, "expected %d, got %d\n", expected,got)
|
||||
|
||||
@ -57,32 +62,17 @@ static void test_get_set_text(void)
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static BOOL init(void)
|
||||
{
|
||||
HMODULE hComctl32;
|
||||
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
INITCOMMONCONTROLSEX iccex;
|
||||
|
||||
hComctl32 = GetModuleHandleA("comctl32.dll");
|
||||
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
|
||||
if (!pInitCommonControlsEx)
|
||||
{
|
||||
win_skip("InitCommonControlsEx() is missing.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
iccex.dwSize = sizeof(iccex);
|
||||
/* W2K and below need ICC_INTERNET_CLASSES for the IP Address Control */
|
||||
iccex.dwICC = ICC_INTERNET_CLASSES;
|
||||
pInitCommonControlsEx(&iccex);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
START_TEST(ipaddress)
|
||||
{
|
||||
if (!init())
|
||||
ULONG_PTR cookie;
|
||||
HANDLE ctxt;
|
||||
|
||||
test_get_set_text();
|
||||
|
||||
if (!load_v6_module(&cookie, &ctxt))
|
||||
return;
|
||||
|
||||
test_get_set_text();
|
||||
|
||||
unload_v6_module(cookie, ctxt);
|
||||
}
|
||||
|
@ -17,7 +17,19 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winnls.h"
|
||||
#include "commctrl.h"
|
||||
|
||||
#include "wine/heap.h"
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
|
||||
static const char * const strings[4] = {
|
||||
"First added",
|
||||
@ -31,6 +43,15 @@ static const char * const strings[4] = {
|
||||
|
||||
static const char BAD_EXTENSION[] = "*.badtxt";
|
||||
|
||||
static int strcmp_aw(LPCWSTR strw, const char *stra)
|
||||
{
|
||||
WCHAR buf[1024];
|
||||
|
||||
if (!stra) return 1;
|
||||
MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, sizeof(buf)/sizeof(WCHAR));
|
||||
return lstrcmpW(strw, buf);
|
||||
}
|
||||
|
||||
static HWND create_listbox(DWORD add_style, HWND parent)
|
||||
{
|
||||
INT_PTR ctl_id = 0;
|
||||
@ -39,7 +60,7 @@ static HWND create_listbox(DWORD add_style, HWND parent)
|
||||
if (parent)
|
||||
ctl_id=1;
|
||||
|
||||
handle = CreateWindowA("LISTBOX", "TestList", (LBS_STANDARD & ~LBS_SORT) | add_style, 0, 0, 100, 100,
|
||||
handle = CreateWindowA(WC_LISTBOXA, "TestList", (LBS_STANDARD & ~LBS_SORT) | add_style, 0, 0, 100, 100,
|
||||
parent, (HMENU)ctl_id, NULL, 0);
|
||||
ok(handle != NULL, "Failed to create listbox window.\n");
|
||||
|
||||
@ -144,11 +165,11 @@ static void run_test(const struct listbox_test test)
|
||||
WCHAR *txtw;
|
||||
CHAR *txt;
|
||||
|
||||
txt = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 1);
|
||||
txt = heap_alloc_zero(size + 1);
|
||||
resA = SendMessageA(hLB, LB_GETTEXT, i, (LPARAM)txt);
|
||||
ok(!strcmp(txt, strings[i]), "returned string for item %d does not match %s vs %s\n", i, txt, strings[i]);
|
||||
|
||||
txtw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (size + 1) * sizeof(*txtw));
|
||||
txtw = heap_alloc_zero((size + 1) * sizeof(*txtw));
|
||||
resW = SendMessageW(hLB, LB_GETTEXT, i, (LPARAM)txtw);
|
||||
if (resA != resW)
|
||||
trace("SendMessageW(LB_GETTEXT) not supported on this platform (resA=%d resW=%d), skipping...\n", resA, resW);
|
||||
@ -158,8 +179,8 @@ static void run_test(const struct listbox_test test)
|
||||
ok(!strcmp (txt, strings[i]), "returned string for item %d does not match %s vs %s\n", i, txt, strings[i]);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, txtw);
|
||||
HeapFree(GetProcessHeap(), 0, txt);
|
||||
heap_free(txtw);
|
||||
heap_free(txt);
|
||||
}
|
||||
|
||||
/* Confirm the count of items, and that an invalid delete does not remove anything */
|
||||
@ -196,7 +217,7 @@ static void test_item_height(void)
|
||||
|
||||
DestroyWindow (hLB);
|
||||
|
||||
hLB = CreateWindowA("LISTBOX", "TestList", LBS_OWNERDRAWVARIABLE, 0, 0, 100, 100, NULL, NULL, NULL, 0);
|
||||
hLB = CreateWindowA(WC_LISTBOXA, "TestList", LBS_OWNERDRAWVARIABLE, 0, 0, 100, 100, NULL, NULL, NULL, 0);
|
||||
|
||||
itemHeight = SendMessageA(hLB, LB_GETITEMHEIGHT, 0, 0);
|
||||
ok(itemHeight > 0 && itemHeight <= tm.tmHeight, "Unexpected item height %d, expected %d.\n",
|
||||
@ -217,6 +238,31 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_MEASUREITEM:
|
||||
{
|
||||
DWORD style = GetWindowLongA(GetWindow(hwnd, GW_CHILD), GWL_STYLE);
|
||||
MEASUREITEMSTRUCT *mi = (void*)lparam;
|
||||
|
||||
ok(wparam == mi->CtlID, "got wParam=%08lx, expected %08x\n", wparam, mi->CtlID);
|
||||
ok(mi->CtlType == ODT_LISTBOX, "mi->CtlType = %u\n", mi->CtlType);
|
||||
ok(mi->CtlID == 1, "mi->CtlID = %u\n", mi->CtlID);
|
||||
ok(mi->itemHeight, "mi->itemHeight = 0\n");
|
||||
|
||||
if (mi->itemID > 4 || style & LBS_OWNERDRAWFIXED)
|
||||
break;
|
||||
|
||||
if (style & LBS_HASSTRINGS)
|
||||
{
|
||||
ok(!strcmp_aw((WCHAR*)mi->itemData, strings[mi->itemID]),
|
||||
"mi->itemData = %s (%d)\n", wine_dbgstr_w((WCHAR*)mi->itemData), mi->itemID);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok((void*)mi->itemData == strings[mi->itemID],
|
||||
"mi->itemData = %08lx, expected %p\n", mi->itemData, strings[mi->itemID]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_DRAWITEM:
|
||||
{
|
||||
RECT rc_item, rc_client, rc_clip;
|
||||
@ -279,10 +325,10 @@ static void test_ownerdraw(void)
|
||||
RECT rc;
|
||||
|
||||
parent = create_parent();
|
||||
assert(parent);
|
||||
ok(parent != NULL, "Failed to create parent window.\n");
|
||||
|
||||
hLB = create_listbox(LBS_OWNERDRAWFIXED | WS_CHILD | WS_VISIBLE, parent);
|
||||
assert(hLB);
|
||||
ok(hLB != NULL, "Failed to create listbox window.\n");
|
||||
|
||||
SetForegroundWindow(hLB);
|
||||
UpdateWindow(hLB);
|
||||
@ -321,7 +367,7 @@ static void test_LB_SELITEMRANGE(void)
|
||||
INT ret;
|
||||
|
||||
hLB = create_listbox(LBS_EXTENDEDSEL, 0);
|
||||
assert(hLB);
|
||||
ok(hLB != NULL, "Failed to create listbox window.\n");
|
||||
|
||||
listbox_query(hLB, &answer);
|
||||
listbox_test_query(test_nosel, answer);
|
||||
@ -419,7 +465,7 @@ static void test_listbox_height(void)
|
||||
HWND hList;
|
||||
int r, id;
|
||||
|
||||
hList = CreateWindowA( "ListBox", "list test", 0,
|
||||
hList = CreateWindowA( WC_LISTBOXA, "list test", 0,
|
||||
1, 1, 600, 100, NULL, NULL, NULL, NULL );
|
||||
ok( hList != NULL, "failed to create listbox\n");
|
||||
|
||||
@ -459,21 +505,20 @@ static void test_itemfrompoint(void)
|
||||
without caption). LBS_NOINTEGRALHEIGHT is required in order to test
|
||||
behavior of partially-displayed item.
|
||||
*/
|
||||
HWND hList = CreateWindowA( "ListBox", "list test",
|
||||
HWND hList = CreateWindowA( WC_LISTBOXA, "list test",
|
||||
WS_VISIBLE|WS_POPUP|LBS_NOINTEGRALHEIGHT,
|
||||
1, 1, 600, 100, NULL, NULL, NULL, NULL );
|
||||
ULONG r, id;
|
||||
RECT rc;
|
||||
|
||||
/* For an empty listbox win2k returns 0x1ffff, win98 returns 0x10000, nt4 returns 0xffffffff */
|
||||
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 30 ));
|
||||
ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %x\n", r );
|
||||
ok( r == MAKELPARAM(0xffff, 1), "Unexpected ret value %#x.\n", r );
|
||||
|
||||
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( 700, 30 ));
|
||||
ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %x\n", r );
|
||||
ok( r == MAKELPARAM(0xffff, 1), "Unexpected ret value %#x.\n", r );
|
||||
|
||||
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( 30, 300 ));
|
||||
ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %x\n", r );
|
||||
ok( r == MAKELPARAM(0xffff, 1), "Unexpected ret value %#x.\n", r );
|
||||
|
||||
id = SendMessageA( hList, LB_ADDSTRING, 0, (LPARAM) "hi");
|
||||
ok( id == 0, "item id wrong\n");
|
||||
@ -484,7 +529,7 @@ static void test_itemfrompoint(void)
|
||||
ok( r == 0x1, "ret %x\n", r );
|
||||
|
||||
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 601 ));
|
||||
ok( r == 0x10001, "ret %x\n", r );
|
||||
ok( r == MAKELPARAM(1, 1), "Unexpected ret value %#x.\n", r );
|
||||
|
||||
/* Resize control so that below assertions about sizes are valid */
|
||||
r = SendMessageA( hList, LB_GETITEMRECT, 0, (LPARAM)&rc);
|
||||
@ -540,7 +585,7 @@ static void test_listbox_item_data(void)
|
||||
HWND hList;
|
||||
int r, id;
|
||||
|
||||
hList = CreateWindowA( "ListBox", "list test", 0,
|
||||
hList = CreateWindowA( WC_LISTBOXA, "list test", 0,
|
||||
1, 1, 600, 100, NULL, NULL, NULL, NULL );
|
||||
ok( hList != NULL, "failed to create listbox\n");
|
||||
|
||||
@ -580,9 +625,9 @@ static void test_listbox_LB_DIR(void)
|
||||
one file that fits the wildcard w*.c . Normally, the test
|
||||
directory itself satisfies both conditions.
|
||||
*/
|
||||
hList = CreateWindowA( "ListBox", "list test", WS_VISIBLE|WS_POPUP,
|
||||
hList = CreateWindowA( WC_LISTBOXA, "list test", WS_VISIBLE|WS_POPUP,
|
||||
1, 1, 600, 100, NULL, NULL, NULL, NULL );
|
||||
assert(hList);
|
||||
ok(hList != NULL, "Failed to create listbox window.\n");
|
||||
|
||||
/* Test for standard usage */
|
||||
|
||||
@ -891,7 +936,7 @@ static void test_listbox_LB_DIR(void)
|
||||
strcpy(pathBuffer, wildcard);
|
||||
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
|
||||
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
|
||||
ok (res != -1 || broken(res == -1), "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, *) failed err %u\n",
|
||||
ok (res != -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, *) failed err %u\n",
|
||||
GetLastError());
|
||||
|
||||
itemCount = SendMessageA(hList, LB_GETCOUNT, 0, 0);
|
||||
@ -999,11 +1044,11 @@ static HWND g_label;
|
||||
|
||||
static BOOL on_listbox_container_create(HWND hwnd, CREATESTRUCTA *lpcs)
|
||||
{
|
||||
g_label = CreateWindowA("Static", "Contents of static control before DlgDirList.",
|
||||
g_label = CreateWindowA(WC_STATICA, "Contents of static control before DlgDirList.",
|
||||
WS_CHILD | WS_VISIBLE, 10, 10, 512, 32, hwnd, (HMENU)ID_TEST_LABEL, NULL, 0);
|
||||
if (!g_label) return FALSE;
|
||||
|
||||
g_listBox = CreateWindowA("ListBox", "DlgDirList test",
|
||||
g_listBox = CreateWindowA(WC_LISTBOXA, "DlgDirList test",
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER | WS_VSCROLL, 10, 60, 256, 256,
|
||||
hwnd, (HMENU)ID_TEST_LISTBOX, NULL, 0);
|
||||
if (!g_listBox) return FALSE;
|
||||
@ -1064,6 +1109,7 @@ static void test_listbox_dlgdir(void)
|
||||
char * p;
|
||||
char driveletter;
|
||||
HANDLE file;
|
||||
BOOL ret;
|
||||
|
||||
file = CreateFileA( "wtest1.tmp.c", GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL );
|
||||
ok(file != INVALID_HANDLE_VALUE, "Error creating the test file: %d\n", GetLastError());
|
||||
@ -1076,7 +1122,8 @@ static void test_listbox_dlgdir(void)
|
||||
*/
|
||||
|
||||
hInst = GetModuleHandleA(0);
|
||||
if (!RegisterListboxWindowClass(hInst)) assert(0);
|
||||
ret = RegisterListboxWindowClass(hInst);
|
||||
ok(ret, "Failed to register test class.\n");
|
||||
|
||||
hWnd = CreateWindowA("ListboxContainerClass", "ListboxContainerClass",
|
||||
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
@ -1824,6 +1871,26 @@ static void test_listbox(void)
|
||||
run_test(EMS_NS);
|
||||
}
|
||||
|
||||
static void test_WM_MEASUREITEM(void)
|
||||
{
|
||||
HWND parent, listbox;
|
||||
LRESULT data;
|
||||
|
||||
parent = create_parent();
|
||||
listbox = create_listbox(WS_CHILD | LBS_OWNERDRAWVARIABLE, parent);
|
||||
|
||||
data = SendMessageA(listbox, LB_GETITEMDATA, 0, 0);
|
||||
ok(data == (LRESULT)strings[0], "data = %08lx, expected %p\n", data, strings[0]);
|
||||
DestroyWindow(parent);
|
||||
|
||||
parent = create_parent();
|
||||
listbox = create_listbox(WS_CHILD | LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS, parent);
|
||||
|
||||
data = SendMessageA(listbox, LB_GETITEMDATA, 0, 0);
|
||||
ok(!data, "data = %08lx\n", data);
|
||||
DestroyWindow(parent);
|
||||
}
|
||||
|
||||
START_TEST(listbox)
|
||||
{
|
||||
ULONG_PTR ctx_cookie;
|
||||
@ -1846,6 +1913,7 @@ START_TEST(listbox)
|
||||
test_GetListBoxInfo();
|
||||
test_missing_lbuttonup();
|
||||
test_extents();
|
||||
test_WM_MEASUREITEM();
|
||||
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
}
|
||||
|
@ -20,7 +20,18 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
#include "msg.h"
|
||||
|
||||
static HIMAGELIST (WINAPI *pImageList_Create)(int, int, UINT, int, int);
|
||||
static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
|
||||
static int (WINAPI *pImageList_Add)(HIMAGELIST, HBITMAP, HBITMAP);
|
||||
static BOOL (WINAPI *p_TrackMouseEvent)(TRACKMOUSEEVENT *);
|
||||
|
||||
enum seq_index {
|
||||
PARENT_SEQ_INDEX,
|
||||
@ -67,6 +78,18 @@ static BOOL g_focus_test_LVN_DELETEITEM;
|
||||
|
||||
static HWND subclass_editbox(HWND hwndListview);
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
X(ImageList_Create);
|
||||
X(ImageList_Destroy);
|
||||
X(ImageList_Add);
|
||||
X(_TrackMouseEvent);
|
||||
#undef X
|
||||
}
|
||||
|
||||
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
|
||||
|
||||
static const struct message create_ownerdrawfixed_parent_seq[] = {
|
||||
@ -695,6 +718,21 @@ static HWND create_listview_controlW(DWORD style, HWND parent)
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
static BOOL is_win_xp(void)
|
||||
{
|
||||
HWND hwnd, header;
|
||||
BOOL ret;
|
||||
|
||||
hwnd = create_listview_control(LVS_ICON);
|
||||
SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_HEADERINALLVIEWS, LVS_EX_HEADERINALLVIEWS);
|
||||
header = (HWND)SendMessageA(hwnd, LVM_GETHEADER, 0, 0);
|
||||
ret = !IsWindow(header);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static LRESULT WINAPI header_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||
@ -842,16 +880,16 @@ static void test_images(void)
|
||||
RECT r1, r2;
|
||||
static CHAR hello[] = "hello";
|
||||
|
||||
himl = ImageList_Create(40, 40, 0, 4, 4);
|
||||
himl = pImageList_Create(40, 40, 0, 4, 4);
|
||||
ok(himl != NULL, "failed to create imagelist\n");
|
||||
|
||||
hbmp = CreateBitmap(40, 40, 1, 1, NULL);
|
||||
ok(hbmp != NULL, "failed to create bitmap\n");
|
||||
|
||||
r = ImageList_Add(himl, hbmp, 0);
|
||||
r = pImageList_Add(himl, hbmp, 0);
|
||||
ok(r == 0, "should be zero\n");
|
||||
|
||||
hwnd = CreateWindowExA(0, "SysListView32", "foo", LVS_OWNERDRAWFIXED,
|
||||
hwnd = CreateWindowExA(0, WC_LISTVIEWA, "foo", LVS_OWNERDRAWFIXED,
|
||||
10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
|
||||
ok(hwnd != NULL, "failed to create listview window\n");
|
||||
|
||||
@ -914,7 +952,7 @@ static void test_checkboxes(void)
|
||||
text2[] = "Text2",
|
||||
text3[] = "Text3";
|
||||
|
||||
hwnd = CreateWindowExA(0, "SysListView32", "foo", LVS_REPORT,
|
||||
hwnd = CreateWindowExA(0, WC_LISTVIEWA, "foo", LVS_REPORT,
|
||||
10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
|
||||
ok(hwnd != NULL, "failed to create listview window\n");
|
||||
|
||||
@ -1141,7 +1179,7 @@ static void test_items(void)
|
||||
LVITEMA item;
|
||||
DWORD r;
|
||||
|
||||
hwnd = CreateWindowExA(0, "SysListView32", "foo", LVS_REPORT,
|
||||
hwnd = CreateWindowExA(0, WC_LISTVIEWA, "foo", LVS_REPORT,
|
||||
10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
|
||||
ok(hwnd != NULL, "failed to create listview window\n");
|
||||
|
||||
@ -1398,7 +1436,7 @@ static void test_columns(void)
|
||||
CHAR buff[5];
|
||||
DWORD rc;
|
||||
|
||||
hwnd = CreateWindowExA(0, "SysListView32", "foo", LVS_LIST,
|
||||
hwnd = CreateWindowExA(0, WC_LISTVIEWA, "foo", LVS_LIST,
|
||||
10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
|
||||
ok(hwnd != NULL, "failed to create listview window\n");
|
||||
|
||||
@ -1413,7 +1451,7 @@ static void test_columns(void)
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
hwnd = CreateWindowExA(0, "SysListView32", "foo", LVS_REPORT,
|
||||
hwnd = CreateWindowExA(0, WC_LISTVIEWA, "foo", LVS_REPORT,
|
||||
10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
|
||||
ok(hwnd != NULL, "failed to create listview window\n");
|
||||
|
||||
@ -1513,7 +1551,28 @@ static LRESULT CALLBACK create_test_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void test_create(void)
|
||||
/* Header creation is delayed in classic implementation. */
|
||||
#define TEST_NO_HEADER(a) test_header_presence_(a, FALSE, __LINE__)
|
||||
#define TEST_HEADER_EXPECTED(a) test_header_presence_(a, TRUE, __LINE__)
|
||||
#define TEST_NO_HEADER2(a, b) test_header_presence_(a, b, __LINE__)
|
||||
static void test_header_presence_(HWND hwnd, BOOL present, int line)
|
||||
{
|
||||
HWND header = (HWND)SendMessageA(hwnd, LVM_GETHEADER, 0, 0);
|
||||
|
||||
if (present)
|
||||
{
|
||||
ok_(__FILE__, line)(IsWindow(header), "Header should have been created.\n");
|
||||
if (header) /* FIXME: remove when todo's are fixed */
|
||||
ok_(__FILE__, line)(header == GetDlgItem(hwnd, 0), "Dialog item expected.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
ok_(__FILE__, line)(!IsWindow(header), "Header shouldn't be created.\n");
|
||||
ok_(__FILE__, line)(NULL == GetDlgItem(hwnd, 0), "NULL dialog item expected.\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void test_create(BOOL is_version_6)
|
||||
{
|
||||
static const WCHAR testtextW[] = {'t','e','s','t',' ','t','e','x','t',0};
|
||||
char buff[16];
|
||||
@ -1525,15 +1584,24 @@ static void test_create(void)
|
||||
RECT rect;
|
||||
WNDCLASSEXA cls;
|
||||
DWORD style;
|
||||
ATOM class;
|
||||
|
||||
if (is_win_xp() && is_version_6)
|
||||
{
|
||||
win_skip("Skipping some tests on XP.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
cls.cbSize = sizeof(WNDCLASSEXA);
|
||||
ok(GetClassInfoExA(GetModuleHandleA(NULL), "SysListView32", &cls), "GetClassInfoEx failed\n");
|
||||
r = GetClassInfoExA(GetModuleHandleA(NULL), WC_LISTVIEWA, &cls);
|
||||
ok(r, "Failed to get class info.\n");
|
||||
listviewWndProc = cls.lpfnWndProc;
|
||||
cls.lpfnWndProc = create_test_wndproc;
|
||||
cls.lpszClassName = "MyListView32";
|
||||
ok(RegisterClassExA(&cls), "RegisterClassEx failed\n");
|
||||
class = RegisterClassExA(&cls);
|
||||
ok(class, "Failed to register class.\n");
|
||||
|
||||
test_create_imagelist = ImageList_Create(16, 16, 0, 5, 10);
|
||||
test_create_imagelist = pImageList_Create(16, 16, 0, 5, 10);
|
||||
hList = CreateWindowA("MyListView32", "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0);
|
||||
ok((HIMAGELIST)SendMessageA(hList, LVM_GETIMAGELIST, 0, 0) == test_create_imagelist, "Image list not obtained\n");
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
@ -1542,150 +1610,118 @@ static void test_create(void)
|
||||
DestroyWindow(hList);
|
||||
|
||||
/* header isn't created on LVS_ICON and LVS_LIST styles */
|
||||
hList = CreateWindowA("SysListView32", "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL,
|
||||
GetModuleHandleA(NULL), 0);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(!IsWindow(hHeader), "Header shouldn't be created\n");
|
||||
ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
|
||||
hList = CreateWindowA(WC_LISTVIEWA, "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0);
|
||||
TEST_NO_HEADER(hList);
|
||||
|
||||
/* insert column */
|
||||
memset(&col, 0, sizeof(LVCOLUMNA));
|
||||
col.mask = LVCF_WIDTH;
|
||||
col.cx = 100;
|
||||
r = SendMessageA(hList, LVM_INSERTCOLUMNA, 0, (LPARAM)&col);
|
||||
expect(0, r);
|
||||
TEST_HEADER_EXPECTED(hList);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(IsWindow(hHeader), "Header should be created\n");
|
||||
ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
|
||||
style = GetWindowLongA(hHeader, GWL_STYLE);
|
||||
ok(!(style & HDS_HIDDEN), "Not expected HDS_HIDDEN\n");
|
||||
DestroyWindow(hList);
|
||||
|
||||
hList = CreateWindowA("SysListView32", "Test", WS_VISIBLE|LVS_LIST, 0, 0, 100, 100, NULL, NULL,
|
||||
hList = CreateWindowA(WC_LISTVIEWA, "Test", WS_VISIBLE|LVS_LIST, 0, 0, 100, 100, NULL, NULL,
|
||||
GetModuleHandleA(NULL), 0);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(!IsWindow(hHeader), "Header shouldn't be created\n");
|
||||
ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
|
||||
TEST_NO_HEADER(hList);
|
||||
/* insert column */
|
||||
memset(&col, 0, sizeof(LVCOLUMNA));
|
||||
col.mask = LVCF_WIDTH;
|
||||
col.cx = 100;
|
||||
r = SendMessageA(hList, LVM_INSERTCOLUMNA, 0, (LPARAM)&col);
|
||||
expect(0, r);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(IsWindow(hHeader), "Header should be created\n");
|
||||
ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
|
||||
TEST_HEADER_EXPECTED(hList);
|
||||
DestroyWindow(hList);
|
||||
|
||||
/* try to switch LVS_ICON -> LVS_REPORT and back LVS_ICON -> LVS_REPORT */
|
||||
hList = CreateWindowA("SysListView32", "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL,
|
||||
hList = CreateWindowA(WC_LISTVIEWA, "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL,
|
||||
GetModuleHandleA(NULL), 0);
|
||||
ret = SetWindowLongPtrA(hList, GWL_STYLE, GetWindowLongPtrA(hList, GWL_STYLE) | LVS_REPORT);
|
||||
ok(ret & WS_VISIBLE, "Style wrong, should have WS_VISIBLE\n");
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(IsWindow(hHeader), "Header should be created\n");
|
||||
TEST_HEADER_EXPECTED(hList);
|
||||
ret = SetWindowLongPtrA(hList, GWL_STYLE, GetWindowLongA(hList, GWL_STYLE) & ~LVS_REPORT);
|
||||
ok((ret & WS_VISIBLE) && (ret & LVS_REPORT), "Style wrong, should have WS_VISIBLE|LVS_REPORT\n");
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(IsWindow(hHeader), "Header should be created\n");
|
||||
ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
|
||||
TEST_HEADER_EXPECTED(hList);
|
||||
DestroyWindow(hList);
|
||||
|
||||
/* try to switch LVS_LIST -> LVS_REPORT and back LVS_LIST -> LVS_REPORT */
|
||||
hList = CreateWindowA("SysListView32", "Test", WS_VISIBLE|LVS_LIST, 0, 0, 100, 100, NULL, NULL,
|
||||
hList = CreateWindowA(WC_LISTVIEWA, "Test", WS_VISIBLE|LVS_LIST, 0, 0, 100, 100, NULL, NULL,
|
||||
GetModuleHandleA(NULL), 0);
|
||||
ret = SetWindowLongPtrA(hList, GWL_STYLE,
|
||||
(GetWindowLongPtrA(hList, GWL_STYLE) & ~LVS_LIST) | LVS_REPORT);
|
||||
ok(((ret & WS_VISIBLE) && (ret & LVS_LIST)), "Style wrong, should have WS_VISIBLE|LVS_LIST\n");
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(IsWindow(hHeader), "Header should be created\n");
|
||||
ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
|
||||
ret = SetWindowLongPtrA(hList, GWL_STYLE,
|
||||
(GetWindowLongPtrA(hList, GWL_STYLE) & ~LVS_REPORT) | LVS_LIST);
|
||||
TEST_HEADER_EXPECTED(hList);
|
||||
ret = SetWindowLongPtrA(hList, GWL_STYLE, (GetWindowLongPtrA(hList, GWL_STYLE) & ~LVS_REPORT) | LVS_LIST);
|
||||
ok(((ret & WS_VISIBLE) && (ret & LVS_REPORT)), "Style wrong, should have WS_VISIBLE|LVS_REPORT\n");
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(IsWindow(hHeader), "Header should be created\n");
|
||||
ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
|
||||
TEST_HEADER_EXPECTED(hList);
|
||||
DestroyWindow(hList);
|
||||
|
||||
/* LVS_REPORT without WS_VISIBLE */
|
||||
hList = CreateWindowA("SysListView32", "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
|
||||
hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
|
||||
GetModuleHandleA(NULL), 0);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(!IsWindow(hHeader), "Header shouldn't be created\n");
|
||||
ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
|
||||
todo_wine_if(is_version_6)
|
||||
TEST_NO_HEADER2(hList, is_version_6);
|
||||
|
||||
/* insert column */
|
||||
memset(&col, 0, sizeof(LVCOLUMNA));
|
||||
col.mask = LVCF_WIDTH;
|
||||
col.cx = 100;
|
||||
r = SendMessageA(hList, LVM_INSERTCOLUMNA, 0, (LPARAM)&col);
|
||||
expect(0, r);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(IsWindow(hHeader), "Header should be created\n");
|
||||
ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
|
||||
TEST_HEADER_EXPECTED(hList);
|
||||
DestroyWindow(hList);
|
||||
|
||||
/* LVS_REPORT without WS_VISIBLE, try to show it */
|
||||
hList = CreateWindowA("SysListView32", "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
|
||||
hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
|
||||
GetModuleHandleA(NULL), 0);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(!IsWindow(hHeader), "Header shouldn't be created\n");
|
||||
ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
|
||||
todo_wine_if(is_version_6)
|
||||
TEST_NO_HEADER2(hList, is_version_6);
|
||||
|
||||
ShowWindow(hList, SW_SHOW);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(IsWindow(hHeader), "Header should be created\n");
|
||||
ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
|
||||
TEST_HEADER_EXPECTED(hList);
|
||||
DestroyWindow(hList);
|
||||
|
||||
/* LVS_REPORT with LVS_NOCOLUMNHEADER */
|
||||
hList = CreateWindowA("SysListView32", "Test", LVS_REPORT|LVS_NOCOLUMNHEADER|WS_VISIBLE,
|
||||
hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT|LVS_NOCOLUMNHEADER|WS_VISIBLE,
|
||||
0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0);
|
||||
TEST_HEADER_EXPECTED(hList);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(IsWindow(hHeader), "Header should be created\n");
|
||||
ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
|
||||
/* HDS_DRAGDROP set by default */
|
||||
ok(GetWindowLongPtrA(hHeader, GWL_STYLE) & HDS_DRAGDROP, "Expected header to have HDS_DRAGDROP\n");
|
||||
DestroyWindow(hList);
|
||||
|
||||
/* setting LVS_EX_HEADERDRAGDROP creates header */
|
||||
hList = CreateWindowA("SysListView32", "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
|
||||
hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
|
||||
GetModuleHandleA(NULL), 0);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(!IsWindow(hHeader), "Header shouldn't be created\n");
|
||||
ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
|
||||
todo_wine_if(is_version_6)
|
||||
TEST_NO_HEADER2(hList, is_version_6);
|
||||
|
||||
SendMessageA(hList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_HEADERDRAGDROP);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(IsWindow(hHeader) ||
|
||||
broken(!IsWindow(hHeader)), /* 4.7x common controls */
|
||||
"Header should be created\n");
|
||||
ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
|
||||
TEST_HEADER_EXPECTED(hList);
|
||||
DestroyWindow(hList);
|
||||
|
||||
/* setting LVS_EX_GRIDLINES creates header */
|
||||
hList = CreateWindowA("SysListView32", "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
|
||||
hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
|
||||
GetModuleHandleA(NULL), 0);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(!IsWindow(hHeader), "Header shouldn't be created\n");
|
||||
ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
|
||||
todo_wine_if(is_version_6)
|
||||
TEST_NO_HEADER2(hList, is_version_6);
|
||||
|
||||
SendMessageA(hList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_GRIDLINES);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(IsWindow(hHeader) ||
|
||||
broken(!IsWindow(hHeader)), /* 4.7x common controls */
|
||||
"Header should be created\n");
|
||||
ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
|
||||
TEST_HEADER_EXPECTED(hList);
|
||||
DestroyWindow(hList);
|
||||
|
||||
/* setting LVS_EX_FULLROWSELECT creates header */
|
||||
hList = CreateWindowA("SysListView32", "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
|
||||
hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
|
||||
GetModuleHandleA(NULL), 0);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(!IsWindow(hHeader), "Header shouldn't be created\n");
|
||||
ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
|
||||
todo_wine_if(is_version_6)
|
||||
TEST_NO_HEADER2(hList, is_version_6);
|
||||
SendMessageA(hList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(IsWindow(hHeader) ||
|
||||
broken(!IsWindow(hHeader)), /* 4.7x common controls */
|
||||
"Header should be created\n");
|
||||
ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
|
||||
TEST_HEADER_EXPECTED(hList);
|
||||
DestroyWindow(hList);
|
||||
|
||||
/* not report style accepts LVS_EX_HEADERDRAGDROP too */
|
||||
@ -1696,21 +1732,19 @@ static void test_create(void)
|
||||
DestroyWindow(hList);
|
||||
|
||||
/* requesting header info with LVM_GETSUBITEMRECT doesn't create it */
|
||||
hList = CreateWindowA("SysListView32", "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
|
||||
hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
|
||||
GetModuleHandleA(NULL), 0);
|
||||
ok(!IsWindow(hHeader), "Header shouldn't be created\n");
|
||||
ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
|
||||
todo_wine_if(is_version_6)
|
||||
TEST_NO_HEADER2(hList, is_version_6);
|
||||
|
||||
SetRect(&rect, LVIR_BOUNDS, 1, -10, -10);
|
||||
r = SendMessageA(hList, LVM_GETSUBITEMRECT, -1, (LPARAM)&rect);
|
||||
ok(r == 1, "Unexpected ret value %d.\n", r);
|
||||
/* right value contains garbage, probably because header columns are not set up */
|
||||
expect(0, rect.bottom);
|
||||
expect(1, r);
|
||||
|
||||
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
|
||||
ok(!IsWindow(hHeader), "Header shouldn't be created\n");
|
||||
ok(GetDlgItem(hList, 0) == NULL, "NULL dialog item expected\n");
|
||||
ok(rect.bottom >= 0, "Unexpected rectangle.\n");
|
||||
|
||||
todo_wine_if(is_version_6)
|
||||
TEST_NO_HEADER2(hList, is_version_6);
|
||||
DestroyWindow(hList);
|
||||
|
||||
/* WM_MEASUREITEM should be sent when created with LVS_OWNERDRAWFIXED */
|
||||
@ -1736,6 +1770,9 @@ static void test_create(void)
|
||||
GetWindowTextA(hList, buff, sizeof(buff));
|
||||
ok(!strcmp(buff, "test text"), "Unexpected window text %s.\n", buff);
|
||||
DestroyWindow(hList);
|
||||
|
||||
r = UnregisterClassA("MyListView32", NULL);
|
||||
ok(r, "Failed to unregister test class.\n");
|
||||
}
|
||||
|
||||
static void test_redraw(void)
|
||||
@ -1834,12 +1871,16 @@ static LRESULT WINAPI cd_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
clr = GetBkColor(nmlvcd->nmcd.hdc);
|
||||
ok(nmlvcd->clrTextBk == CLR_DEFAULT, "got 0x%x\n", nmlvcd->clrTextBk);
|
||||
ok(nmlvcd->clrText == RGB(0, 255, 0), "got 0x%x\n", nmlvcd->clrText);
|
||||
todo_wine_if(nmlvcd->iSubItem)
|
||||
ok(clr == c0ffee, "clr=%.8x\n", clr);
|
||||
if (!(GetWindowLongW(nmhdr->hwndFrom, GWL_STYLE) & LVS_SHOWSELALWAYS))
|
||||
{
|
||||
todo_wine_if(nmlvcd->iSubItem)
|
||||
ok(clr == c0ffee, "clr=%.8x\n", clr);
|
||||
}
|
||||
return CDRF_NOTIFYPOSTPAINT;
|
||||
case CDDS_ITEMPOSTPAINT | CDDS_SUBITEM:
|
||||
clr = GetBkColor(nmlvcd->nmcd.hdc);
|
||||
todo_wine ok(clr == c0ffee, "clr=%.8x\n", clr);
|
||||
if (!(GetWindowLongW(nmhdr->hwndFrom, GWL_STYLE) & LVS_SHOWSELALWAYS))
|
||||
todo_wine ok(clr == c0ffee, "clr=%.8x\n", clr);
|
||||
ok(nmlvcd->clrTextBk == CLR_DEFAULT, "got 0x%x\n", nmlvcd->clrTextBk);
|
||||
ok(nmlvcd->clrText == RGB(0, 255, 0), "got 0x%x\n", nmlvcd->clrText);
|
||||
return CDRF_DODEFAULT;
|
||||
@ -1855,6 +1896,7 @@ static void test_customdraw(void)
|
||||
{
|
||||
HWND hwnd;
|
||||
WNDPROC oldwndproc;
|
||||
LVITEMA item;
|
||||
|
||||
hwnd = create_listview_control(LVS_REPORT);
|
||||
|
||||
@ -1874,6 +1916,18 @@ static void test_customdraw(void)
|
||||
UpdateWindow(hwnd);
|
||||
ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_report_cd_seq, "parent customdraw, LVS_REPORT", FALSE);
|
||||
|
||||
/* check colors when item is selected */
|
||||
SetWindowLongW(hwnd, GWL_STYLE, GetWindowLongW(hwnd, GWL_STYLE) | LVS_SHOWSELALWAYS);
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = LVIS_SELECTED;
|
||||
item.state = LVIS_SELECTED;
|
||||
SendMessageA(hwnd, LVM_SETITEMSTATE, 0, (LPARAM)&item);
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_report_cd_seq, "parent customdraw, LVS_REPORT, selection", FALSE);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
hwnd = create_listview_control(LVS_LIST);
|
||||
@ -2797,7 +2851,7 @@ static void test_subitem_rect(void)
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
/* try it for non LVS_REPORT style */
|
||||
hwnd = CreateWindowA("SysListView32", "Test", LVS_ICON, 0, 0, 100, 100, NULL, NULL,
|
||||
hwnd = CreateWindowA(WC_LISTVIEWA, "Test", LVS_ICON, 0, 0, 100, 100, NULL, NULL,
|
||||
GetModuleHandleA(NULL), 0);
|
||||
SetRect(&rect, LVIR_BOUNDS, 1, -10, -10);
|
||||
r = SendMessageA(hwnd, LVM_GETSUBITEMRECT, -1, (LPARAM)&rect);
|
||||
@ -3726,15 +3780,15 @@ static void test_hittest(void)
|
||||
test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, 0, FALSE, TRUE);
|
||||
test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, FALSE);
|
||||
/* try with icons, state icons index is 1 based so at least 2 bitmaps needed */
|
||||
himl = ImageList_Create(16, 16, 0, 4, 4);
|
||||
himl = pImageList_Create(16, 16, 0, 4, 4);
|
||||
ok(himl != NULL, "failed to create imagelist\n");
|
||||
hbmp = CreateBitmap(16, 16, 1, 1, NULL);
|
||||
ok(hbmp != NULL, "failed to create bitmap\n");
|
||||
r = ImageList_Add(himl, hbmp, 0);
|
||||
r = pImageList_Add(himl, hbmp, 0);
|
||||
ok(r == 0, "should be zero\n");
|
||||
hbmp = CreateBitmap(16, 16, 1, 1, NULL);
|
||||
ok(hbmp != NULL, "failed to create bitmap\n");
|
||||
r = ImageList_Add(himl, hbmp, 0);
|
||||
r = pImageList_Add(himl, hbmp, 0);
|
||||
ok(r == 1, "should be one\n");
|
||||
|
||||
r = SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM)himl);
|
||||
@ -4016,15 +4070,15 @@ todo_wine
|
||||
expect(TRUE, r);
|
||||
|
||||
/* state icons */
|
||||
himl = ImageList_Create(16, 16, 0, 2, 2);
|
||||
himl = pImageList_Create(16, 16, 0, 2, 2);
|
||||
ok(himl != NULL, "failed to create imagelist\n");
|
||||
hbm = CreateBitmap(16, 16, 1, 1, NULL);
|
||||
ok(hbm != NULL, "failed to create bitmap\n");
|
||||
r = ImageList_Add(himl, hbm, 0);
|
||||
r = pImageList_Add(himl, hbm, 0);
|
||||
expect(0, r);
|
||||
hbm = CreateBitmap(16, 16, 1, 1, NULL);
|
||||
ok(hbm != NULL, "failed to create bitmap\n");
|
||||
r = ImageList_Add(himl, hbm, 0);
|
||||
r = pImageList_Add(himl, hbm, 0);
|
||||
expect(1, r);
|
||||
|
||||
r = SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM)himl);
|
||||
@ -4164,7 +4218,7 @@ static void test_editbox(void)
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq,
|
||||
"edit box WM_COMMAND (EN_SETFOCUS), no edit created", FALSE);
|
||||
/* same thing but with valid window */
|
||||
hwndedit = CreateWindowA("Edit", "Test edit", WS_VISIBLE | WS_CHILD, 0, 0, 20,
|
||||
hwndedit = CreateWindowA(WC_EDITA, "Test edit", WS_VISIBLE | WS_CHILD, 0, 0, 20,
|
||||
10, hwnd, (HMENU)1, (HINSTANCE)GetWindowLongPtrA(hwnd, GWLP_HINSTANCE), 0);
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
r = SendMessageA(hwnd, WM_COMMAND, MAKEWPARAM(0, EN_SETFOCUS), (LPARAM)hwndedit);
|
||||
@ -4696,9 +4750,9 @@ static void test_getitemspacing(void)
|
||||
expect(cy, HIWORD(ret));
|
||||
|
||||
/* now try with icons */
|
||||
himl40 = ImageList_Create(40, 40, 0, 4, 4);
|
||||
himl40 = pImageList_Create(40, 40, 0, 4, 4);
|
||||
ok(himl40 != NULL, "failed to create imagelist\n");
|
||||
himl80 = ImageList_Create(80, 80, 0, 4, 4);
|
||||
himl80 = pImageList_Create(80, 80, 0, 4, 4);
|
||||
ok(himl80 != NULL, "failed to create imagelist\n");
|
||||
ret = SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)himl40);
|
||||
expect(0, ret);
|
||||
@ -4766,7 +4820,7 @@ static void test_getitemspacing(void)
|
||||
expect(cy + 40, HIWORD(ret));
|
||||
|
||||
SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, 0);
|
||||
ImageList_Destroy(himl80);
|
||||
pImageList_Destroy(himl80);
|
||||
DestroyWindow(hwnd);
|
||||
/* LVS_SMALLICON */
|
||||
hwnd = create_listview_control(LVS_SMALLICON);
|
||||
@ -4784,7 +4838,7 @@ static void test_getitemspacing(void)
|
||||
expect(cy + 40, HIWORD(ret));
|
||||
|
||||
SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, 0);
|
||||
ImageList_Destroy(himl40);
|
||||
pImageList_Destroy(himl40);
|
||||
DestroyWindow(hwnd);
|
||||
/* LVS_REPORT */
|
||||
hwnd = create_listview_control(LVS_REPORT);
|
||||
@ -4967,11 +5021,11 @@ static void test_approximate_viewrect(void)
|
||||
|
||||
/* LVS_ICON */
|
||||
hwnd = create_listview_control(LVS_ICON);
|
||||
himl = ImageList_Create(40, 40, 0, 4, 4);
|
||||
himl = pImageList_Create(40, 40, 0, 4, 4);
|
||||
ok(himl != NULL, "failed to create imagelist\n");
|
||||
hbmp = CreateBitmap(40, 40, 1, 1, NULL);
|
||||
ok(hbmp != NULL, "failed to create bitmap\n");
|
||||
ret = ImageList_Add(himl, hbmp, 0);
|
||||
ret = pImageList_Add(himl, hbmp, 0);
|
||||
expect(0, ret);
|
||||
ret = SendMessageA(hwnd, LVM_SETIMAGELIST, 0, (LPARAM)himl);
|
||||
expect(0, ret);
|
||||
@ -5588,7 +5642,7 @@ static void test_createdragimage(void)
|
||||
|
||||
himl = (HIMAGELIST)SendMessageA(list, LVM_CREATEDRAGIMAGE, 0, (LPARAM)&pt);
|
||||
ok(himl != NULL, "got %p\n", himl);
|
||||
ImageList_Destroy(himl);
|
||||
pImageList_Destroy(himl);
|
||||
|
||||
DestroyWindow(list);
|
||||
}
|
||||
@ -5703,9 +5757,9 @@ static void test_imagelists(void)
|
||||
HIMAGELIST himl1, himl2, himl3;
|
||||
LRESULT ret;
|
||||
|
||||
himl1 = ImageList_Create(40, 40, 0, 4, 4);
|
||||
himl2 = ImageList_Create(40, 40, 0, 4, 4);
|
||||
himl3 = ImageList_Create(40, 40, 0, 4, 4);
|
||||
himl1 = pImageList_Create(40, 40, 0, 4, 4);
|
||||
himl2 = pImageList_Create(40, 40, 0, 4, 4);
|
||||
himl3 = pImageList_Create(40, 40, 0, 4, 4);
|
||||
ok(himl1 != NULL, "Failed to create imagelist\n");
|
||||
ok(himl2 != NULL, "Failed to create imagelist\n");
|
||||
ok(himl3 != NULL, "Failed to create imagelist\n");
|
||||
@ -5938,7 +5992,7 @@ static void test_oneclickactivate(void)
|
||||
INT r;
|
||||
POINT orig_pos;
|
||||
|
||||
hwnd = CreateWindowExA(0, "SysListView32", "foo", WS_VISIBLE|WS_CHILD|LVS_LIST,
|
||||
hwnd = CreateWindowExA(0, WC_LISTVIEWA, "foo", WS_VISIBLE|WS_CHILD|LVS_LIST,
|
||||
10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
|
||||
ok(hwnd != NULL, "failed to create listview window\n");
|
||||
r = SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_ONECLICKACTIVATE);
|
||||
@ -5971,7 +6025,7 @@ static void test_oneclickactivate(void)
|
||||
|
||||
track.cbSize = sizeof(track);
|
||||
track.dwFlags = TME_QUERY;
|
||||
_TrackMouseEvent(&track);
|
||||
p_TrackMouseEvent(&track);
|
||||
ok(track.hwndTrack == hwnd, "hwndTrack != hwnd\n");
|
||||
ok(track.dwFlags == TME_LEAVE, "dwFlags = %x\n", track.dwFlags);
|
||||
|
||||
@ -6146,16 +6200,17 @@ static void test_state_image(void)
|
||||
insert_column(hwnd, 0);
|
||||
insert_column(hwnd, 1);
|
||||
|
||||
item.mask = LVIF_TEXT;
|
||||
item.mask = LVIF_TEXT | LVIF_PARAM;
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 0;
|
||||
item.pszText = text;
|
||||
item.lParam = 123456;
|
||||
r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item);
|
||||
ok(r == 0, "Failed to insert an item.\n");
|
||||
|
||||
item.mask = LVIF_STATE;
|
||||
item.state = INDEXTOSTATEIMAGEMASK(1) | LVIS_SELECTED;
|
||||
item.stateMask = LVIS_STATEIMAGEMASK | LVIS_SELECTED;
|
||||
item.state = INDEXTOSTATEIMAGEMASK(1) | LVIS_SELECTED | LVIS_FOCUSED;
|
||||
item.stateMask = LVIS_STATEIMAGEMASK | LVIS_SELECTED | LVIS_FOCUSED;
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 0;
|
||||
r = SendMessageA(hwnd, LVM_SETITEMA, 0, (LPARAM)&item);
|
||||
@ -6168,27 +6223,49 @@ static void test_state_image(void)
|
||||
r = SendMessageA(hwnd, LVM_SETITEMA, 0, (LPARAM)&item);
|
||||
ok(r, "Failed to set subitem text.\n");
|
||||
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = LVIS_STATEIMAGEMASK | LVIS_SELECTED;
|
||||
item.mask = LVIF_STATE | LVIF_PARAM;
|
||||
item.stateMask = ~0u;
|
||||
item.state = 0;
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 0;
|
||||
item.lParam = 0;
|
||||
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
|
||||
ok(r, "Failed to get item state.\n");
|
||||
ok(item.state == (INDEXTOSTATEIMAGEMASK(1) | LVIS_SELECTED), "Unexpected item state %#x.\n", item.state);
|
||||
ok(item.state == (INDEXTOSTATEIMAGEMASK(1) | LVIS_SELECTED | LVIS_FOCUSED),
|
||||
"Unexpected item state %#x.\n", item.state);
|
||||
ok(item.lParam == 123456, "Unexpected lParam %ld.\n", item.lParam);
|
||||
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = LVIS_STATEIMAGEMASK | LVIS_SELECTED;
|
||||
item.mask = 0;
|
||||
item.stateMask = ~0u;
|
||||
item.state = INDEXTOSTATEIMAGEMASK(2);
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 1;
|
||||
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
|
||||
ok(r, "Failed to get subitem state.\n");
|
||||
todo_wine
|
||||
ok(item.state == INDEXTOSTATEIMAGEMASK(2), "Unexpected state %#x.\n", item.state);
|
||||
|
||||
item.mask = LVIF_STATE | LVIF_PARAM;
|
||||
item.stateMask = ~0u;
|
||||
item.state = INDEXTOSTATEIMAGEMASK(2);
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 1;
|
||||
item.lParam = 0;
|
||||
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
|
||||
ok(r, "Failed to get subitem state.\n");
|
||||
ok(item.state == 0, "Unexpected state %#x.\n", item.state);
|
||||
ok(item.lParam == 123456, "Unexpected lParam %ld.\n", item.lParam);
|
||||
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = LVIS_FOCUSED;
|
||||
item.state = 0;
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 1;
|
||||
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
|
||||
ok(r, "Failed to get subitem state.\n");
|
||||
ok(item.state == 0, "Unexpected state %#x.\n", item.state);
|
||||
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = LVIS_STATEIMAGEMASK | LVIS_SELECTED;
|
||||
item.stateMask = ~0u;
|
||||
item.state = INDEXTOSTATEIMAGEMASK(2);
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 2;
|
||||
@ -6210,25 +6287,56 @@ static void test_state_image(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void test_LVSCW_AUTOSIZE(void)
|
||||
{
|
||||
int width, width2;
|
||||
HWND hwnd;
|
||||
BOOL ret;
|
||||
|
||||
hwnd = create_listview_control(LVS_REPORT);
|
||||
ok(hwnd != NULL, "failed to create a listview window\n");
|
||||
|
||||
insert_column(hwnd, 0);
|
||||
insert_column(hwnd, 1);
|
||||
insert_item(hwnd, 0);
|
||||
|
||||
ret = SendMessageA(hwnd, LVM_SETCOLUMNWIDTH, 0, LVSCW_AUTOSIZE);
|
||||
ok(ret, "Failed to set column width.\n");
|
||||
|
||||
width = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0);
|
||||
ok(width > 0, "Unexpected column width %d.\n", width);
|
||||
|
||||
/* Turn on checkboxes. */
|
||||
ret = SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES);
|
||||
ok(ret == 0, "Unexpected previous extended style.\n");
|
||||
|
||||
ret = SendMessageA(hwnd, LVM_SETCOLUMNWIDTH, 0, LVSCW_AUTOSIZE);
|
||||
ok(ret, "Failed to set column width.\n");
|
||||
|
||||
width2 = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0);
|
||||
ok(width2 > 0, "Unexpected column width %d.\n", width2);
|
||||
ok(width2 > width, "Expected increased column width.\n");
|
||||
|
||||
/* Turn off checkboxes. */
|
||||
ret = SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_CHECKBOXES, 0);
|
||||
ok(ret == LVS_EX_CHECKBOXES, "Unexpected previous extended style.\n");
|
||||
|
||||
ret = SendMessageA(hwnd, LVM_SETCOLUMNWIDTH, 0, LVSCW_AUTOSIZE);
|
||||
ok(ret, "Failed to set column width.\n");
|
||||
|
||||
width = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0);
|
||||
ok(width > 0, "Unexpected column width %d.\n", width2);
|
||||
ok(width2 > width, "Expected reduced column width.\n");
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
START_TEST(listview)
|
||||
{
|
||||
HMODULE hComctl32;
|
||||
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
|
||||
ULONG_PTR ctx_cookie;
|
||||
HANDLE hCtx;
|
||||
|
||||
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_functions();
|
||||
|
||||
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
@ -6242,7 +6350,7 @@ START_TEST(listview)
|
||||
test_images();
|
||||
test_checkboxes();
|
||||
test_items();
|
||||
test_create();
|
||||
test_create(FALSE);
|
||||
test_redraw();
|
||||
test_customdraw();
|
||||
test_icon_spacing();
|
||||
@ -6283,6 +6391,7 @@ START_TEST(listview)
|
||||
test_oneclickactivate();
|
||||
test_callback_mask();
|
||||
test_state_image();
|
||||
test_LVSCW_AUTOSIZE();
|
||||
|
||||
if (!load_v6_module(&ctx_cookie, &hCtx))
|
||||
{
|
||||
@ -6290,6 +6399,8 @@ START_TEST(listview)
|
||||
return;
|
||||
}
|
||||
|
||||
init_functions();
|
||||
|
||||
/* comctl32 version 6 tests start here */
|
||||
test_get_set_view();
|
||||
test_canceleditlabel();
|
||||
@ -6304,6 +6415,7 @@ START_TEST(listview)
|
||||
test_images();
|
||||
test_checkboxes();
|
||||
test_items();
|
||||
test_create(TRUE);
|
||||
test_color();
|
||||
test_columns();
|
||||
test_sorting();
|
||||
@ -6321,6 +6433,7 @@ START_TEST(listview)
|
||||
test_LVM_REDRAWITEMS();
|
||||
test_oneclickactivate();
|
||||
test_state_image();
|
||||
test_LVSCW_AUTOSIZE();
|
||||
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
|
||||
|
@ -18,7 +18,12 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
|
||||
static PVOID (WINAPI * pAlloc)(LONG);
|
||||
static PVOID (WINAPI * pReAlloc)(PVOID, LONG);
|
||||
@ -344,7 +349,12 @@ static void check_class( const char *name, int must_exist, UINT style, UINT igno
|
||||
|
||||
if (GetClassInfoA( 0, name, &wc ))
|
||||
{
|
||||
todo_wine
|
||||
todo_wine_if(strcmp(name, "Button") &&
|
||||
strcmp(name, "ComboBox") &&
|
||||
strcmp(name, "Edit") &&
|
||||
strcmp(name, "Static") &&
|
||||
strcmp(name, "ListBox") &&
|
||||
strcmp(name, "ComboLBox"))
|
||||
ok( !(~wc.style & style & ~ignore), "System class %s is missing bits %x (%08x/%08x)\n",
|
||||
name, ~wc.style & style, wc.style, style );
|
||||
ok( !(wc.style & ~style), "System class %s has extra bits %x (%08x/%08x)\n",
|
||||
|
@ -19,7 +19,18 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
|
||||
#include "commctrl.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
#include <windows.h>
|
||||
#include "msg.h"
|
||||
|
||||
#define expect(expected, got) ok(expected == got, "Expected %d, got %d\n", expected, got);
|
||||
#define expect_hex(expected, got) ok(expected == got, "Expected %x, got %x\n", expected, got);
|
||||
@ -31,6 +42,8 @@
|
||||
|
||||
#define SEL_NOTIFY_TEST_ID 100
|
||||
|
||||
static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
|
||||
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
|
||||
|
||||
static HWND parent_wnd;
|
||||
@ -587,8 +600,6 @@ static HWND create_parent_window(void)
|
||||
{
|
||||
HWND hwnd;
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
/* flush message sequences, so we can check the new sequence by the end of function */
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
@ -2028,22 +2039,23 @@ static void test_sel_notify(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
X(InitCommonControlsEx);
|
||||
#undef X
|
||||
}
|
||||
|
||||
START_TEST(monthcal)
|
||||
{
|
||||
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
INITCOMMONCONTROLSEX iccex;
|
||||
HMODULE hComctl32;
|
||||
|
||||
ULONG_PTR ctx_cookie;
|
||||
HANDLE hCtx;
|
||||
|
||||
hComctl32 = GetModuleHandleA("comctl32.dll");
|
||||
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
|
||||
if (!pInitCommonControlsEx)
|
||||
{
|
||||
win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
|
||||
return;
|
||||
}
|
||||
init_functions();
|
||||
|
||||
iccex.dwSize = sizeof(iccex);
|
||||
iccex.dwICC = ICC_DATE_CLASSES;
|
||||
pInitCommonControlsEx(&iccex);
|
||||
|
@ -17,8 +17,19 @@
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "precomp.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winnls.h"
|
||||
#include "winreg.h"
|
||||
#include "commctrl.h"
|
||||
#include "shlwapi.h"
|
||||
|
||||
#include "wine/heap.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
/* Keys for testing MRU functions */
|
||||
#define REG_TEST_BASEKEYA "Software\\Wine"
|
||||
@ -66,18 +77,22 @@ static INT (WINAPI *pFindMRUData)(HANDLE, LPCVOID, DWORD, LPINT);
|
||||
static INT (WINAPI *pAddMRUData)(HANDLE, LPCVOID, DWORD);
|
||||
static HANDLE (WINAPI *pCreateMRUListW)(MRUINFOW*);
|
||||
|
||||
static void InitPointers(void)
|
||||
static void init_functions(void)
|
||||
{
|
||||
pCreateMRUListA = (void*)GetProcAddress(hComctl32,(LPCSTR)151);
|
||||
pFreeMRUList = (void*)GetProcAddress(hComctl32,(LPCSTR)152);
|
||||
pAddMRUStringA = (void*)GetProcAddress(hComctl32,(LPCSTR)153);
|
||||
pEnumMRUListA = (void*)GetProcAddress(hComctl32,(LPCSTR)154);
|
||||
pCreateMRUListLazyA = (void*)GetProcAddress(hComctl32,(LPCSTR)157);
|
||||
pAddMRUData = (void*)GetProcAddress(hComctl32,(LPCSTR)167);
|
||||
pFindMRUData = (void*)GetProcAddress(hComctl32,(LPCSTR)169);
|
||||
pCreateMRUListW = (void*)GetProcAddress(hComctl32,(LPCSTR)400);
|
||||
pEnumMRUListW = (void*)GetProcAddress(hComctl32,(LPCSTR)403);
|
||||
pCreateMRUListLazyW = (void*)GetProcAddress(hComctl32,(LPCSTR)404);
|
||||
hComctl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X2(f, ord) p##f = (void*)GetProcAddress(hComctl32, (const char *)ord);
|
||||
X2(CreateMRUListA, 151);
|
||||
X2(FreeMRUList, 152);
|
||||
X2(AddMRUStringA, 153);
|
||||
X2(EnumMRUListA, 154);
|
||||
X2(CreateMRUListLazyA, 157);
|
||||
X2(AddMRUData, 167);
|
||||
X2(FindMRUData, 169);
|
||||
X2(CreateMRUListW, 400);
|
||||
X2(EnumMRUListW, 403);
|
||||
X2(CreateMRUListLazyW, 404);
|
||||
#undef X2
|
||||
}
|
||||
|
||||
/* Based on RegDeleteTreeW from dlls/advapi32/registry.c */
|
||||
@ -106,7 +121,7 @@ static LSTATUS mru_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
|
||||
if (dwMaxLen > sizeof(szNameBuf)/sizeof(CHAR))
|
||||
{
|
||||
/* Name too big: alloc a buffer for it */
|
||||
if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(CHAR))))
|
||||
if (!(lpszName = heap_alloc(dwMaxLen * sizeof(CHAR))))
|
||||
{
|
||||
ret = ERROR_NOT_ENOUGH_MEMORY;
|
||||
goto cleanup;
|
||||
@ -141,7 +156,7 @@ static LSTATUS mru_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
|
||||
cleanup:
|
||||
/* Free buffer if allocated */
|
||||
if (lpszName != szNameBuf)
|
||||
HeapFree( GetProcessHeap(), 0, lpszName);
|
||||
heap_free(lpszName);
|
||||
if(lpszSubKey)
|
||||
RegCloseKey(hSubKey);
|
||||
return ret;
|
||||
@ -695,13 +710,11 @@ static void test_CreateMRUListLazyW(void)
|
||||
|
||||
START_TEST(mru)
|
||||
{
|
||||
hComctl32 = GetModuleHandleA("comctl32.dll");
|
||||
|
||||
delete_reg_entries();
|
||||
if (!create_reg_entries())
|
||||
return;
|
||||
|
||||
InitPointers();
|
||||
init_functions();
|
||||
|
||||
test_MRUListA();
|
||||
test_CreateMRUListLazyA();
|
||||
|
@ -20,6 +20,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
#include <windows.h>
|
||||
#include "wine/heap.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
/* undocumented SWP flags - from SDK 3.1 */
|
||||
#define SWP_NOCLIENTSIZE 0x0800
|
||||
#define SWP_NOCLIENTMOVE 0x1000
|
||||
@ -66,16 +71,13 @@ static void add_message(struct msg_sequence **seq, int sequence_index,
|
||||
if (!msg_seq->sequence)
|
||||
{
|
||||
msg_seq->size = 10;
|
||||
msg_seq->sequence = HeapAlloc(GetProcessHeap(), 0,
|
||||
msg_seq->size * sizeof (struct message));
|
||||
msg_seq->sequence = heap_alloc(msg_seq->size * sizeof (*msg_seq->sequence));
|
||||
}
|
||||
|
||||
if (msg_seq->count == msg_seq->size)
|
||||
{
|
||||
msg_seq->size *= 2;
|
||||
msg_seq->sequence = HeapReAlloc(GetProcessHeap(), 0,
|
||||
msg_seq->sequence,
|
||||
msg_seq->size * sizeof (struct message));
|
||||
msg_seq->sequence = heap_realloc(msg_seq->sequence, msg_seq->size * sizeof (*msg_seq->sequence));
|
||||
}
|
||||
|
||||
assert(msg_seq->sequence);
|
||||
@ -87,7 +89,7 @@ static void add_message(struct msg_sequence **seq, int sequence_index,
|
||||
static inline void flush_sequence(struct msg_sequence **seg, int sequence_index)
|
||||
{
|
||||
struct msg_sequence *msg_seq = seg[sequence_index];
|
||||
HeapFree(GetProcessHeap(), 0, msg_seq->sequence);
|
||||
heap_free(msg_seq->sequence);
|
||||
msg_seq->sequence = NULL;
|
||||
msg_seq->count = msg_seq->size = 0;
|
||||
}
|
||||
@ -391,5 +393,5 @@ static inline void init_msg_sequences(struct msg_sequence **seq, int n)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
seq[i] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct msg_sequence));
|
||||
seq[i] = heap_alloc_zero(sizeof(*seq[i]));
|
||||
}
|
||||
|
@ -18,7 +18,11 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "msg.h"
|
||||
|
||||
#define NUM_MSG_SEQUENCES 1
|
||||
#define PAGER_SEQ_INDEX 0
|
||||
@ -335,7 +339,6 @@ START_TEST(pager)
|
||||
|
||||
pSetWindowSubclass = (void*)GetProcAddress(mod, (LPSTR)410);
|
||||
|
||||
InitCommonControls();
|
||||
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
parent_wnd = create_parent_window();
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#ifndef _COMCTL32_WINETEST_PRECOMP_H_
|
||||
#define _COMCTL32_WINETEST_PRECOMP_H_
|
||||
|
||||
|
@ -17,10 +17,21 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
static HWND hProgressParentWnd, hProgressWnd;
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "commctrl.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#include "v6util.h"
|
||||
|
||||
static HWND hProgressParentWnd;
|
||||
static const char progressTestClass[] = "ProgressBarTestClass";
|
||||
static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
|
||||
static HWND create_progress(DWORD style)
|
||||
{
|
||||
@ -85,24 +96,10 @@ static void update_window(HWND hWnd)
|
||||
|
||||
static void init(void)
|
||||
{
|
||||
HMODULE hComctl32;
|
||||
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
WNDCLASSA wc;
|
||||
RECT rect;
|
||||
BOOL ret;
|
||||
|
||||
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;
|
||||
wc.cbWndExtra = 0;
|
||||
@ -123,16 +120,6 @@ static void init(void)
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, GetModuleHandleA(NULL), 0);
|
||||
ok(hProgressParentWnd != NULL, "failed to create parent wnd\n");
|
||||
|
||||
GetClientRect(hProgressParentWnd, &rect);
|
||||
hProgressWnd = CreateWindowExA(0, PROGRESS_CLASSA, "", WS_CHILD | WS_VISIBLE,
|
||||
0, 0, rect.right, rect.bottom, hProgressParentWnd, NULL, GetModuleHandleA(NULL), 0);
|
||||
ok(hProgressWnd != NULL, "failed to create parent wnd\n");
|
||||
progress_wndproc = (WNDPROC)SetWindowLongPtrA(hProgressWnd, GWLP_WNDPROC, (LPARAM)progress_subclass_proc);
|
||||
|
||||
ShowWindow(hProgressParentWnd, SW_SHOWNORMAL);
|
||||
ok(GetUpdateRect(hProgressParentWnd, NULL, FALSE), "GetUpdateRect: There should be a region that needs to be updated\n");
|
||||
flush_events();
|
||||
update_window(hProgressParentWnd);
|
||||
}
|
||||
|
||||
static void cleanup(void)
|
||||
@ -155,9 +142,21 @@ static void cleanup(void)
|
||||
*/
|
||||
static void test_redraw(void)
|
||||
{
|
||||
RECT client_rect;
|
||||
RECT client_rect, rect;
|
||||
HWND hProgressWnd;
|
||||
LRESULT ret;
|
||||
|
||||
GetClientRect(hProgressParentWnd, &rect);
|
||||
hProgressWnd = CreateWindowExA(0, PROGRESS_CLASSA, "", WS_CHILD | WS_VISIBLE,
|
||||
0, 0, rect.right, rect.bottom, hProgressParentWnd, NULL, GetModuleHandleA(NULL), 0);
|
||||
ok(hProgressWnd != NULL, "Failed to create progress bar.\n");
|
||||
progress_wndproc = (WNDPROC)SetWindowLongPtrA(hProgressWnd, GWLP_WNDPROC, (LPARAM)progress_subclass_proc);
|
||||
|
||||
ShowWindow(hProgressParentWnd, SW_SHOWNORMAL);
|
||||
ok(GetUpdateRect(hProgressParentWnd, NULL, FALSE), "GetUpdateRect: There should be a region that needs to be updated\n");
|
||||
flush_events();
|
||||
update_window(hProgressParentWnd);
|
||||
|
||||
SendMessageA(hProgressWnd, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
|
||||
SendMessageA(hProgressWnd, PBM_SETPOS, 10, 0);
|
||||
SendMessageA(hProgressWnd, PBM_SETSTEP, 20, 0);
|
||||
@ -166,15 +165,15 @@ static void test_redraw(void)
|
||||
/* PBM_SETPOS */
|
||||
ok(SendMessageA(hProgressWnd, PBM_SETPOS, 50, 0) == 10, "PBM_SETPOS must return the previous position\n");
|
||||
ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_SETPOS: The progress bar should be redrawn immediately\n");
|
||||
|
||||
|
||||
/* PBM_DELTAPOS */
|
||||
ok(SendMessageA(hProgressWnd, PBM_DELTAPOS, 15, 0) == 50, "PBM_DELTAPOS must return the previous position\n");
|
||||
ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_DELTAPOS: The progress bar should be redrawn immediately\n");
|
||||
|
||||
|
||||
/* PBM_SETPOS */
|
||||
ok(SendMessageA(hProgressWnd, PBM_SETPOS, 80, 0) == 65, "PBM_SETPOS must return the previous position\n");
|
||||
ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_SETPOS: The progress bar should be redrawn immediately\n");
|
||||
|
||||
|
||||
/* PBM_STEPIT */
|
||||
ok(SendMessageA(hProgressWnd, PBM_STEPIT, 0, 0) == 80, "PBM_STEPIT must return the previous position\n");
|
||||
ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_STEPIT: The progress bar should be redrawn immediately\n");
|
||||
@ -183,7 +182,7 @@ static void test_redraw(void)
|
||||
win_skip("PBM_GETPOS needs comctl32 > 4.70\n");
|
||||
else
|
||||
ok(ret == 100, "PBM_GETPOS returned a wrong position : %d\n", (UINT)ret);
|
||||
|
||||
|
||||
/* PBM_SETRANGE and PBM_SETRANGE32:
|
||||
Usually the progress bar doesn't repaint itself immediately. If the
|
||||
position is not in the new range, it does.
|
||||
@ -211,6 +210,8 @@ static void test_redraw(void)
|
||||
wine_dbgstr_rect(&last_paint_rect), wine_dbgstr_rect(&client_rect));
|
||||
update_window(hProgressWnd);
|
||||
ok(erased, "Progress bar should have erased the background\n");
|
||||
|
||||
DestroyWindow(hProgressWnd);
|
||||
}
|
||||
|
||||
static void test_setcolors(void)
|
||||
@ -241,12 +242,90 @@ static void test_setcolors(void)
|
||||
DestroyWindow(progress);
|
||||
}
|
||||
|
||||
static void test_PBM_STEPIT(void)
|
||||
{
|
||||
struct stepit_test
|
||||
{
|
||||
int min;
|
||||
int max;
|
||||
int step;
|
||||
} stepit_tests[] =
|
||||
{
|
||||
{ 3, 15, 5 },
|
||||
{ 3, 15, -5 },
|
||||
{ 3, 15, 50 },
|
||||
};
|
||||
HWND progress;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < sizeof(stepit_tests)/sizeof(stepit_tests[0]); i++)
|
||||
{
|
||||
struct stepit_test *test = &stepit_tests[i];
|
||||
LRESULT ret;
|
||||
|
||||
progress = create_progress(0);
|
||||
|
||||
ret = SendMessageA(progress, PBM_SETRANGE32, test->min, test->max);
|
||||
ok(ret != 0, "Unexpected return value.\n");
|
||||
|
||||
SendMessageA(progress, PBM_SETPOS, test->min, 0);
|
||||
SendMessageA(progress, PBM_SETSTEP, test->step, 0);
|
||||
|
||||
for (j = 0; j < test->max; j++)
|
||||
{
|
||||
int pos = SendMessageA(progress, PBM_GETPOS, 0, 0);
|
||||
int current;
|
||||
|
||||
pos += test->step;
|
||||
if (pos > test->max)
|
||||
pos = (pos - test->min) % (test->max - test->min) + test->min;
|
||||
if (pos < test->min)
|
||||
pos = (pos - test->min) % (test->max - test->min) + test->max;
|
||||
|
||||
SendMessageA(progress, PBM_STEPIT, 0, 0);
|
||||
|
||||
current = SendMessageA(progress, PBM_GETPOS, 0, 0);
|
||||
ok(current == pos, "Unexpected position %d, expected %d.\n", current, pos);
|
||||
}
|
||||
|
||||
DestroyWindow(progress);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
X(InitCommonControlsEx);
|
||||
#undef X
|
||||
}
|
||||
|
||||
START_TEST(progress)
|
||||
{
|
||||
INITCOMMONCONTROLSEX iccex;
|
||||
ULONG_PTR ctx_cookie;
|
||||
HANDLE hCtx;
|
||||
|
||||
init_functions();
|
||||
|
||||
iccex.dwSize = sizeof(iccex);
|
||||
iccex.dwICC = ICC_PROGRESS_CLASS;
|
||||
pInitCommonControlsEx(&iccex);
|
||||
|
||||
init();
|
||||
|
||||
|
||||
test_redraw();
|
||||
test_setcolors();
|
||||
test_PBM_STEPIT();
|
||||
|
||||
if (!load_v6_module(&ctx_cookie, &hCtx))
|
||||
return;
|
||||
|
||||
test_setcolors();
|
||||
test_PBM_STEPIT();
|
||||
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
|
||||
cleanup();
|
||||
}
|
||||
|
@ -18,9 +18,17 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include "msg.h"
|
||||
|
||||
#include "resources.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#ifdef __REACTOS__
|
||||
#include <reactos/undocuser.h>
|
||||
#endif
|
||||
|
||||
static HWND parenthwnd;
|
||||
static HWND sheethwnd;
|
||||
@ -30,6 +38,10 @@ static LONG active_page = -1;
|
||||
|
||||
#define IDC_APPLY_BUTTON 12321
|
||||
|
||||
static HPROPSHEETPAGE (WINAPI *pCreatePropertySheetPageA)(const PROPSHEETPAGEA *desc);
|
||||
static HPROPSHEETPAGE (WINAPI *pCreatePropertySheetPageW)(const PROPSHEETPAGEW *desc);
|
||||
static BOOL (WINAPI *pDestroyPropertySheetPage)(HPROPSHEETPAGE proppage);
|
||||
static INT_PTR (WINAPI *pPropertySheetA)(const PROPSHEETHEADERA *header);
|
||||
|
||||
static void detect_locale(void)
|
||||
{
|
||||
@ -137,7 +149,7 @@ static void test_title(void)
|
||||
psp.pfnDlgProc = page_dlg_proc;
|
||||
psp.lParam = 0;
|
||||
|
||||
hpsp[0] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[0] = pCreatePropertySheetPageA(&psp);
|
||||
|
||||
memset(&psh, 0, sizeof(psh));
|
||||
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
|
||||
@ -148,7 +160,7 @@ static void test_title(void)
|
||||
U3(psh).phpage = hpsp;
|
||||
psh.pfnCallback = sheet_callback;
|
||||
|
||||
hdlg = (HWND)PropertySheetA(&psh);
|
||||
hdlg = (HWND)pPropertySheetA(&psh);
|
||||
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle value %p\n", hdlg);
|
||||
|
||||
style = GetWindowLongA(hdlg, GWL_STYLE);
|
||||
@ -176,7 +188,7 @@ static void test_nopage(void)
|
||||
psp.pfnDlgProc = page_dlg_proc;
|
||||
psp.lParam = 0;
|
||||
|
||||
hpsp[0] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[0] = pCreatePropertySheetPageA(&psp);
|
||||
|
||||
memset(&psh, 0, sizeof(psh));
|
||||
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
|
||||
@ -187,7 +199,7 @@ static void test_nopage(void)
|
||||
U3(psh).phpage = hpsp;
|
||||
psh.pfnCallback = sheet_callback;
|
||||
|
||||
hdlg = (HWND)PropertySheetA(&psh);
|
||||
hdlg = (HWND)pPropertySheetA(&psh);
|
||||
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle value %p\n", hdlg);
|
||||
|
||||
ShowWindow(hdlg,SW_NORMAL);
|
||||
@ -256,7 +268,7 @@ static void test_disableowner(void)
|
||||
psp.pfnDlgProc = NULL;
|
||||
psp.lParam = 0;
|
||||
|
||||
hpsp[0] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[0] = pCreatePropertySheetPageA(&psp);
|
||||
|
||||
memset(&psh, 0, sizeof(psh));
|
||||
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
|
||||
@ -267,7 +279,7 @@ static void test_disableowner(void)
|
||||
U3(psh).phpage = hpsp;
|
||||
psh.pfnCallback = disableowner_callback;
|
||||
|
||||
p = PropertySheetA(&psh);
|
||||
p = pPropertySheetA(&psh);
|
||||
todo_wine
|
||||
ok(p == 0, "Expected 0, got %ld\n", p);
|
||||
ok(IsWindowEnabled(parenthwnd) != 0, "parent window should be enabled\n");
|
||||
@ -353,25 +365,25 @@ static void test_wiznavigation(void)
|
||||
psp[0].hInstance = GetModuleHandleA(NULL);
|
||||
U(psp[0]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_INTRO);
|
||||
psp[0].pfnDlgProc = nav_page_proc;
|
||||
hpsp[0] = CreatePropertySheetPageA(&psp[0]);
|
||||
hpsp[0] = pCreatePropertySheetPageA(&psp[0]);
|
||||
|
||||
psp[1].dwSize = sizeof(PROPSHEETPAGEA);
|
||||
psp[1].hInstance = GetModuleHandleA(NULL);
|
||||
U(psp[1]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_EDIT);
|
||||
psp[1].pfnDlgProc = nav_page_proc;
|
||||
hpsp[1] = CreatePropertySheetPageA(&psp[1]);
|
||||
hpsp[1] = pCreatePropertySheetPageA(&psp[1]);
|
||||
|
||||
psp[2].dwSize = sizeof(PROPSHEETPAGEA);
|
||||
psp[2].hInstance = GetModuleHandleA(NULL);
|
||||
U(psp[2]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_RADIO);
|
||||
psp[2].pfnDlgProc = nav_page_proc;
|
||||
hpsp[2] = CreatePropertySheetPageA(&psp[2]);
|
||||
hpsp[2] = pCreatePropertySheetPageA(&psp[2]);
|
||||
|
||||
psp[3].dwSize = sizeof(PROPSHEETPAGEA);
|
||||
psp[3].hInstance = GetModuleHandleA(NULL);
|
||||
U(psp[3]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_EXIT);
|
||||
psp[3].pfnDlgProc = nav_page_proc;
|
||||
hpsp[3] = CreatePropertySheetPageA(&psp[3]);
|
||||
hpsp[3] = pCreatePropertySheetPageA(&psp[3]);
|
||||
|
||||
/* set up the property sheet dialog */
|
||||
memset(&psh, 0, sizeof(psh));
|
||||
@ -381,7 +393,7 @@ static void test_wiznavigation(void)
|
||||
psh.nPages = 4;
|
||||
psh.hwndParent = GetDesktopWindow();
|
||||
U3(psh).phpage = hpsp;
|
||||
hdlg = (HWND)PropertySheetA(&psh);
|
||||
hdlg = (HWND)pPropertySheetA(&psh);
|
||||
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
|
||||
|
||||
ok(active_page == 0, "Active page should be 0. Is: %d\n", active_page);
|
||||
@ -476,7 +488,7 @@ static void test_buttons(void)
|
||||
psp.pfnDlgProc = page_dlg_proc;
|
||||
psp.lParam = 0;
|
||||
|
||||
hpsp[0] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[0] = pCreatePropertySheetPageA(&psp);
|
||||
|
||||
memset(&psh, 0, sizeof(psh));
|
||||
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
|
||||
@ -487,7 +499,7 @@ static void test_buttons(void)
|
||||
U3(psh).phpage = hpsp;
|
||||
psh.pfnCallback = sheet_callback;
|
||||
|
||||
hdlg = (HWND)PropertySheetA(&psh);
|
||||
hdlg = (HWND)pPropertySheetA(&psh);
|
||||
ok(hdlg != INVALID_HANDLE_VALUE, "got null handle\n");
|
||||
|
||||
/* OK button */
|
||||
@ -583,7 +595,7 @@ static void test_custom_default_button(void)
|
||||
add_button_has_been_pressed = FALSE;
|
||||
|
||||
/* Create the modeless property sheet. */
|
||||
hdlg = (HWND)PropertySheetA(&psh);
|
||||
hdlg = (HWND)pPropertySheetA(&psh);
|
||||
ok(hdlg != INVALID_HANDLE_VALUE, "Cannot create the property sheet\n");
|
||||
|
||||
/* Set the Add button as the default button. */
|
||||
@ -794,7 +806,7 @@ static void test_messages(void)
|
||||
psp.pfnDlgProc = page_dlg_proc_messages;
|
||||
psp.lParam = 0;
|
||||
|
||||
hpsp[0] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[0] = pCreatePropertySheetPageA(&psp);
|
||||
|
||||
memset(&psh, 0, sizeof(psh));
|
||||
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
|
||||
@ -806,7 +818,7 @@ static void test_messages(void)
|
||||
U3(psh).phpage = hpsp;
|
||||
psh.pfnCallback = sheet_callback_messages;
|
||||
|
||||
hdlg = (HWND)PropertySheetA(&psh);
|
||||
hdlg = (HWND)pPropertySheetA(&psh);
|
||||
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
|
||||
|
||||
ShowWindow(hdlg,SW_NORMAL);
|
||||
@ -835,15 +847,15 @@ static void test_PSM_ADDPAGE(void)
|
||||
psp.lParam = 0;
|
||||
|
||||
/* multiple pages with the same data */
|
||||
hpsp[0] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[1] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[2] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[0] = pCreatePropertySheetPageA(&psp);
|
||||
hpsp[1] = pCreatePropertySheetPageA(&psp);
|
||||
hpsp[2] = pCreatePropertySheetPageA(&psp);
|
||||
|
||||
U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_ERROR);
|
||||
hpsp[3] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[3] = pCreatePropertySheetPageA(&psp);
|
||||
|
||||
psp.dwFlags = PSP_PREMATURE;
|
||||
hpsp[4] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[4] = pCreatePropertySheetPageA(&psp);
|
||||
|
||||
memset(&psh, 0, sizeof(psh));
|
||||
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
|
||||
@ -853,7 +865,7 @@ static void test_PSM_ADDPAGE(void)
|
||||
psh.hwndParent = GetDesktopWindow();
|
||||
U3(psh).phpage = hpsp;
|
||||
|
||||
hdlg = (HWND)PropertySheetA(&psh);
|
||||
hdlg = (HWND)pPropertySheetA(&psh);
|
||||
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
|
||||
|
||||
/* add pages one by one */
|
||||
@ -902,7 +914,7 @@ if (0)
|
||||
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
|
||||
ok(r == 3, "got %d\n", r);
|
||||
|
||||
DestroyPropertySheetPage(hpsp[4]);
|
||||
pDestroyPropertySheetPage(hpsp[4]);
|
||||
DestroyWindow(hdlg);
|
||||
}
|
||||
|
||||
@ -925,15 +937,15 @@ static void test_PSM_INSERTPAGE(void)
|
||||
psp.lParam = 0;
|
||||
|
||||
/* multiple pages with the same data */
|
||||
hpsp[0] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[1] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[2] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[0] = pCreatePropertySheetPageA(&psp);
|
||||
hpsp[1] = pCreatePropertySheetPageA(&psp);
|
||||
hpsp[2] = pCreatePropertySheetPageA(&psp);
|
||||
|
||||
U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_ERROR);
|
||||
hpsp[3] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[3] = pCreatePropertySheetPageA(&psp);
|
||||
|
||||
psp.dwFlags = PSP_PREMATURE;
|
||||
hpsp[4] = CreatePropertySheetPageA(&psp);
|
||||
hpsp[4] = pCreatePropertySheetPageA(&psp);
|
||||
|
||||
memset(&psh, 0, sizeof(psh));
|
||||
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
|
||||
@ -943,7 +955,7 @@ static void test_PSM_INSERTPAGE(void)
|
||||
psh.hwndParent = GetDesktopWindow();
|
||||
U3(psh).phpage = hpsp;
|
||||
|
||||
hdlg = (HWND)PropertySheetA(&psh);
|
||||
hdlg = (HWND)pPropertySheetA(&psh);
|
||||
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
|
||||
|
||||
/* add pages one by one */
|
||||
@ -996,7 +1008,7 @@ if (0)
|
||||
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
|
||||
ok(r == 3, "got %d\n", r);
|
||||
|
||||
DestroyPropertySheetPage(hpsp[4]);
|
||||
pDestroyPropertySheetPage(hpsp[4]);
|
||||
DestroyWindow(hdlg);
|
||||
}
|
||||
|
||||
@ -1086,7 +1098,7 @@ static void test_CreatePropertySheetPage(void)
|
||||
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);
|
||||
hpsp = pCreatePropertySheetPageA(&page.u.pageA);
|
||||
|
||||
if (page.u.pageA.dwSize < PROPSHEETPAGEA_V1_SIZE)
|
||||
ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageA.dwSize);
|
||||
@ -1099,7 +1111,7 @@ static void test_CreatePropertySheetPage(void)
|
||||
if (hpsp)
|
||||
{
|
||||
page.release_called = 0;
|
||||
ret = DestroyPropertySheetPage(hpsp);
|
||||
ret = pDestroyPropertySheetPage(hpsp);
|
||||
ok(ret, "Failed to destroy a page\n");
|
||||
ok(page.release_called == 1, "Expected RELEASE callback message\n");
|
||||
}
|
||||
@ -1115,7 +1127,7 @@ static void test_CreatePropertySheetPage(void)
|
||||
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);
|
||||
hpsp = pCreatePropertySheetPageW(&page.u.pageW);
|
||||
|
||||
if (page.u.pageW.dwSize < PROPSHEETPAGEW_V1_SIZE)
|
||||
ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageW.dwSize);
|
||||
@ -1128,13 +1140,25 @@ static void test_CreatePropertySheetPage(void)
|
||||
if (hpsp)
|
||||
{
|
||||
page.release_called = 0;
|
||||
ret = DestroyPropertySheetPage(hpsp);
|
||||
ret = pDestroyPropertySheetPage(hpsp);
|
||||
ok(ret, "Failed to destroy a page\n");
|
||||
ok(page.release_called == 1, "Expected RELEASE callback message\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
X(CreatePropertySheetPageA);
|
||||
X(CreatePropertySheetPageW);
|
||||
X(DestroyPropertySheetPage);
|
||||
X(PropertySheetA);
|
||||
#undef X
|
||||
}
|
||||
|
||||
START_TEST(propsheet)
|
||||
{
|
||||
detect_locale();
|
||||
@ -1146,6 +1170,8 @@ START_TEST(propsheet)
|
||||
SetProcessDefaultLayout(LAYOUT_RTL);
|
||||
}
|
||||
|
||||
init_functions();
|
||||
|
||||
test_title();
|
||||
test_nopage();
|
||||
test_disableowner();
|
||||
|
@ -17,7 +17,24 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
/* make sure the structures work with a comctl32 v5.x */
|
||||
#ifndef __REACTOS__
|
||||
#define _WIN32_WINNT 0x500
|
||||
#define _WIN32_IE 0x500
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <uxtheme.h>
|
||||
|
||||
#include "wine/heap.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
|
||||
static HIMAGELIST (WINAPI *pImageList_LoadImageA)(HINSTANCE, LPCSTR, int, int, COLORREF, UINT, UINT);
|
||||
|
||||
static RECT height_change_notify_rect;
|
||||
static HWND hMainWnd;
|
||||
@ -206,9 +223,9 @@ static rbsize_result_t rbsize_init(int cleft, int ctop, int cright, int cbottom,
|
||||
SetRect(&ret.rcClient, cleft, ctop, cright, cbottom);
|
||||
ret.cyBarHeight = cyBarHeight;
|
||||
ret.nRows = 0;
|
||||
ret.cyRowHeights = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nRows*sizeof(int));
|
||||
ret.cyRowHeights = heap_alloc_zero(nRows * sizeof(int));
|
||||
ret.nBands = 0;
|
||||
ret.bands = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nBands*sizeof(rbband_result_t));
|
||||
ret.bands = heap_alloc_zero(nBands * sizeof(*ret.bands));
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -232,7 +249,7 @@ static rbsize_result_t *rbsize_results;
|
||||
|
||||
static void rbsize_results_init(void)
|
||||
{
|
||||
rbsize_results = HeapAlloc(GetProcessHeap(), 0, rbsize_results_num*sizeof(rbsize_result_t));
|
||||
rbsize_results = heap_alloc(rbsize_results_num * sizeof(*rbsize_results));
|
||||
|
||||
rbsize_results[0] = rbsize_init(0, 0, 672, 0, 0, 0, 0);
|
||||
|
||||
@ -419,10 +436,10 @@ static void rbsize_results_free(void)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < rbsize_results_num; i++) {
|
||||
HeapFree(GetProcessHeap(), 0, rbsize_results[i].cyRowHeights);
|
||||
HeapFree(GetProcessHeap(), 0, rbsize_results[i].bands);
|
||||
heap_free(rbsize_results[i].cyRowHeights);
|
||||
heap_free(rbsize_results[i].bands);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, rbsize_results);
|
||||
heap_free(rbsize_results);
|
||||
rbsize_results = NULL;
|
||||
}
|
||||
|
||||
@ -566,7 +583,7 @@ static void test_layout(void)
|
||||
check_sizes();
|
||||
|
||||
/* an image will increase the band height */
|
||||
himl = ImageList_LoadImageA(GetModuleHandleA("comctl32"), MAKEINTRESOURCEA(121), 24, 2,
|
||||
himl = pImageList_LoadImageA(GetModuleHandleA("comctl32"), MAKEINTRESOURCEA(121), 24, 2,
|
||||
CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
|
||||
ri.cbSize = sizeof(ri);
|
||||
ri.fMask = RBIM_IMAGELIST;
|
||||
@ -647,7 +664,7 @@ static void test_layout(void)
|
||||
|
||||
rbsize_results_free();
|
||||
DestroyWindow(hRebar);
|
||||
ImageList_Destroy(himl);
|
||||
pImageList_Destroy(himl);
|
||||
}
|
||||
|
||||
#if 0 /* use this to generate more tests */
|
||||
@ -1114,26 +1131,22 @@ static void test_notification(void)
|
||||
DestroyWindow(rebar);
|
||||
}
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
X(ImageList_Destroy);
|
||||
X(ImageList_LoadImageA);
|
||||
#undef X
|
||||
}
|
||||
|
||||
START_TEST(rebar)
|
||||
{
|
||||
HMODULE hComctl32;
|
||||
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
INITCOMMONCONTROLSEX iccex;
|
||||
MSG msg;
|
||||
|
||||
init_system_font_height();
|
||||
|
||||
/* LoadLibrary is needed. This file has no reference to functions in comctl32 */
|
||||
hComctl32 = LoadLibraryA("comctl32.dll");
|
||||
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
|
||||
if (!pInitCommonControlsEx)
|
||||
{
|
||||
win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
|
||||
return;
|
||||
}
|
||||
iccex.dwSize = sizeof(iccex);
|
||||
iccex.dwICC = ICC_COOL_CLASSES;
|
||||
pInitCommonControlsEx(&iccex);
|
||||
init_functions();
|
||||
|
||||
hMainWnd = create_parent_window();
|
||||
|
||||
@ -1158,6 +1171,4 @@ out:
|
||||
DispatchMessageA(&msg);
|
||||
}
|
||||
DestroyWindow(hMainWnd);
|
||||
|
||||
FreeLibrary(hComctl32);
|
||||
}
|
||||
|
@ -17,7 +17,19 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef __REACTOS__
|
||||
#define STRICT
|
||||
#endif
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include "commctrl.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#include "v6util.h"
|
||||
|
||||
#define TODO_COUNT 1
|
||||
|
||||
@ -44,7 +56,7 @@ static void flush_events(void)
|
||||
|
||||
static HWND create_static(DWORD style)
|
||||
{
|
||||
return CreateWindowA("static", "Test", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)CTRL_ID, NULL, 0);
|
||||
return CreateWindowA(WC_STATICA, "Test", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)CTRL_ID, NULL, 0);
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
|
@ -18,7 +18,10 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#define SUBCLASS_NAME "MyStatusBar"
|
||||
|
||||
@ -40,6 +43,8 @@ static INT g_dpisize;
|
||||
static int g_wmdrawitm_ctr;
|
||||
static WNDPROC g_wndproc_saved;
|
||||
|
||||
static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
|
||||
static HWND create_status_control(DWORD style, DWORD exstyle)
|
||||
{
|
||||
HWND hWndStatus;
|
||||
@ -581,17 +586,32 @@ static void test_notify(void)
|
||||
ok(g_got_contextmenu, "WM_RBUTTONUP did not activate the context menu!\n");
|
||||
}
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
X(InitCommonControlsEx);
|
||||
#undef X
|
||||
}
|
||||
|
||||
START_TEST(status)
|
||||
{
|
||||
INITCOMMONCONTROLSEX iccex;
|
||||
|
||||
init_functions();
|
||||
|
||||
hinst = GetModuleHandleA(NULL);
|
||||
|
||||
g_hMainWnd = CreateWindowExA(0, "static", "", WS_OVERLAPPEDWINDOW,
|
||||
iccex.dwSize = sizeof(iccex);
|
||||
iccex.dwICC = ICC_BAR_CLASSES;
|
||||
pInitCommonControlsEx(&iccex);
|
||||
|
||||
g_hMainWnd = CreateWindowExA(0, WC_STATICA, "", WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 672+2*GetSystemMetrics(SM_CXSIZEFRAME),
|
||||
226+GetSystemMetrics(SM_CYCAPTION)+2*GetSystemMetrics(SM_CYSIZEFRAME),
|
||||
NULL, NULL, GetModuleHandleA(NULL), 0);
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
register_subclass();
|
||||
|
||||
test_status_control();
|
||||
|
@ -19,13 +19,18 @@
|
||||
|
||||
#define _WIN32_WINNT 0x0501 /* For SetWindowSubclass/etc */
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "commctrl.h"
|
||||
|
||||
#include "wine/heap.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR);
|
||||
static BOOL (WINAPI *pRemoveWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR);
|
||||
static LRESULT (WINAPI *pDefSubclassProc)(HWND, UINT, WPARAM, LPARAM);
|
||||
@ -115,12 +120,12 @@ static void add_message(const struct message *msg)
|
||||
if (!sequence)
|
||||
{
|
||||
sequence_size = 10;
|
||||
sequence = HeapAlloc( GetProcessHeap(), 0, sequence_size * sizeof (struct message) );
|
||||
sequence = heap_alloc( sequence_size * sizeof (struct message) );
|
||||
}
|
||||
if (sequence_cnt == sequence_size)
|
||||
{
|
||||
sequence_size *= 2;
|
||||
sequence = HeapReAlloc( GetProcessHeap(), 0, sequence, sequence_size * sizeof (struct message) );
|
||||
sequence = heap_realloc( sequence, sequence_size * sizeof (struct message) );
|
||||
}
|
||||
assert(sequence);
|
||||
|
||||
@ -132,8 +137,8 @@ static void add_message(const struct message *msg)
|
||||
|
||||
static void flush_sequence(void)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, sequence);
|
||||
sequence = 0;
|
||||
heap_free(sequence);
|
||||
sequence = NULL;
|
||||
sequence_cnt = sequence_size = 0;
|
||||
}
|
||||
|
||||
@ -282,7 +287,7 @@ static BOOL init_function_pointers(void)
|
||||
HMODULE hmod;
|
||||
void *ptr;
|
||||
|
||||
hmod = GetModuleHandleA("comctl32.dll");
|
||||
hmod = LoadLibraryA("comctl32.dll");
|
||||
ok(hmod != NULL, "got %p\n", hmod);
|
||||
|
||||
/* Functions have to be loaded by ordinal. Only XP and W2K3 export
|
||||
|
@ -17,7 +17,12 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
#include "msg.h"
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
|
||||
#define NUM_MSG_SEQUENCE 2
|
||||
|
@ -18,7 +18,12 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "msg.h"
|
||||
|
||||
#define DEFAULT_MIN_TAB_WIDTH 54
|
||||
#define TAB_PADDING_X 6
|
||||
@ -35,6 +40,11 @@
|
||||
|
||||
#define TabWidthPadded(padd_x, num) (DEFAULT_MIN_TAB_WIDTH - (TAB_PADDING_X - (padd_x)) * num)
|
||||
|
||||
static HIMAGELIST (WINAPI *pImageList_Create)(INT,INT,UINT,INT,INT);
|
||||
static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
|
||||
static INT (WINAPI *pImageList_GetImageCount)(HIMAGELIST);
|
||||
static INT (WINAPI *pImageList_ReplaceIcon)(HIMAGELIST,INT,HICON);
|
||||
|
||||
static void CheckSize(HWND hwnd, INT width, INT height, const char *msg, int line)
|
||||
{
|
||||
RECT r;
|
||||
@ -69,84 +79,19 @@ static void TabCheckSetSize(HWND hwnd, INT set_width, INT set_height, INT exp_wi
|
||||
static HFONT hFont;
|
||||
static DRAWITEMSTRUCT g_drawitem;
|
||||
static HWND parent_wnd;
|
||||
static LRESULT tcn_selchanging_result;
|
||||
|
||||
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
|
||||
|
||||
static const struct message add_tab_to_parent[] = {
|
||||
{ TCM_INSERTITEMA, sent },
|
||||
{ TCM_INSERTITEMA, sent|optional },
|
||||
{ WM_NOTIFYFORMAT, sent|defwinproc },
|
||||
{ WM_QUERYUISTATE, sent|wparam|lparam|defwinproc|optional, 0, 0 },
|
||||
{ WM_PARENTNOTIFY, sent|defwinproc },
|
||||
{ TCM_INSERTITEMA, sent },
|
||||
{ TCM_INSERTITEMA, sent },
|
||||
{ TCM_INSERTITEMA, sent },
|
||||
{ TCM_INSERTITEMA, sent|optional },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message add_tab_to_parent_interactive[] = {
|
||||
{ TCM_INSERTITEMA, sent },
|
||||
{ TCM_INSERTITEMA, sent },
|
||||
{ WM_NOTIFYFORMAT, sent|defwinproc },
|
||||
{ WM_QUERYUISTATE, sent|wparam|lparam|defwinproc, 0, 0 },
|
||||
{ WM_PARENTNOTIFY, sent|defwinproc },
|
||||
{ TCM_INSERTITEMA, sent },
|
||||
{ TCM_INSERTITEMA, sent },
|
||||
{ TCM_INSERTITEMA, sent },
|
||||
{ WM_SHOWWINDOW, sent},
|
||||
{ WM_WINDOWPOSCHANGING, sent},
|
||||
{ WM_WINDOWPOSCHANGING, sent},
|
||||
{ WM_NCACTIVATE, sent},
|
||||
{ WM_ACTIVATE, sent},
|
||||
{ WM_IME_SETCONTEXT, sent|defwinproc|optional},
|
||||
{ WM_IME_NOTIFY, sent|defwinproc|optional},
|
||||
{ WM_SETFOCUS, sent|defwinproc},
|
||||
{ WM_WINDOWPOSCHANGED, sent},
|
||||
{ WM_SIZE, sent},
|
||||
{ WM_MOVE, sent},
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message add_tab_control_parent_seq[] = {
|
||||
{ WM_NOTIFYFORMAT, sent },
|
||||
{ WM_QUERYUISTATE, sent|wparam|lparam|optional, 0, 0 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message add_tab_control_parent_seq_interactive[] = {
|
||||
{ WM_NOTIFYFORMAT, sent },
|
||||
{ WM_QUERYUISTATE, sent|wparam|lparam, 0, 0 },
|
||||
{ WM_WINDOWPOSCHANGING, sent|optional},
|
||||
{ WM_NCACTIVATE, sent},
|
||||
{ WM_ACTIVATE, sent},
|
||||
{ WM_WINDOWPOSCHANGING, sent|optional},
|
||||
{ WM_KILLFOCUS, sent},
|
||||
{ WM_IME_SETCONTEXT, sent|optional},
|
||||
{ WM_IME_NOTIFY, sent|optional},
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message empty_sequence[] = {
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message get_item_count_seq[] = {
|
||||
{ TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message get_row_count_seq[] = {
|
||||
{ TCM_GETROWCOUNT, sent|wparam|lparam, 0, 0 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message get_item_rect_seq[] = {
|
||||
{ TCM_GETITEMRECT, sent },
|
||||
{ TCM_GETITEMRECT, sent },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message getset_cur_focus_seq[] = {
|
||||
{ TCM_SETCURFOCUS, sent|lparam, 0 },
|
||||
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
||||
@ -254,6 +199,27 @@ static const struct message rbuttonup_seq[] = {
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message full_selchange_parent_seq[] = {
|
||||
{ WM_NOTIFY, sent|id, 0, 0, TCN_SELCHANGING },
|
||||
{ WM_NOTIFY, sent|id, 0, 0, TCN_SELCHANGE },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message selchanging_parent_seq[] = {
|
||||
{ WM_NOTIFY, sent|id, 0, 0, TCN_SELCHANGING },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message selchange_parent_seq[] = {
|
||||
{ WM_NOTIFY, sent|id, 0, 0, TCN_SELCHANGE },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message setfocus_parent_seq[] = {
|
||||
{ WM_NOTIFY, sent|id, 0, 0, TCN_FOCUSCHANGE },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static HWND
|
||||
create_tabcontrol (DWORD style, DWORD mask)
|
||||
{
|
||||
@ -292,7 +258,7 @@ create_tabcontrol (DWORD style, DWORD mask)
|
||||
return handle;
|
||||
}
|
||||
|
||||
static LRESULT WINAPI parentWindowProcess(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static LONG defwndproc_counter = 0;
|
||||
struct message msg = { 0 };
|
||||
@ -312,6 +278,8 @@ static LRESULT WINAPI parentWindowProcess(HWND hwnd, UINT message, WPARAM wParam
|
||||
if (defwndproc_counter) msg.flags |= defwinproc;
|
||||
msg.wParam = wParam;
|
||||
msg.lParam = lParam;
|
||||
if (message == WM_NOTIFY && lParam)
|
||||
msg.id = ((NMHDR*)lParam)->code;
|
||||
add_message(sequences, PARENT_SEQ_INDEX, &msg);
|
||||
}
|
||||
|
||||
@ -319,6 +287,13 @@ static LRESULT WINAPI parentWindowProcess(HWND hwnd, UINT message, WPARAM wParam
|
||||
if (message == WM_DRAWITEM)
|
||||
g_drawitem = *(DRAWITEMSTRUCT*)lParam;
|
||||
|
||||
if (message == WM_NOTIFY)
|
||||
{
|
||||
NMHDR *nmhdr = (NMHDR *)lParam;
|
||||
if (nmhdr && nmhdr->code == TCN_SELCHANGING)
|
||||
return tcn_selchanging_result;
|
||||
}
|
||||
|
||||
defwndproc_counter++;
|
||||
ret = DefWindowProcA(hwnd, message, wParam, lParam);
|
||||
defwndproc_counter--;
|
||||
@ -331,7 +306,7 @@ static BOOL registerParentWindowClass(void)
|
||||
WNDCLASSA cls;
|
||||
|
||||
cls.style = 0;
|
||||
cls.lpfnWndProc = parentWindowProcess;
|
||||
cls.lpfnWndProc = parent_wnd_proc;
|
||||
cls.cbClsExtra = 0;
|
||||
cls.cbWndExtra = 0;
|
||||
cls.hInstance = GetModuleHandleA(NULL);
|
||||
@ -353,7 +328,7 @@ static HWND createParentWindow(void)
|
||||
GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
|
||||
}
|
||||
|
||||
static LRESULT WINAPI tabSubclassProcess(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
static LRESULT WINAPI tab_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||
static LONG defwndproc_counter = 0;
|
||||
@ -399,7 +374,7 @@ static HWND createFilledTabControl(HWND parent_wnd, DWORD style, DWORD mask, INT
|
||||
rect.bottom, parent_wnd, NULL, NULL, 0);
|
||||
ok(tabHandle != NULL, "failed to create tab wnd\n");
|
||||
|
||||
oldproc = (WNDPROC)SetWindowLongPtrA(tabHandle, GWLP_WNDPROC, (LONG_PTR)tabSubclassProcess);
|
||||
oldproc = (WNDPROC)SetWindowLongPtrA(tabHandle, GWLP_WNDPROC, (LONG_PTR)tab_subclass_proc);
|
||||
SetWindowLongPtrA(tabHandle, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||
|
||||
tcNewTab.mask = mask;
|
||||
@ -465,7 +440,7 @@ static void test_tab(INT nMinTabWidth)
|
||||
{
|
||||
HWND hwTab;
|
||||
RECT rTab;
|
||||
HIMAGELIST himl = ImageList_Create(21, 21, ILC_COLOR, 3, 4);
|
||||
HIMAGELIST himl = pImageList_Create(21, 21, ILC_COLOR, 3, 4);
|
||||
SIZE size;
|
||||
HDC hdc;
|
||||
HFONT hOldFont;
|
||||
@ -603,7 +578,7 @@ static void test_tab(INT nMinTabWidth)
|
||||
|
||||
DestroyWindow (hwTab);
|
||||
|
||||
ImageList_Destroy(himl);
|
||||
pImageList_Destroy(himl);
|
||||
}
|
||||
|
||||
static void test_width(void)
|
||||
@ -623,7 +598,7 @@ static void test_width(void)
|
||||
static void test_curfocus(void)
|
||||
{
|
||||
const INT nTabs = 5;
|
||||
INT focusIndex;
|
||||
INT ret;
|
||||
HWND hTab;
|
||||
|
||||
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs);
|
||||
@ -632,24 +607,63 @@ static void test_curfocus(void)
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
/* Testing CurFocus with largest appropriate value */
|
||||
SendMessageA(hTab, TCM_SETCURFOCUS, nTabs - 1, 0);
|
||||
focusIndex = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||
expect(nTabs-1, focusIndex);
|
||||
ret = SendMessageA(hTab, TCM_SETCURFOCUS, nTabs - 1, 0);
|
||||
ok(ret == 0, "Unexpected ret value %d.\n", ret);
|
||||
ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||
ok(ret == nTabs - 1, "Unexpected focus index %d.\n", ret);
|
||||
|
||||
/* Testing CurFocus with negative value */
|
||||
SendMessageA(hTab, TCM_SETCURFOCUS, -10, 0);
|
||||
focusIndex = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||
expect(-1, focusIndex);
|
||||
ret = SendMessageA(hTab, TCM_SETCURFOCUS, -10, 0);
|
||||
ok(ret == 0, "Unexpected ret value %d.\n", ret);
|
||||
ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||
ok(ret == -1, "Unexpected focus index %d.\n", ret);
|
||||
|
||||
/* Testing CurFocus with value larger than number of tabs */
|
||||
focusIndex = SendMessageA(hTab, TCM_SETCURSEL, 1, 0);
|
||||
expect(-1, focusIndex);
|
||||
ret = SendMessageA(hTab, TCM_SETCURSEL, 1, 0);
|
||||
ok(ret == -1, "Unexpected focus index %d.\n", ret);
|
||||
|
||||
SendMessageA(hTab, TCM_SETCURFOCUS, nTabs + 1, 0);
|
||||
focusIndex = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||
expect(1, focusIndex);
|
||||
ret = SendMessageA(hTab, TCM_SETCURFOCUS, nTabs + 1, 0);
|
||||
ok(ret == 0, "Unexpected ret value %d.\n", ret);
|
||||
ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||
ok(ret == 1, "Unexpected focus index %d.\n", ret);
|
||||
|
||||
ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_focus_seq, "Getset curFoc test sequence", FALSE);
|
||||
ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_focus_seq, "Set focused tab sequence", FALSE);
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Set focused tab parent sequence", TRUE);
|
||||
|
||||
DestroyWindow(hTab);
|
||||
|
||||
/* TCS_BUTTONS */
|
||||
hTab = createFilledTabControl(parent_wnd, TCS_BUTTONS, TCIF_TEXT|TCIF_IMAGE, nTabs);
|
||||
ok(hTab != NULL, "Failed to create tab control\n");
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
/* Testing CurFocus with largest appropriate value */
|
||||
ret = SendMessageA(hTab, TCM_SETCURFOCUS, nTabs - 1, 0);
|
||||
ok(ret == 0, "Unexpected ret value %d.\n", ret);
|
||||
ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||
ok(ret == nTabs - 1, "Unexpected focus index %d.\n", ret);
|
||||
|
||||
/* Testing CurFocus with negative value */
|
||||
ret = SendMessageA(hTab, TCM_SETCURFOCUS, -10, 0);
|
||||
ok(ret == 0, "Unexpected ret value %d.\n", ret);
|
||||
ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||
todo_wine
|
||||
ok(ret == nTabs - 1, "Unexpected focus index %d.\n", ret);
|
||||
|
||||
/* Testing CurFocus with value larger than number of tabs */
|
||||
ret = SendMessageA(hTab, TCM_SETCURSEL, 1, 0);
|
||||
todo_wine
|
||||
ok(ret == 0, "Unexpected focus index %d.\n", ret);
|
||||
|
||||
ret = SendMessageA(hTab, TCM_SETCURFOCUS, nTabs + 1, 0);
|
||||
ok(ret == 0, "Unexpected ret value %d.\n", ret);
|
||||
ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||
todo_wine
|
||||
ok(ret == nTabs - 1, "Unexpected focus index %d.\n", ret);
|
||||
|
||||
ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_focus_seq, "TCS_BUTTONS: set focused tab sequence", FALSE);
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, setfocus_parent_seq, "TCS_BUTTONS: set focused tab parent sequence", TRUE);
|
||||
|
||||
DestroyWindow(hTab);
|
||||
}
|
||||
@ -938,8 +952,9 @@ static void test_getset_item(void)
|
||||
static void test_getset_tooltips(void)
|
||||
{
|
||||
char toolTipText[32] = "ToolTip Text Test";
|
||||
HWND hTab, toolTip, hwnd;
|
||||
const INT nTabs = 5;
|
||||
HWND hTab, toolTip;
|
||||
int ret;
|
||||
|
||||
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs);
|
||||
ok(hTab != NULL, "Failed to create tab control\n");
|
||||
@ -947,78 +962,22 @@ static void test_getset_tooltips(void)
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
toolTip = create_tooltip(hTab, toolTipText);
|
||||
SendMessageA(hTab, TCM_SETTOOLTIPS, (LPARAM)toolTip, 0);
|
||||
ok(toolTip == (HWND)SendMessageA(hTab, TCM_GETTOOLTIPS, 0,0), "ToolTip was set incorrectly.\n");
|
||||
ret = SendMessageA(hTab, TCM_SETTOOLTIPS, (WPARAM)toolTip, 0);
|
||||
ok(ret == 0, "Unexpected ret value %d.\n", ret);
|
||||
hwnd = (HWND)SendMessageA(hTab, TCM_GETTOOLTIPS, 0, 0);
|
||||
ok(toolTip == hwnd, "Unexpected tooltip window.\n");
|
||||
|
||||
SendMessageA(hTab, TCM_SETTOOLTIPS, 0, 0);
|
||||
ok(!SendMessageA(hTab, TCM_GETTOOLTIPS, 0,0), "ToolTip was set incorrectly.\n");
|
||||
ret = SendMessageA(hTab, TCM_SETTOOLTIPS, 0, 0);
|
||||
ok(ret == 0, "Unexpected ret value %d.\n", ret);
|
||||
hwnd = (HWND)SendMessageA(hTab, TCM_GETTOOLTIPS, 0, 0);
|
||||
ok(hwnd == NULL, "Unexpected tooltip window.\n");
|
||||
ok(IsWindow(toolTip), "Expected tooltip window to be alive.\n");
|
||||
|
||||
ok_sequence(sequences, TAB_SEQ_INDEX, getset_tooltip_seq, "Getset tooltip test sequence", TRUE);
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, getset_tooltip_parent_seq, "Getset tooltip test parent sequence", TRUE);
|
||||
|
||||
DestroyWindow(hTab);
|
||||
}
|
||||
|
||||
static void test_misc(void)
|
||||
{
|
||||
const INT nTabs = 5;
|
||||
HWND hTab;
|
||||
RECT rTab;
|
||||
INT nTabsRetrieved;
|
||||
INT rowCount;
|
||||
INT dpi;
|
||||
HDC hdc;
|
||||
|
||||
ok(parent_wnd != NULL, "no parent window!\n");
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs);
|
||||
ok(hTab != NULL, "Failed to create tab control\n");
|
||||
|
||||
if(!winetest_interactive)
|
||||
ok_sequence(sequences, TAB_SEQ_INDEX, add_tab_to_parent,
|
||||
"Tab sequence, after adding tab control to parent", TRUE);
|
||||
else
|
||||
ok_sequence(sequences, TAB_SEQ_INDEX, add_tab_to_parent_interactive,
|
||||
"Tab sequence, after adding tab control to parent", TRUE);
|
||||
|
||||
if(!winetest_interactive)
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, add_tab_control_parent_seq,
|
||||
"Parent after sequence, adding tab control to parent", TRUE);
|
||||
else
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, add_tab_control_parent_seq_interactive,
|
||||
"Parent after sequence, adding tab control to parent", TRUE);
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
ok(SendMessageA(hTab, TCM_SETMINTABWIDTH, 0, -1) > 0, "TCM_SETMINTABWIDTH returned < 0\n");
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Set minTabWidth test parent sequence", FALSE);
|
||||
|
||||
/* Testing GetItemCount */
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
nTabsRetrieved = SendMessageA(hTab, TCM_GETITEMCOUNT, 0, 0);
|
||||
expect(nTabs, nTabsRetrieved);
|
||||
ok_sequence(sequences, TAB_SEQ_INDEX, get_item_count_seq, "Get itemCount test sequence", FALSE);
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset itemCount test parent sequence", FALSE);
|
||||
|
||||
/* Testing GetRowCount */
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
rowCount = SendMessageA(hTab, TCM_GETROWCOUNT, 0, 0);
|
||||
expect(1, rowCount);
|
||||
ok_sequence(sequences, TAB_SEQ_INDEX, get_row_count_seq, "Get rowCount test sequence", FALSE);
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get rowCount test parent sequence", FALSE);
|
||||
|
||||
/* Testing GetItemRect */
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
ok(SendMessageA(hTab, TCM_GETITEMRECT, 0, (LPARAM)&rTab), "GetItemRect failed.\n");
|
||||
|
||||
hdc = GetDC(hTab);
|
||||
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
|
||||
ReleaseDC(hTab, hdc);
|
||||
CHECKSIZE(hTab, dpi, -1 , "Default Width");
|
||||
ok_sequence(sequences, TAB_SEQ_INDEX, get_item_rect_seq, "Get itemRect test sequence", FALSE);
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get itemRect test parent sequence", FALSE);
|
||||
|
||||
DestroyWindow(hTab);
|
||||
DestroyWindow(toolTip);
|
||||
}
|
||||
|
||||
static void test_adjustrect(void)
|
||||
@ -1160,12 +1119,12 @@ static void test_removeimage(void)
|
||||
INT i;
|
||||
TCITEMA item;
|
||||
HICON hicon;
|
||||
HIMAGELIST himl = ImageList_Create(16, 16, ILC_COLOR, 3, 4);
|
||||
HIMAGELIST himl = pImageList_Create(16, 16, ILC_COLOR, 3, 4);
|
||||
|
||||
hicon = CreateIcon(NULL, 16, 16, 1, 1, bits, bits);
|
||||
ImageList_AddIcon(himl, hicon);
|
||||
ImageList_AddIcon(himl, hicon);
|
||||
ImageList_AddIcon(himl, hicon);
|
||||
pImageList_ReplaceIcon(himl, -1, hicon);
|
||||
pImageList_ReplaceIcon(himl, -1, hicon);
|
||||
pImageList_ReplaceIcon(himl, -1, hicon);
|
||||
|
||||
hwTab = create_tabcontrol(TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE);
|
||||
SendMessageA(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
|
||||
@ -1180,7 +1139,8 @@ static void test_removeimage(void)
|
||||
|
||||
/* remove image middle image */
|
||||
SendMessageA(hwTab, TCM_REMOVEIMAGE, 1, 0);
|
||||
expect(2, ImageList_GetImageCount(himl));
|
||||
i = pImageList_GetImageCount(himl);
|
||||
ok(i == 2, "Unexpected image count %d.\n", i);
|
||||
item.iImage = -1;
|
||||
SendMessageA(hwTab, TCM_GETITEMA, 0, (LPARAM)&item);
|
||||
expect(0, item.iImage);
|
||||
@ -1192,7 +1152,8 @@ static void test_removeimage(void)
|
||||
expect(1, item.iImage);
|
||||
/* remove first image */
|
||||
SendMessageA(hwTab, TCM_REMOVEIMAGE, 0, 0);
|
||||
expect(1, ImageList_GetImageCount(himl));
|
||||
i = pImageList_GetImageCount(himl);
|
||||
ok(i == 1, "Unexpected image count %d.\n", i);
|
||||
item.iImage = 0;
|
||||
SendMessageA(hwTab, TCM_GETITEMA, 0, (LPARAM)&item);
|
||||
expect(-1, item.iImage);
|
||||
@ -1204,7 +1165,8 @@ static void test_removeimage(void)
|
||||
expect(0, item.iImage);
|
||||
/* remove the last one */
|
||||
SendMessageA(hwTab, TCM_REMOVEIMAGE, 0, 0);
|
||||
expect(0, ImageList_GetImageCount(himl));
|
||||
i = pImageList_GetImageCount(himl);
|
||||
ok(i == 0, "Unexpected image count %d.\n", i);
|
||||
for(i = 0; i < 3; i++) {
|
||||
item.iImage = 0;
|
||||
SendMessageA(hwTab, TCM_GETITEMA, i, (LPARAM)&item);
|
||||
@ -1212,7 +1174,7 @@ static void test_removeimage(void)
|
||||
}
|
||||
|
||||
DestroyWindow(hwTab);
|
||||
ImageList_Destroy(himl);
|
||||
pImageList_Destroy(himl);
|
||||
DestroyIcon(hicon);
|
||||
}
|
||||
|
||||
@ -1418,6 +1380,107 @@ static void test_create(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
X(ImageList_Create);
|
||||
X(ImageList_Destroy);
|
||||
X(ImageList_GetImageCount);
|
||||
X(ImageList_ReplaceIcon);
|
||||
#undef X
|
||||
}
|
||||
|
||||
static void test_TCN_SELCHANGING(void)
|
||||
{
|
||||
const INT nTabs = 5;
|
||||
HWND hTab;
|
||||
INT ret;
|
||||
|
||||
hTab = createFilledTabControl(parent_wnd, WS_CHILD|TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs);
|
||||
ok(hTab != NULL, "Failed to create tab control\n");
|
||||
|
||||
/* Initially first tab is focused. */
|
||||
ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||
ok(ret == 0, "Unexpected tab focus %d.\n", ret);
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
/* Setting focus to currently focused item should do nothing. */
|
||||
ret = SendMessageA(hTab, TCM_SETCURFOCUS, 0, 0);
|
||||
ok(ret == 0, "Unexpected ret value %d.\n", ret);
|
||||
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Set focus to focused tab sequence", FALSE);
|
||||
|
||||
/* Allow selection change. */
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
tcn_selchanging_result = 0;
|
||||
ret = SendMessageA(hTab, TCM_SETCURFOCUS, nTabs - 1, 0);
|
||||
ok(ret == 0, "Unexpected ret value %d.\n", ret);
|
||||
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, full_selchange_parent_seq, "Focus change allowed sequence", FALSE);
|
||||
|
||||
ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||
ok(ret == nTabs - 1, "Unexpected focused tab %d.\n", ret);
|
||||
ret = SendMessageA(hTab, TCM_GETCURSEL, 0, 0);
|
||||
ok(ret == nTabs - 1, "Unexpected selected tab %d.\n", ret);
|
||||
|
||||
/* Forbid selection change. */
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
tcn_selchanging_result = 1;
|
||||
ret = SendMessageA(hTab, TCM_SETCURFOCUS, 0, 0);
|
||||
ok(ret == 0, "Unexpected ret value %d.\n", ret);
|
||||
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, selchanging_parent_seq, "Focus change disallowed sequence", FALSE);
|
||||
|
||||
ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||
todo_wine
|
||||
ok(ret == nTabs - 1, "Unexpected focused tab %d.\n", ret);
|
||||
ret = SendMessageA(hTab, TCM_GETCURSEL, 0, 0);
|
||||
todo_wine
|
||||
ok(ret == nTabs - 1, "Unexpected selected tab %d.\n", ret);
|
||||
|
||||
/* Removing focus sends only TCN_SELCHANGE */
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
ret = SendMessageA(hTab, TCM_SETCURFOCUS, -1, 0);
|
||||
ok(ret == 0, "Unexpected ret value %d.\n", ret);
|
||||
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, selchange_parent_seq, "Remove focus sequence", FALSE);
|
||||
|
||||
ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||
ok(ret == -1, "Unexpected focused tab %d.\n", ret);
|
||||
|
||||
tcn_selchanging_result = 0;
|
||||
|
||||
DestroyWindow(hTab);
|
||||
}
|
||||
|
||||
static void test_TCM_GETROWCOUNT(void)
|
||||
{
|
||||
const INT nTabs = 5;
|
||||
HWND hTab;
|
||||
INT count;
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs);
|
||||
ok(hTab != NULL, "Failed to create tab control\n");
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
count = SendMessageA(hTab, TCM_GETROWCOUNT, 0, 0);
|
||||
ok(count == 1, "Unexpected row count %d.\n", count);
|
||||
|
||||
ok_sequence(sequences, TAB_SEQ_INDEX, get_row_count_seq, "Get rowCount test sequence", FALSE);
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get rowCount test parent sequence", FALSE);
|
||||
|
||||
DestroyWindow(hTab);
|
||||
}
|
||||
|
||||
START_TEST(tab)
|
||||
{
|
||||
LOGFONTA logfont;
|
||||
@ -1429,25 +1492,21 @@ START_TEST(tab)
|
||||
logfont.lfCharSet = ANSI_CHARSET;
|
||||
hFont = CreateFontIndirectA(&logfont);
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
test_width();
|
||||
init_functions();
|
||||
|
||||
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
parent_wnd = createParentWindow();
|
||||
ok(parent_wnd != NULL, "Failed to create parent window!\n");
|
||||
|
||||
test_width();
|
||||
test_curfocus();
|
||||
test_cursel();
|
||||
test_extendedstyle();
|
||||
test_unicodeformat();
|
||||
test_getset_item();
|
||||
test_getset_tooltips();
|
||||
test_misc();
|
||||
|
||||
test_adjustrect();
|
||||
|
||||
test_insert_focus();
|
||||
test_delete_focus();
|
||||
test_delete_selection();
|
||||
@ -1456,6 +1515,8 @@ START_TEST(tab)
|
||||
test_TCS_OWNERDRAWFIXED();
|
||||
test_WM_CONTEXTMENU();
|
||||
test_create();
|
||||
test_TCN_SELCHANGING();
|
||||
test_TCM_GETROWCOUNT();
|
||||
|
||||
DestroyWindow(parent_wnd);
|
||||
}
|
||||
|
@ -17,7 +17,17 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "commctrl.h"
|
||||
|
||||
#include "wine/heap.h"
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
#include "msg.h"
|
||||
|
||||
#define WM_TD_CALLBACK (WM_APP) /* Custom dummy message to wrap callback notifications */
|
||||
|
||||
@ -135,7 +145,7 @@ static void run_test_(TASKDIALOGCONFIG *info, int expect_button, const struct me
|
||||
int i;
|
||||
|
||||
/* Allocate messages to test against, plus 2 implicit and 1 empty */
|
||||
msg_start = msg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*msg) * (test_messages_len + 3));
|
||||
msg_start = msg = heap_alloc_zero(sizeof(*msg) * (test_messages_len + 3));
|
||||
|
||||
/* Always needed, thus made implicit */
|
||||
init_test_message(TDN_DIALOG_CONSTRUCTED, 0, 0, msg++);
|
||||
@ -154,7 +164,7 @@ static void run_test_(TASKDIALOGCONFIG *info, int expect_button, const struct me
|
||||
ok_(file, line)(ret_button == expect_button,
|
||||
"Wrong button. Expected %d, got %d\n", expect_button, ret_button);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, msg_start);
|
||||
heap_free(msg_start);
|
||||
}
|
||||
|
||||
static const LONG_PTR test_ref_data = 123456;
|
||||
|
@ -18,11 +18,32 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winnls.h"
|
||||
#include "winreg.h"
|
||||
#include "commctrl.h"
|
||||
|
||||
#include "resources.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#include "msg.h"
|
||||
|
||||
#define PARENT_SEQ_INDEX 0
|
||||
#define NUM_MSG_SEQUENCES 1
|
||||
|
||||
static HWND (WINAPI *pCreateToolbarEx)(HWND, DWORD, UINT, INT, HINSTANCE, UINT_PTR, const TBBUTTON *,
|
||||
INT, INT, INT, INT, INT, UINT);
|
||||
static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
|
||||
static INT (WINAPI *pImageList_GetImageCount)(HIMAGELIST);
|
||||
static BOOL (WINAPI *pImageList_GetIconSize)(HIMAGELIST, int *, int *);
|
||||
static HIMAGELIST (WINAPI *pImageList_LoadImageA)(HINSTANCE, LPCSTR, int, int, COLORREF, UINT, UINT);
|
||||
|
||||
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
|
||||
|
||||
static HWND hMainWnd;
|
||||
@ -161,7 +182,7 @@ static LRESULT parent_wnd_notify(LPARAM lParam)
|
||||
if (save->iItem == -1)
|
||||
{
|
||||
save->cbData = save->cbData * 2 + 11 * sizeof(DWORD);
|
||||
save->pData = HeapAlloc( GetProcessHeap(), 0, save->cbData );
|
||||
save->pData = heap_alloc( save->cbData );
|
||||
save->pData[0] = 0xcafe;
|
||||
save->pCurrent = save->pData + 1;
|
||||
}
|
||||
@ -237,7 +258,7 @@ static LRESULT parent_wnd_notify(LPARAM lParam)
|
||||
|
||||
if (restore->iItem == 0)
|
||||
{
|
||||
restore->tbButton.iString = (INT_PTR)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 8 );
|
||||
restore->tbButton.iString = (INT_PTR)heap_alloc_zero( 8 );
|
||||
strcpy( (char *)restore->tbButton.iString, "foo" );
|
||||
}
|
||||
else if (restore->iItem == 1)
|
||||
@ -267,7 +288,7 @@ static LRESULT parent_wnd_notify(LPARAM lParam)
|
||||
{
|
||||
case 0:
|
||||
tb->tbButton.idCommand = 7;
|
||||
alloced_str = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 8 );
|
||||
alloced_str = heap_alloc_zero( 8 );
|
||||
strcpy( alloced_str, "foo" );
|
||||
tb->tbButton.iString = (INT_PTR)alloced_str;
|
||||
return 1;
|
||||
@ -362,7 +383,7 @@ static void basic_test(void)
|
||||
MakeButton(buttons+3, 1003, TBSTYLE_SEP|TBSTYLE_GROUP, 0);
|
||||
MakeButton(buttons+6, 1006, TBSTYLE_SEP, 0);
|
||||
|
||||
hToolbar = CreateToolbarEx(hMainWnd,
|
||||
hToolbar = pCreateToolbarEx(hMainWnd,
|
||||
WS_VISIBLE | WS_CLIPCHILDREN | CCS_TOP |
|
||||
WS_CHILD | TBSTYLE_LIST,
|
||||
100,
|
||||
@ -468,8 +489,8 @@ static void add_128x15_bitmap(HWND hToolbar, int nCmds)
|
||||
HIMAGELIST himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0); \
|
||||
ok(himl != NULL, "No image list\n"); \
|
||||
if (himl != NULL) {\
|
||||
ok(ImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, ImageList_GetImageCount(himl)); \
|
||||
ImageList_GetIconSize(himl, &cx, &cy); \
|
||||
ok(pImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, pImageList_GetImageCount(himl)); \
|
||||
pImageList_GetIconSize(himl, &cx, &cy); \
|
||||
ok(cx == dx && cy == dy, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
|
||||
} \
|
||||
}
|
||||
@ -501,11 +522,11 @@ static void test_add_bitmap(void)
|
||||
himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0);
|
||||
ok(himl != NULL, "Got %p\n", himl);
|
||||
|
||||
ret = ImageList_GetIconSize(himl, &cx, &cy);
|
||||
ret = pImageList_GetIconSize(himl, &cx, &cy);
|
||||
ok(ret, "Got %d\n", ret);
|
||||
ok(cx == cy, "Got %d x %d\n", cx, cy);
|
||||
|
||||
count = ImageList_GetImageCount(himl);
|
||||
count = pImageList_GetImageCount(himl);
|
||||
|
||||
/* Image count */
|
||||
switch (id)
|
||||
@ -674,7 +695,7 @@ static void test_add_bitmap(void)
|
||||
|
||||
/* the control can add bitmaps to an existing image list */
|
||||
rebuild_toolbar(&hToolbar);
|
||||
himl = ImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_80x15),
|
||||
himl = pImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_80x15),
|
||||
20, 2, CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
|
||||
ok(himl != NULL, "failed to create imagelist\n");
|
||||
ok(SendMessageA(hToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl) == 0, "TB_SETIMAGELIST failed\n");
|
||||
@ -695,7 +716,7 @@ static void test_add_bitmap(void)
|
||||
addbmp.hInst = HINST_COMMCTRL;
|
||||
addbmp.nID = IDB_STD_SMALL_COLOR;
|
||||
rebuild_toolbar(&hToolbar);
|
||||
ImageList_Destroy(himl);
|
||||
pImageList_Destroy(himl);
|
||||
|
||||
ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
|
||||
CHECK_IMAGELIST(15, 16, 16);
|
||||
@ -985,7 +1006,7 @@ static tbsize_result_t init_tbsize_result(int nButtonsAlloc, int cleft, int ctop
|
||||
ret.szMin.cx = minx;
|
||||
ret.szMin.cy = miny;
|
||||
ret.nButtons = 0;
|
||||
ret.prcButtons = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nButtonsAlloc*sizeof(RECT));
|
||||
ret.prcButtons = heap_alloc_zero(nButtonsAlloc * sizeof(*ret.prcButtons));
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1007,7 +1028,7 @@ static void init_tbsize_results(void) {
|
||||
int fontheight = system_font_height();
|
||||
int buttonwidth;
|
||||
|
||||
tbsize_results = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, tbsize_results_num*sizeof(tbsize_result_t));
|
||||
tbsize_results = heap_alloc_zero(tbsize_results_num * sizeof(*tbsize_results));
|
||||
|
||||
tbsize_results[0] = init_tbsize_result(5, 0, 0 ,672 ,26, 100 ,22);
|
||||
tbsize_addbutton(&tbsize_results[0], 0, 2, 23, 24);
|
||||
@ -1262,8 +1283,8 @@ static void free_tbsize_results(void) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < tbsize_results_num; i++)
|
||||
HeapFree(GetProcessHeap(), 0, tbsize_results[i].prcButtons);
|
||||
HeapFree(GetProcessHeap(), 0, tbsize_results);
|
||||
heap_free(tbsize_results[i].prcButtons);
|
||||
heap_free(tbsize_results);
|
||||
tbsize_results = NULL;
|
||||
}
|
||||
|
||||
@ -1492,14 +1513,14 @@ static void test_sizes(void)
|
||||
|
||||
/* TB_SETIMAGELIST always changes the height but the width only if necessary */
|
||||
SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(100, 100));
|
||||
himl = ImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_80x15),
|
||||
himl = pImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_80x15),
|
||||
20, 2, CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
|
||||
ok(SendMessageA(hToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl) == 0, "TB_SETIMAGELIST failed\n");
|
||||
check_button_size(hToolbar, 100, 21);
|
||||
SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(100, 100));
|
||||
check_button_size(hToolbar, 100, 100);
|
||||
/* But there are no update when we change imagelist, and image sizes are the same */
|
||||
himl2 = ImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_128x15),
|
||||
himl2 = pImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_128x15),
|
||||
20, 2, CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
|
||||
ok(SendMessageA(hToolbar, TB_SETIMAGELIST, 0, (LRESULT)himl2) == (LRESULT)himl, "TB_SETIMAGELIST failed\n");
|
||||
check_button_size(hToolbar, 100, 100);
|
||||
@ -1524,8 +1545,8 @@ static void test_sizes(void)
|
||||
check_sizes_todo(0x30); /* some small problems with BTNS_AUTOSIZE button sizes */
|
||||
|
||||
rebuild_toolbar(&hToolbar);
|
||||
ImageList_Destroy(himl);
|
||||
ImageList_Destroy(himl2);
|
||||
pImageList_Destroy(himl);
|
||||
pImageList_Destroy(himl2);
|
||||
|
||||
SendMessageA(hToolbar, TB_ADDBUTTONSA, 1, (LPARAM)&buttons3[3]);
|
||||
check_button_size(hToolbar, 7 + string_width(STRING2), 23 + fontheight);
|
||||
@ -1809,43 +1830,43 @@ static void test_createtoolbarex(void)
|
||||
TBBUTTON btns[3];
|
||||
ZeroMemory(&btns, sizeof(btns));
|
||||
|
||||
hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
3, 20, 20, 16, 16, sizeof(TBBUTTON));
|
||||
CHECK_IMAGELIST(16, 20, 20);
|
||||
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x1a001b, "%x");
|
||||
DestroyWindow(hToolbar);
|
||||
|
||||
hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
3, 4, 4, 16, 16, sizeof(TBBUTTON));
|
||||
CHECK_IMAGELIST(32, 4, 4);
|
||||
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0xa000b, "%x");
|
||||
DestroyWindow(hToolbar);
|
||||
|
||||
hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
3, 0, 8, 12, 12, sizeof(TBBUTTON));
|
||||
CHECK_IMAGELIST(16, 12, 12);
|
||||
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x120013, "%x");
|
||||
DestroyWindow(hToolbar);
|
||||
|
||||
hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
3, -1, 8, 12, 12, sizeof(TBBUTTON));
|
||||
CHECK_IMAGELIST(16, 12, 8);
|
||||
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0xe0013, "%x");
|
||||
DestroyWindow(hToolbar);
|
||||
|
||||
hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
3, -1, 8, -1, 12, sizeof(TBBUTTON));
|
||||
CHECK_IMAGELIST(16, 16, 8);
|
||||
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0xe0017, "%x");
|
||||
DestroyWindow(hToolbar);
|
||||
|
||||
hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
3, 0, 0, 12, -1, sizeof(TBBUTTON));
|
||||
CHECK_IMAGELIST(16, 12, 16);
|
||||
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x160013, "%x");
|
||||
DestroyWindow(hToolbar);
|
||||
|
||||
hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
|
||||
3, 0, 0, 0, 12, sizeof(TBBUTTON));
|
||||
CHECK_IMAGELIST(16, 16, 16);
|
||||
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x160017, "%x");
|
||||
@ -1914,7 +1935,7 @@ static void test_setrows(void)
|
||||
MakeButton(buttons+i, 1000+i, TBSTYLE_FLAT | TBSTYLE_CHECKGROUP, 0);
|
||||
|
||||
/* Test 1 - 9 buttons */
|
||||
hToolbar = CreateToolbarEx(hMainWnd,
|
||||
hToolbar = pCreateToolbarEx(hMainWnd,
|
||||
WS_VISIBLE | WS_CLIPCHILDREN | WS_CHILD | CCS_NORESIZE | CCS_NOPARENTALIGN
|
||||
| CCS_NOMOVEY | CCS_TOP,
|
||||
0,
|
||||
@ -2033,7 +2054,7 @@ static void test_get_set_style(void)
|
||||
MakeButton(buttons+3, 1003, TBSTYLE_SEP|TBSTYLE_GROUP, 0);
|
||||
MakeButton(buttons+6, 1006, TBSTYLE_SEP, 0);
|
||||
|
||||
hToolbar = CreateToolbarEx(hMainWnd,
|
||||
hToolbar = pCreateToolbarEx(hMainWnd,
|
||||
WS_VISIBLE | WS_CLIPCHILDREN | CCS_TOP |
|
||||
WS_CHILD | TBSTYLE_LIST,
|
||||
100,
|
||||
@ -2493,6 +2514,19 @@ static void test_imagelist(void)
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
X(CreateToolbarEx);
|
||||
X(ImageList_GetIconSize);
|
||||
X(ImageList_GetImageCount);
|
||||
X(ImageList_LoadImageA);
|
||||
X(ImageList_Destroy);
|
||||
#undef X
|
||||
}
|
||||
|
||||
START_TEST(toolbar)
|
||||
{
|
||||
WNDCLASSA wc;
|
||||
@ -2500,9 +2534,8 @@ START_TEST(toolbar)
|
||||
RECT rc;
|
||||
|
||||
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
init_functions();
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
|
@ -17,11 +17,27 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "resources.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#include "v6util.h"
|
||||
#include "msg.h"
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
|
||||
|
||||
static void test_create_tooltip(void)
|
||||
enum seq_index
|
||||
{
|
||||
PARENT_SEQ_INDEX = 0,
|
||||
NUM_MSG_SEQUENCES
|
||||
};
|
||||
|
||||
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
|
||||
|
||||
static void test_create_tooltip(BOOL is_v6)
|
||||
{
|
||||
HWND parent, hwnd;
|
||||
DWORD style, exp_style;
|
||||
@ -37,7 +53,6 @@ static void test_create_tooltip(void)
|
||||
ok(hwnd != NULL, "failed to create tooltip wnd\n");
|
||||
|
||||
style = GetWindowLongA(hwnd, GWL_STYLE);
|
||||
trace("style = %08x\n", style);
|
||||
exp_style = 0x7fffffff | WS_POPUP;
|
||||
exp_style &= ~(WS_CHILD | WS_MAXIMIZE | WS_BORDER | WS_DLGFRAME);
|
||||
ok(style == exp_style || broken(style == (exp_style | WS_BORDER)), /* nt4 */
|
||||
@ -51,9 +66,12 @@ static void test_create_tooltip(void)
|
||||
ok(hwnd != NULL, "failed to create tooltip wnd\n");
|
||||
|
||||
style = GetWindowLongA(hwnd, GWL_STYLE);
|
||||
trace("style = %08x\n", style);
|
||||
ok(style == (WS_POPUP | WS_CLIPSIBLINGS | WS_BORDER),
|
||||
"wrong style %08x\n", style);
|
||||
exp_style = WS_POPUP | WS_CLIPSIBLINGS;
|
||||
if (!is_v6)
|
||||
exp_style |= WS_BORDER;
|
||||
todo_wine_if(is_v6)
|
||||
ok(style == exp_style || broken(style == (exp_style | WS_BORDER)) /* XP */,
|
||||
"Unexpected window style %#x.\n", style);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
@ -255,22 +273,56 @@ static void test_customdraw(void) {
|
||||
|
||||
static const CHAR testcallbackA[] = "callback";
|
||||
|
||||
static RECT g_ttip_rect;
|
||||
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static LONG defwndproc_counter = 0;
|
||||
struct message msg;
|
||||
LRESULT ret;
|
||||
|
||||
if (message == WM_NOTIFY && lParam)
|
||||
{
|
||||
NMTTDISPINFOA *ttnmdi = (NMTTDISPINFOA*)lParam;
|
||||
NMHDR *hdr = (NMHDR *)lParam;
|
||||
RECT rect;
|
||||
|
||||
if (ttnmdi->hdr.code == TTN_GETDISPINFOA)
|
||||
if (hdr->code != NM_CUSTOMDRAW)
|
||||
{
|
||||
msg.message = message;
|
||||
msg.flags = sent|wparam|lparam;
|
||||
if (defwndproc_counter) msg.flags |= defwinproc;
|
||||
msg.wParam = wParam;
|
||||
msg.lParam = lParam;
|
||||
msg.id = hdr->code;
|
||||
add_message(sequences, PARENT_SEQ_INDEX, &msg);
|
||||
}
|
||||
|
||||
switch (hdr->code)
|
||||
{
|
||||
case TTN_GETDISPINFOA:
|
||||
lstrcpyA(ttnmdi->lpszText, testcallbackA);
|
||||
break;
|
||||
case TTN_SHOW:
|
||||
GetWindowRect(hdr->hwndFrom, &rect);
|
||||
ok(!EqualRect(&g_ttip_rect, &rect), "Unexpected window rectangle.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return DefWindowProcA(hwnd, message, wParam, lParam);
|
||||
defwndproc_counter++;
|
||||
if (IsWindowUnicode(hwnd))
|
||||
ret = DefWindowProcW(hwnd, message, wParam, lParam);
|
||||
else
|
||||
ret = DefWindowProcA(hwnd, message, wParam, lParam);
|
||||
defwndproc_counter--;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL register_parent_wnd_class(void)
|
||||
static void register_parent_wnd_class(void)
|
||||
{
|
||||
WNDCLASSA cls;
|
||||
BOOL ret;
|
||||
|
||||
cls.style = 0;
|
||||
cls.lpfnWndProc = parent_wnd_proc;
|
||||
@ -282,14 +334,12 @@ static BOOL register_parent_wnd_class(void)
|
||||
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
|
||||
cls.lpszMenuName = NULL;
|
||||
cls.lpszClassName = "Tooltips test parent class";
|
||||
return RegisterClassA(&cls);
|
||||
ret = RegisterClassA(&cls);
|
||||
ok(ret, "Failed to register test parent class.\n");
|
||||
}
|
||||
|
||||
static HWND create_parent_window(void)
|
||||
{
|
||||
if (!register_parent_wnd_class())
|
||||
return NULL;
|
||||
|
||||
return CreateWindowExA(0, "Tooltips test parent class",
|
||||
"Tooltips test parent window",
|
||||
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
|
||||
@ -439,7 +489,7 @@ todo_wine
|
||||
NULL, NULL, NULL, 0);
|
||||
ok(hwnd != NULL, "failed to create tooltip wnd\n");
|
||||
|
||||
toolinfoW.cbSize = sizeof(TTTOOLINFOW);
|
||||
toolinfoW.cbSize = TTTOOLINFOW_V2_SIZE + 1;
|
||||
toolinfoW.hwnd = NULL;
|
||||
toolinfoW.hinst = GetModuleHandleA(NULL);
|
||||
toolinfoW.uFlags = 0;
|
||||
@ -448,6 +498,9 @@ todo_wine
|
||||
toolinfoW.lParam = 0xdeadbeef;
|
||||
GetClientRect(hwnd, &toolinfoW.rect);
|
||||
r = SendMessageW(hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfoW);
|
||||
/* Wine currently checks for V3 structure size, which matches what V6 control does.
|
||||
Older implementation was never updated to support lpReserved field. */
|
||||
todo_wine
|
||||
ok(!r, "Adding the tool to the tooltip succeeded!\n");
|
||||
|
||||
if (0) /* crashes on NT4 */
|
||||
@ -879,7 +932,7 @@ static LRESULT CALLBACK info_wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void test_setinfo(void)
|
||||
static void test_setinfo(BOOL is_v6)
|
||||
{
|
||||
WNDCLASSA wc;
|
||||
LRESULT lResult;
|
||||
@ -971,7 +1024,8 @@ static void test_setinfo(void)
|
||||
toolInfo2.uId = 0x1234ABCD;
|
||||
lResult = SendMessageA(hwndTip, TTM_GETTOOLINFOA, 0, (LPARAM)&toolInfo2);
|
||||
ok(lResult, "GetToolInfo failed\n");
|
||||
ok(toolInfo2.uFlags & TTF_SUBCLASS, "uFlags does not have subclass\n");
|
||||
ok(toolInfo2.uFlags & TTF_SUBCLASS || broken(is_v6 && !(toolInfo2.uFlags & TTF_SUBCLASS)) /* XP */,
|
||||
"uFlags does not have subclass\n");
|
||||
wndProc = (WNDPROC)GetWindowLongPtrA(parent, GWLP_WNDPROC);
|
||||
ok (wndProc != info_wnd_proc, "Window Proc is wrong\n");
|
||||
|
||||
@ -1050,17 +1104,169 @@ static void test_margin(void)
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void test_TTM_ADDTOOL(BOOL is_v6)
|
||||
{
|
||||
static const WCHAR testW[] = {'T','e','s','t',0};
|
||||
TTTOOLINFOW tiW;
|
||||
TTTOOLINFOA ti;
|
||||
int ret, size;
|
||||
HWND hwnd, parent;
|
||||
UINT max_size;
|
||||
|
||||
parent = CreateWindowExA(0, "Static", NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, NULL, 0);
|
||||
ok(parent != NULL, "failed to create parent wnd\n");
|
||||
|
||||
hwnd = CreateWindowExA(WS_EX_TOPMOST, TOOLTIPS_CLASSA, NULL, TTS_NOPREFIX | TTS_ALWAYSTIP,
|
||||
0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0);
|
||||
ok(hwnd != NULL, "Failed to create tooltip window.\n");
|
||||
|
||||
for (size = 0; size <= TTTOOLINFOW_V3_SIZE + 1; size++)
|
||||
{
|
||||
ti.cbSize = size;
|
||||
ti.hwnd = NULL;
|
||||
ti.hinst = GetModuleHandleA(NULL);
|
||||
ti.uFlags = 0;
|
||||
ti.uId = 0x1234abce;
|
||||
ti.lpszText = (LPSTR)"Test";
|
||||
ti.lParam = 0xdeadbeef;
|
||||
GetClientRect(hwnd, &ti.rect);
|
||||
|
||||
ret = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti);
|
||||
ok(ret, "Failed to add a tool, size %d.\n", size);
|
||||
|
||||
ret = SendMessageA(hwnd, TTM_GETTOOLCOUNT, 0, 0);
|
||||
ok(ret == 1, "Unexpected tool count %d, size %d.\n", ret, size);
|
||||
|
||||
ret = SendMessageA(hwnd, TTM_DELTOOLA, 0, (LPARAM)&ti);
|
||||
ok(!ret, "Unexpected ret value %d.\n", ret);
|
||||
|
||||
ret = SendMessageA(hwnd, TTM_GETTOOLCOUNT, 0, 0);
|
||||
ok(ret == 0, "Unexpected tool count %d, size %d.\n", ret, size);
|
||||
}
|
||||
|
||||
/* W variant checks cbSize. */
|
||||
max_size = is_v6 ? TTTOOLINFOW_V3_SIZE : TTTOOLINFOW_V2_SIZE;
|
||||
for (size = 0; size <= max_size + 1; size++)
|
||||
{
|
||||
tiW.cbSize = size;
|
||||
tiW.hwnd = NULL;
|
||||
tiW.hinst = GetModuleHandleA(NULL);
|
||||
tiW.uFlags = 0;
|
||||
tiW.uId = 0x1234abce;
|
||||
tiW.lpszText = (LPWSTR)testW;
|
||||
tiW.lParam = 0xdeadbeef;
|
||||
GetClientRect(hwnd, &tiW.rect);
|
||||
|
||||
ret = SendMessageA(hwnd, TTM_ADDTOOLW, 0, (LPARAM)&tiW);
|
||||
todo_wine_if(!is_v6 && size > max_size)
|
||||
ok(size <= max_size ? ret : !ret, "%d: Unexpected ret value %d, size %d, max size %d.\n", is_v6, ret, size, max_size);
|
||||
if (ret)
|
||||
{
|
||||
ret = SendMessageA(hwnd, TTM_GETTOOLCOUNT, 0, 0);
|
||||
ok(ret == 1, "Unexpected tool count %d.\n", ret);
|
||||
|
||||
ret = SendMessageA(hwnd, TTM_DELTOOLA, 0, (LPARAM)&tiW);
|
||||
ok(!ret, "Unexpected ret value %d.\n", ret);
|
||||
|
||||
ret = SendMessageA(hwnd, TTM_GETTOOLCOUNT, 0, 0);
|
||||
ok(ret == 0, "Unexpected tool count %d.\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static const struct message ttn_show_parent_seq[] =
|
||||
{
|
||||
{ WM_NOTIFY, sent|id, 0, 0, TTN_SHOW },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void test_TTN_SHOW(void)
|
||||
{
|
||||
HWND hwndTip, hwnd;
|
||||
TTTOOLINFOA ti;
|
||||
RECT rect;
|
||||
BOOL ret;
|
||||
|
||||
hwnd = create_parent_window();
|
||||
ok(hwnd != NULL, "Failed to create parent window.\n");
|
||||
|
||||
/* Put cursor outside the window */
|
||||
GetWindowRect(hwnd, &rect);
|
||||
SetCursorPos(rect.right + 200, 0);
|
||||
|
||||
ShowWindow(hwnd, SW_SHOWNORMAL);
|
||||
flush_events(100);
|
||||
|
||||
/* Create tooltip */
|
||||
hwndTip = CreateWindowExA(WS_EX_TOPMOST, TOOLTIPS_CLASSA, NULL, TTS_ALWAYSTIP, 10, 10, 300, 300,
|
||||
hwnd, NULL, NULL, 0);
|
||||
ok(hwndTip != NULL, "Failed to create tooltip window.\n");
|
||||
|
||||
SetWindowPos(hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||
|
||||
ti.cbSize = sizeof(TTTOOLINFOA);
|
||||
ti.hwnd = hwnd;
|
||||
ti.hinst = GetModuleHandleA(NULL);
|
||||
ti.uFlags = TTF_SUBCLASS;
|
||||
ti.uId = 0x1234abcd;
|
||||
ti.lpszText = (LPSTR)"This is a test tooltip";
|
||||
ti.lParam = 0xdeadbeef;
|
||||
GetClientRect(hwnd, &ti.rect);
|
||||
ret = SendMessageA(hwndTip, TTM_ADDTOOLA, 0, (LPARAM)&ti);
|
||||
ok(ret, "Failed to add a tool.\n");
|
||||
|
||||
/* Make tooltip appear quickly */
|
||||
SendMessageA(hwndTip, TTM_SETDELAYTIME, TTDT_INITIAL, MAKELPARAM(1, 0));
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
/* Put cursor inside window, tooltip will appear immediately */
|
||||
GetWindowRect(hwnd, &rect);
|
||||
SetCursorPos((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2);
|
||||
flush_events(200);
|
||||
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, ttn_show_parent_seq, "TTN_SHOW parent seq", FALSE);
|
||||
|
||||
DestroyWindow(hwndTip);
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
START_TEST(tooltips)
|
||||
{
|
||||
InitCommonControls();
|
||||
ULONG_PTR ctx_cookie;
|
||||
HANDLE hCtx;
|
||||
|
||||
test_create_tooltip();
|
||||
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
LoadLibraryA("comctl32.dll");
|
||||
|
||||
register_parent_wnd_class();
|
||||
|
||||
test_create_tooltip(FALSE);
|
||||
test_customdraw();
|
||||
test_gettext();
|
||||
test_ttm_gettoolinfo();
|
||||
test_longtextA();
|
||||
test_longtextW();
|
||||
test_track();
|
||||
test_setinfo();
|
||||
test_setinfo(FALSE);
|
||||
test_margin();
|
||||
test_TTM_ADDTOOL(FALSE);
|
||||
test_TTN_SHOW();
|
||||
|
||||
if (!load_v6_module(&ctx_cookie, &hCtx))
|
||||
return;
|
||||
|
||||
test_create_tooltip(TRUE);
|
||||
test_customdraw();
|
||||
test_longtextW();
|
||||
test_track();
|
||||
test_setinfo(TRUE);
|
||||
test_margin();
|
||||
test_TTM_ADDTOOL(TRUE);
|
||||
test_TTN_SHOW();
|
||||
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
}
|
||||
|
@ -17,7 +17,13 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "msg.h"
|
||||
#include "v6util.h"
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
|
||||
#define NUM_MSG_SEQUENCE 2
|
||||
@ -1291,8 +1297,12 @@ static void test_create(void)
|
||||
|
||||
START_TEST(trackbar)
|
||||
{
|
||||
ULONG_PTR cookie;
|
||||
HANDLE ctxt;
|
||||
|
||||
LoadLibraryA("comctl32.dll");
|
||||
|
||||
init_msg_sequences(sequences, NUM_MSG_SEQUENCE);
|
||||
InitCommonControls();
|
||||
|
||||
/* create parent window */
|
||||
hWndParent = create_parent_window();
|
||||
@ -1319,5 +1329,25 @@ START_TEST(trackbar)
|
||||
test_ignore_selection();
|
||||
test_initial_state();
|
||||
|
||||
if (!load_v6_module(&cookie, &ctxt))
|
||||
return;
|
||||
|
||||
test_trackbar_buddy();
|
||||
test_line_size();
|
||||
test_page_size();
|
||||
test_position();
|
||||
test_range();
|
||||
test_selection();
|
||||
test_thumb_length();
|
||||
test_tic_settings();
|
||||
test_tic_placement();
|
||||
test_tool_tips();
|
||||
test_unicode();
|
||||
test_TBS_AUTOTICKS();
|
||||
test_ignore_selection();
|
||||
test_initial_state();
|
||||
|
||||
unload_v6_module(cookie, ctxt);
|
||||
|
||||
DestroyWindow(hWndParent);
|
||||
}
|
||||
|
@ -18,8 +18,22 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winnls.h"
|
||||
#include "winreg.h"
|
||||
#include "wine/commctrl.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
#include "msg.h"
|
||||
|
||||
static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
static const char *TEST_CALLBACK_TEXT = "callback_text";
|
||||
|
||||
static TVITEMA g_item_expanding, g_item_expanded;
|
||||
@ -1055,9 +1069,101 @@ static void test_get_set_textcolor(void)
|
||||
|
||||
static void test_get_set_tooltips(void)
|
||||
{
|
||||
HWND hwndLastToolTip = NULL;
|
||||
HWND hPopupTreeView;
|
||||
HWND hTree;
|
||||
HWND hTree, tooltips, hwnd;
|
||||
DWORD style;
|
||||
int i;
|
||||
|
||||
/* TVS_NOTOOLTIPS */
|
||||
hTree = create_treeview_control(TVS_NOTOOLTIPS);
|
||||
|
||||
tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
|
||||
ok(tooltips == NULL, "Unexpected tooltip window %p.\n", tooltips);
|
||||
|
||||
tooltips = (HWND)SendMessageA(hTree, TVM_SETTOOLTIPS, 0, 0);
|
||||
ok(tooltips == NULL, "Unexpected ret value %p.\n", tooltips);
|
||||
|
||||
/* Toggle style */
|
||||
style = GetWindowLongA(hTree, GWL_STYLE);
|
||||
SetWindowLongA(hTree, GWL_STYLE, style & ~TVS_NOTOOLTIPS);
|
||||
|
||||
tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
|
||||
ok(IsWindow(tooltips), "Unexpected tooltip window %p.\n", tooltips);
|
||||
|
||||
style = GetWindowLongA(hTree, GWL_STYLE);
|
||||
SetWindowLongA(hTree, GWL_STYLE, style | TVS_NOTOOLTIPS);
|
||||
|
||||
tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
|
||||
ok(tooltips == NULL, "Unexpected tooltip window %p.\n", tooltips);
|
||||
|
||||
DestroyWindow(hTree);
|
||||
|
||||
/* Set some valid window, does not have to be tooltips class. */
|
||||
hTree = create_treeview_control(TVS_NOTOOLTIPS);
|
||||
|
||||
hwnd = CreateWindowA(WC_STATICA, "Test", WS_VISIBLE|WS_CHILD, 5, 5, 100, 100, hMainWnd, NULL, NULL, 0);
|
||||
ok(hwnd != NULL, "Failed to create child window.\n");
|
||||
|
||||
tooltips = (HWND)SendMessageA(hTree, TVM_SETTOOLTIPS, (WPARAM)hwnd, 0);
|
||||
ok(tooltips == NULL, "Unexpected ret value %p.\n", tooltips);
|
||||
|
||||
tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
|
||||
ok(tooltips == hwnd, "Unexpected tooltip window %p.\n", tooltips);
|
||||
|
||||
/* Externally set tooltips window, disable style. */
|
||||
style = GetWindowLongA(hTree, GWL_STYLE);
|
||||
SetWindowLongA(hTree, GWL_STYLE, style & ~TVS_NOTOOLTIPS);
|
||||
|
||||
tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
|
||||
ok(IsWindow(tooltips) && tooltips != hwnd, "Unexpected tooltip window %p.\n", tooltips);
|
||||
ok(IsWindow(hwnd), "Expected valid window.\n");
|
||||
|
||||
style = GetWindowLongA(hTree, GWL_STYLE);
|
||||
SetWindowLongA(hTree, GWL_STYLE, style | TVS_NOTOOLTIPS);
|
||||
ok(!IsWindow(tooltips), "Unexpected tooltip window %p.\n", tooltips);
|
||||
|
||||
tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
|
||||
ok(tooltips == NULL, "Unexpected tooltip window %p.\n", tooltips);
|
||||
ok(IsWindow(hwnd), "Expected valid window.\n");
|
||||
|
||||
DestroyWindow(hTree);
|
||||
ok(IsWindow(hwnd), "Expected valid window.\n");
|
||||
|
||||
/* Set window, disable tooltips. */
|
||||
hTree = create_treeview_control(0);
|
||||
|
||||
tooltips = (HWND)SendMessageA(hTree, TVM_SETTOOLTIPS, (WPARAM)hwnd, 0);
|
||||
ok(IsWindow(tooltips), "Unexpected ret value %p.\n", tooltips);
|
||||
|
||||
style = GetWindowLongA(hTree, GWL_STYLE);
|
||||
SetWindowLongA(hTree, GWL_STYLE, style | TVS_NOTOOLTIPS);
|
||||
ok(!IsWindow(hwnd), "Unexpected tooltip window %p.\n", tooltips);
|
||||
ok(IsWindow(tooltips), "Expected valid window %p.\n", tooltips);
|
||||
|
||||
DestroyWindow(hTree);
|
||||
ok(IsWindow(tooltips), "Expected valid window %p.\n", tooltips);
|
||||
DestroyWindow(tooltips);
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
DWORD style = i == 0 ? 0 : TVS_NOTOOLTIPS;
|
||||
|
||||
hwnd = CreateWindowA(WC_STATICA, "Test", WS_VISIBLE|WS_CHILD, 5, 5, 100, 100, hMainWnd, NULL, NULL, 0);
|
||||
ok(hwnd != NULL, "Failed to create child window.\n");
|
||||
|
||||
hTree = create_treeview_control(style);
|
||||
|
||||
tooltips = (HWND)SendMessageA(hTree, TVM_SETTOOLTIPS, (WPARAM)hwnd, 0);
|
||||
ok(style & TVS_NOTOOLTIPS ? tooltips == NULL : IsWindow(tooltips), "Unexpected ret value %p.\n", tooltips);
|
||||
DestroyWindow(tooltips);
|
||||
|
||||
tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
|
||||
ok(tooltips == hwnd, "Unexpected tooltip window %p.\n", tooltips);
|
||||
|
||||
/* TreeView is destroyed, check if set window is still around. */
|
||||
DestroyWindow(hTree);
|
||||
ok(!IsWindow(hwnd), "Unexpected window.\n");
|
||||
}
|
||||
|
||||
hTree = create_treeview_control(0);
|
||||
fill_tree(hTree);
|
||||
@ -1065,20 +1171,23 @@ static void test_get_set_tooltips(void)
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
/* show even WS_POPUP treeview don't send NM_TOOLTIPSCREATED */
|
||||
hPopupTreeView = CreateWindowA(WC_TREEVIEWA, NULL, WS_POPUP|WS_VISIBLE, 0, 0, 100, 100,
|
||||
hwnd = CreateWindowA(WC_TREEVIEWA, NULL, WS_POPUP|WS_VISIBLE, 0, 0, 100, 100,
|
||||
hMainWnd, NULL, NULL, NULL);
|
||||
DestroyWindow(hPopupTreeView);
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
/* Testing setting a NULL ToolTip */
|
||||
SendMessageA(hTree, TVM_SETTOOLTIPS, 0, 0);
|
||||
hwndLastToolTip = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
|
||||
ok(hwndLastToolTip == NULL, "NULL tool tip, reported as 0x%p, expected 0.\n", hwndLastToolTip);
|
||||
tooltips = (HWND)SendMessageA(hTree, TVM_SETTOOLTIPS, 0, 0);
|
||||
ok(IsWindow(tooltips), "Unexpected ret value %p.\n", tooltips);
|
||||
|
||||
hwnd = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
|
||||
ok(hwnd == NULL, "Unexpected tooltip window %p.\n", hwnd);
|
||||
|
||||
ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_tooltips_seq,
|
||||
"test get set tooltips", TRUE);
|
||||
|
||||
/* TODO: Add a test of an actual tooltip */
|
||||
DestroyWindow(hTree);
|
||||
ok(IsWindow(tooltips), "Expected valid window.\n");
|
||||
DestroyWindow(tooltips);
|
||||
}
|
||||
|
||||
static void test_get_set_unicodeformat(void)
|
||||
@ -1328,9 +1437,6 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam,
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
}
|
||||
|
||||
defwndproc_counter++;
|
||||
@ -2653,27 +2759,27 @@ static void test_right_click(void)
|
||||
DestroyWindow(hTree);
|
||||
}
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
X(InitCommonControlsEx);
|
||||
#undef X
|
||||
}
|
||||
|
||||
START_TEST(treeview)
|
||||
{
|
||||
HMODULE hComctl32;
|
||||
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
WNDCLASSA wc;
|
||||
MSG msg;
|
||||
|
||||
INITCOMMONCONTROLSEX iccex;
|
||||
ULONG_PTR ctx_cookie;
|
||||
HANDLE hCtx;
|
||||
|
||||
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();
|
||||
WNDCLASSA wc;
|
||||
|
||||
init_functions();
|
||||
|
||||
iccex.dwSize = sizeof(iccex);
|
||||
iccex.dwICC = ICC_TREEVIEW_CLASSES;
|
||||
pInitCommonControlsEx(&iccex);
|
||||
|
||||
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
init_msg_sequences(item_sequence, 1);
|
||||
@ -2740,16 +2846,31 @@ START_TEST(treeview)
|
||||
|
||||
/* comctl32 version 6 tests start here */
|
||||
g_v6 = TRUE;
|
||||
|
||||
test_fillroot();
|
||||
test_getitemtext();
|
||||
test_get_set_insertmark();
|
||||
test_get_set_item();
|
||||
test_get_set_scrolltime();
|
||||
test_get_set_textcolor();
|
||||
test_get_linecolor();
|
||||
test_get_insertmarkcolor();
|
||||
test_expandedimage();
|
||||
test_get_set_tooltips();
|
||||
test_get_set_unicodeformat();
|
||||
test_expandinvisible();
|
||||
test_itemedit();
|
||||
test_treeview_classinfo();
|
||||
test_delete_items();
|
||||
test_cchildren();
|
||||
test_htreeitem_layout();
|
||||
test_TVM_GETNEXTITEM();
|
||||
test_TVM_HITTEST();
|
||||
test_WM_GETDLGCODE();
|
||||
test_customdraw();
|
||||
test_WM_KEYDOWN();
|
||||
test_TVS_FULLROWSELECT();
|
||||
test_TVM_SORTCHILDREN();
|
||||
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
|
||||
PostMessageA(hMainWnd, WM_CLOSE, 0, 0);
|
||||
while(GetMessageA(&msg, 0, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessageA(&msg);
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,12 @@
|
||||
* - more stuff to test
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "msg.h"
|
||||
|
||||
#define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
|
||||
|
||||
@ -58,6 +63,8 @@
|
||||
|
||||
static HWND parent_wnd, g_edit;
|
||||
|
||||
static HWND (WINAPI *pCreateUpDownControl)(DWORD, INT, INT, INT, INT,
|
||||
HWND, INT, HINSTANCE, HWND, INT, INT, INT);
|
||||
static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR);
|
||||
|
||||
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
|
||||
@ -877,7 +884,7 @@ static void test_CreateUpDownControl(void)
|
||||
RECT rect;
|
||||
|
||||
GetClientRect(parent_wnd, &rect);
|
||||
updown = CreateUpDownControl(WS_CHILD | WS_BORDER | WS_VISIBLE,
|
||||
updown = pCreateUpDownControl(WS_CHILD | WS_BORDER | WS_VISIBLE,
|
||||
0, 0, rect.right, rect.bottom, parent_wnd, 1, GetModuleHandleA(NULL), g_edit, 100, 10, 50);
|
||||
ok(updown != NULL, "Failed to create control.\n");
|
||||
|
||||
@ -893,13 +900,22 @@ static void test_CreateUpDownControl(void)
|
||||
DestroyWindow(updown);
|
||||
}
|
||||
|
||||
static void init_functions(void)
|
||||
{
|
||||
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
|
||||
|
||||
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
|
||||
#define X2(f, ord) p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
|
||||
X(CreateUpDownControl);
|
||||
X2(SetWindowSubclass, 410);
|
||||
#undef X
|
||||
#undef X2
|
||||
}
|
||||
|
||||
START_TEST(updown)
|
||||
{
|
||||
HMODULE mod = GetModuleHandleA("comctl32.dll");
|
||||
init_functions();
|
||||
|
||||
pSetWindowSubclass = (void*)GetProcAddress(mod, (LPSTR)410);
|
||||
|
||||
InitCommonControls();
|
||||
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
parent_wnd = create_parent_window();
|
||||
|
@ -22,8 +22,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
|
||||
|
||||
#ifdef __i386__
|
||||
#define ARCH "x86"
|
||||
#elif defined __x86_64__
|
||||
@ -64,48 +62,20 @@ static const CHAR manifest[] =
|
||||
|
||||
static inline void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
|
||||
{
|
||||
HANDLE hKernel32;
|
||||
BOOL (WINAPI *pDeactivateActCtx)(DWORD, ULONG_PTR);
|
||||
VOID (WINAPI *pReleaseActCtx)(HANDLE);
|
||||
|
||||
hKernel32 = GetModuleHandleA("kernel32.dll");
|
||||
pDeactivateActCtx = (void*)GetProcAddress(hKernel32, "DeactivateActCtx");
|
||||
pReleaseActCtx = (void*)GetProcAddress(hKernel32, "ReleaseActCtx");
|
||||
if (!pDeactivateActCtx || !pReleaseActCtx)
|
||||
{
|
||||
win_skip("Activation contexts unsupported\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pDeactivateActCtx(0, cookie);
|
||||
pReleaseActCtx(hCtx);
|
||||
DeactivateActCtx(0, cookie);
|
||||
ReleaseActCtx(hCtx);
|
||||
|
||||
DeleteFileA(manifest_name);
|
||||
}
|
||||
|
||||
static inline BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
|
||||
{
|
||||
HANDLE hKernel32;
|
||||
HANDLE (WINAPI *pCreateActCtxA)(ACTCTXA*);
|
||||
BOOL (WINAPI *pActivateActCtx)(HANDLE, ULONG_PTR*);
|
||||
BOOL (WINAPI *pFindActCtxSectionStringA)(DWORD,const GUID *,ULONG,LPCSTR,PACTCTX_SECTION_KEYED_DATA);
|
||||
|
||||
ACTCTX_SECTION_KEYED_DATA data;
|
||||
|
||||
ACTCTXA ctx;
|
||||
BOOL ret;
|
||||
HANDLE file;
|
||||
DWORD written;
|
||||
|
||||
hKernel32 = GetModuleHandleA("kernel32.dll");
|
||||
pCreateActCtxA = (void*)GetProcAddress(hKernel32, "CreateActCtxA");
|
||||
pActivateActCtx = (void*)GetProcAddress(hKernel32, "ActivateActCtx");
|
||||
pFindActCtxSectionStringA = (void*)GetProcAddress(hKernel32, "FindActCtxSectionStringA");
|
||||
if (!(pCreateActCtxA && pActivateActCtx))
|
||||
{
|
||||
win_skip("Activation contexts unsupported. No version 6 tests possible.\n");
|
||||
return FALSE;
|
||||
}
|
||||
HMODULE hmod;
|
||||
ACTCTXA ctx;
|
||||
HANDLE file;
|
||||
BOOL ret;
|
||||
|
||||
/* create manifest */
|
||||
file = CreateFileA( manifest_name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
|
||||
@ -133,11 +103,13 @@ static inline BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
|
||||
ctx.cbSize = sizeof(ctx);
|
||||
ctx.lpSource = manifest_name;
|
||||
|
||||
*hCtx = pCreateActCtxA(&ctx);
|
||||
*hCtx = CreateActCtxA(&ctx);
|
||||
ok(*hCtx != 0, "Expected context handle\n");
|
||||
|
||||
ret = pActivateActCtx(*hCtx, pcookie);
|
||||
expect(TRUE, ret);
|
||||
hmod = GetModuleHandleA("comctl32.dll");
|
||||
|
||||
ret = ActivateActCtx(*hCtx, pcookie);
|
||||
ok(ret, "Failed to activate context, error %d.\n", GetLastError());
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
@ -146,14 +118,16 @@ static inline BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
|
||||
}
|
||||
|
||||
data.cbSize = sizeof(data);
|
||||
ret = pFindActCtxSectionStringA(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
|
||||
ret = FindActCtxSectionStringA(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
|
||||
"comctl32.dll", &data);
|
||||
ok(ret, "failed to find comctl32.dll in active context, %u\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
FreeLibrary(hmod);
|
||||
LoadLibraryA("comctl32.dll");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef expect
|
||||
#undef ARCH
|
||||
|
Loading…
Reference in New Issue
Block a user