47 &IID_IAutoComplete, (
void **)&ac);
50 win_skip(
"CLSID_AutoComplete is not registered\n");
53 ok(
hr ==
S_OK,
"no IID_IAutoComplete (0x%08x)\n",
hr);
57 &IID_IACList, (
void **)&acSource);
60 win_skip(
"CLSID_ACLMulti is not registered\n");
61 IAutoComplete_Release(ac);
64 ok(
hr ==
S_OK,
"no IID_IACList (0x%08x)\n",
hr);
66 edit_control =
CreateWindowExA(0,
"EDIT",
"Some text", 0, 10, 10, 300, 300,
68 ok(edit_control !=
NULL,
"Can't create edit control\n");
74 "Init returned 0x%08x\n",
hr);
79 IUnknown_AddRef(acSource);
80 ref = IUnknown_Release(acSource);
81 ok(
ref == 1,
"Expected AutoComplete source refcount to be 1, got %d\n",
ref);
90 hr = IAutoComplete_Init(ac, (
HWND)0xdeadbeef, acSource,
NULL,
NULL);
102 hr = IAutoComplete_Init(ac, edit_control, acSource,
NULL,
NULL);
109 "Init returned 0x%08x\n",
hr);
114 "Init returned 0x%08x\n",
hr);
119 "Init returned 0x%08x\n",
hr);
122 hr = IAutoComplete_Init(ac, edit_control, acSource,
NULL,
NULL);
136 "Init returned 0x%08x\n",
hr);
138 IUnknown_Release(acSource);
139 IAutoComplete_Release(ac);
150 &IID_IAutoComplete, (
LPVOID*)&ac);
153 win_skip(
"CLSID_AutoComplete is not registered\n");
156 ok(
r ==
S_OK,
"no IID_IAutoComplete (0x%08x)\n",
r);
160 &IID_IACList, (
LPVOID*)&acSource);
163 win_skip(
"CLSID_ACLMulti is not registered\n");
164 IAutoComplete_Release(ac);
167 ok(
r ==
S_OK,
"no IID_IACList (0x%08x)\n",
r);
170 ok(user_data == 0,
"Expected the edit control user data to be zero\n");
174 ok(
r ==
S_OK,
"Init returned 0x%08x\n",
r);
177 ok(user_data == 0,
"Expected the edit control user data to be zero\n");
181 &IID_IAutoComplete, (
LPVOID*)&ac2);
182 ok(
r ==
S_OK,
"no IID_IAutoComplete (0x%08x)\n",
r);
185 ok(
r ==
S_OK,
"Init returned 0x%08x\n",
r);
186 IAutoComplete_Release(ac2);
188 IUnknown_Release(acSource);
429 object = heap_alloc_zero(
sizeof(*
object));
433 object->data = suggestions;
434 object->data_len =
count;
437 *
ppv = &
object->IEnumString_iface;
453#define check_dropdown(acdropdown, hwnd_edit, list, list_num) check_dropdown_(__FILE__, __LINE__, acdropdown, hwnd_edit, list, list_num)
461 hr = IAutoCompleteDropDown_GetDropDownStatus(acdropdown, &
flags, &
str);
464 if (list_num)
ok_(
file,
line)(
flags & ACDD_VISIBLE,
"AutoComplete DropDown not visible\n");
467 ok_(
file,
line)(!(
flags & ACDD_VISIBLE),
"AutoComplete DropDown visible\n");
477 for (
i = 0;
i <= list_num;
i++)
482 hr = IAutoCompleteDropDown_GetDropDownStatus(acdropdown, &
flags, &
str);
484 ok_(
file,
line)(
flags & ACDD_VISIBLE,
"AutoComplete DropDown not visible\n");
500 static WCHAR str1[] = {
't',
'e',
's',
't',0};
501 static WCHAR str1a[] = {
't',
'e',
's',
't',
'\\',0};
502 static WCHAR str2[] = {
't',
'e',
's',
't',
'\\',
'f',
'o',
'o',
'\\',
'b',
'a',
'r',
'\\',
'b',
'a',0};
503 static WCHAR str2a[] = {
't',
'e',
's',
't',
'\\',
'f',
'o',
'o',
'\\',
'b',
'a',
'r',
'\\',0};
504 static WCHAR str2b[] = {
't',
'e',
's',
't',
'\\',
'f',
'o',
'o',
'\\',
'b',
'a',
'r',
'\\',
'b',
'a',
'z',
'_',
'b',
'b',
'q',
'\\',0};
508 ok(
obj->num_expand == 0,
"Expected 0 expansions, got %u\n",
obj->num_expand);
513 ok(
obj->num_expand == 1,
"Expected 1 expansion, got %u\n",
obj->num_expand);
515 ok(
obj->num_resets == 1,
"Expected 1 reset, got %u\n",
obj->num_resets);
520 ok(
obj->num_expand == 2,
"Expected 2 expansions, got %u\n",
obj->num_expand);
522 ok(
obj->num_resets == 2,
"Expected 2 resets, got %u\n",
obj->num_resets);
531 ok(
obj->num_expand == 2,
"Expected 2 expansions, got %u\n",
obj->num_expand);
532 ok(
obj->num_resets == 2,
"Expected 2 resets, got %u\n",
obj->num_resets);
535 ok(
obj->num_expand == 3,
"Expected 3 expansions, got %u\n",
obj->num_expand);
537 ok(
obj->num_resets == 3,
"Expected 3 resets, got %u\n",
obj->num_resets);
542 ok(
obj->num_expand == 4,
"Expected 4 expansions, got %u\n",
obj->num_expand);
544 ok(
obj->num_resets == 4,
"Expected 4 resets, got %u\n",
obj->num_resets);
548 ok(
obj->num_expand == 4,
"Expected 4 expansions, got %u\n",
obj->num_expand);
549 ok(
obj->num_resets == 5,
"Expected 5 resets, got %u\n",
obj->num_resets);
554 ok(
obj->num_expand == 5,
"Expected 5 expansions, got %u\n",
obj->num_expand);
556 ok(
obj->num_resets == 6,
"Expected 6 resets, got %u\n",
obj->num_resets);
557 hr = IAutoCompleteDropDown_ResetEnumerator(acdropdown);
558 ok(
hr ==
S_OK,
"IAutoCompleteDropDown_ResetEnumerator failed: %x\n",
hr);
561 ok(
obj->num_expand == 6,
"Expected 6 expansions, got %u\n",
obj->num_expand);
563 ok(
obj->num_resets == 7,
"Expected 7 resets, got %u\n",
obj->num_resets);
568 static WCHAR htt[] = {
'h',
't',
't',0};
569 static WCHAR www[] = {
'w',
'w',
'w',
'.',0};
570 static WCHAR str0[] = {
'w',
'w',
'w',
'.',
'a',
'x',0};
571 static WCHAR str1[] = {
'h',
't',
't',
'p',
's',
':',
'/',
'/',
'w',
'w',
'w',
'.',
'a',
'c',0};
572 static WCHAR str2[] = {
'a',
'a',0};
573 static WCHAR str3[] = {
'a',
'b',0};
574 static WCHAR str4[] = {
'h',
't',
't',
'p',
':',
'/',
'/',
'a',
'0',0};
575 static WCHAR str5[] = {
'h',
't',
't',
'p',
's',
':',
'/',
'/',
'h',
't',
'a',0};
576 static WCHAR str6[] = {
'h',
'f',
'o',
'o',0};
577 static WCHAR str7[] = {
'h',
't',
't',
'p',
':',
'/',
'/',
'w',
'w',
'w',
'.',
'a',
'd',
'd',0};
578 static WCHAR str8[] = {
'w',
'w',
'w',
'.',
'w',
'w',
'w',
'.',
'?',0};
579 static WCHAR str9[] = {
'h',
't',
't',
'p',
':',
'/',
'/',
'a',
'b',
'c',
'.',
'a',
'a',
'.',
'c',
'o',
'm',0};
580 static WCHAR str10[]= {
'f',
't',
'p',
':',
'/',
'/',
'a',
'b',
'c',0};
581 static WCHAR str11[]= {
'f',
'i',
'l',
'e',
':',
'/',
'/',
'a',
'a',0};
582 static WCHAR str12[]= {
'f',
't',
'p',
':',
'/',
'/',
'w',
'w',
'w',
'.',
'a',
'a',0};
583 static WCHAR *suggestions[] = { str0, str1, str2, str3, str4, str5, str6, str7, str8, str9, str10, str11, str12 };
584 static WCHAR *sorted1[] = { str4, str2, str3, str9, str1, str7, str0 };
585 static WCHAR *sorted2[] = { str3, str9 };
586 static WCHAR *sorted3[] = { str1, str7, str0 };
587 static WCHAR *sorted4[] = { str6, str5 };
588 static WCHAR *sorted5[] = { str5 };
589 static WCHAR *sorted6[] = { str4, str9 };
590 static WCHAR *sorted7[] = { str11, str10, str12 };
597 hr =
CoCreateInstance(&CLSID_AutoComplete,
NULL, CLSCTX_INPROC_SERVER, &IID_IAutoComplete2, (
void**)&autocomplete);
598 ok(
hr ==
S_OK,
"CoCreateInstance failed: %x\n",
hr);
600 hr = IAutoComplete2_QueryInterface(autocomplete, &IID_IAutoCompleteDropDown, (
LPVOID*)&acdropdown);
601 ok(
hr ==
S_OK,
"No IAutoCompleteDropDown interface: %x\n",
hr);
605 hr = IAutoComplete2_SetOptions(autocomplete, ACO_FILTERPREFIXES | ACO_AUTOSUGGEST | ACO_AUTOAPPEND);
606 ok(
hr ==
S_OK,
"IAutoComplete2_SetOptions failed: %x\n",
hr);
607 hr = IAutoComplete2_Init(autocomplete, hwnd_edit, enumerator,
NULL,
NULL);
608 ok(
hr ==
S_OK,
"IAutoComplete_Init failed: %x\n",
hr);
687 IAutoCompleteDropDown_Release(acdropdown);
688 IAutoComplete2_Release(autocomplete);
689 IUnknown_Release(enumerator);
694 static WCHAR str_alpha[] = {
't',
'e',
's',
't',
'1',0};
695 static WCHAR str_alpha2[] = {
't',
'e',
's',
't',
'2',0};
696 static WCHAR str_beta[] = {
'a',
'u',
't',
'o',
' ',
'c',
'o',
'm',
'p',
'l',
'e',
't',
'e',0};
697 static WCHAR str_au[] = {
'a',
'u',0};
698 static WCHAR str_aut[] = {
'a',
'u',
't',0};
699 static WCHAR *suggestions[] = { str_alpha, str_alpha2, str_beta };
711 hwnd_edit =
CreateWindowA(
"Edit",
"",
WS_OVERLAPPED |
WS_VISIBLE |
WS_CHILD |
WS_BORDER, 50, 5, 200, 20,
hMainWnd, 0,
NULL, 0);
713 hr =
CoCreateInstance(&CLSID_AutoComplete,
NULL, CLSCTX_INPROC_SERVER, &IID_IAutoComplete2, (
void**)&autocomplete);
714 ok(
hr ==
S_OK,
"CoCreateInstance failed: %x\n",
hr);
716 hr = IAutoComplete2_QueryInterface(autocomplete, &IID_IAutoCompleteDropDown, (
LPVOID*)&acdropdown);
717 ok(
hr ==
S_OK,
"No IAutoCompleteDropDown interface: %x\n",
hr);
722 hr = IAutoComplete2_SetOptions(autocomplete, ACO_AUTOSUGGEST | ACO_AUTOAPPEND);
723 ok(
hr ==
S_OK,
"IAutoComplete2_SetOptions failed: %x\n",
hr);
724 hr = IAutoCompleteDropDown_ResetEnumerator(acdropdown);
725 ok(
hr ==
S_OK,
"IAutoCompleteDropDown_ResetEnumerator failed: %x\n",
hr);
726 hr = IAutoComplete2_Init(autocomplete, hwnd_edit, enumerator,
NULL,
NULL);
727 ok(
hr ==
S_OK,
"IAutoComplete_Init failed: %x\n",
hr);
735 ok(
obj->num_resets == 1,
"Expected 1 reset, got %u\n",
obj->num_resets);
741 ok(
obj->num_resets == 1,
"Expected 1 reset, got %u\n",
obj->num_resets);
742 hr = IAutoCompleteDropDown_ResetEnumerator(acdropdown);
743 ok(
hr ==
S_OK,
"IAutoCompleteDropDown_ResetEnumerator failed: %x\n",
hr);
744 ok(
obj->num_resets == 1,
"Expected 1 reset, got %u\n",
obj->num_resets);
758 ok(
obj->num_resets == 1,
"Expected 1 reset, got %u\n",
obj->num_resets);
764 hr = IAutoCompleteDropDown_ResetEnumerator(acdropdown);
765 ok(
hr ==
S_OK,
"IAutoCompleteDropDown_ResetEnumerator failed: %x\n",
hr);
774 ok(
obj->num_resets == 2,
"Expected 2 resets, got %u\n",
obj->num_resets);
777 hr = IAutoCompleteDropDown_GetDropDownStatus(acdropdown, &
flags,
NULL);
778 ok(
hr ==
S_OK,
"IAutoCompleteDropDown_GetDropDownStatus failed: %x\n",
hr);
779 ok(
flags & ACDD_VISIBLE,
"AutoComplete DropDown should be visible\n");
782 hr = IAutoCompleteDropDown_GetDropDownStatus(acdropdown, &
flags,
NULL);
783 ok(
hr ==
S_OK,
"IAutoCompleteDropDown_GetDropDownStatus failed: %x\n",
hr);
784 ok(!(
flags & ACDD_VISIBLE),
"AutoComplete DropDown should have been hidden\n");
787 hr = IAutoCompleteDropDown_GetDropDownStatus(acdropdown, &
flags,
NULL);
788 ok(
hr ==
S_OK,
"IAutoCompleteDropDown_GetDropDownStatus failed: %x\n",
hr);
789 ok(!(
flags & ACDD_VISIBLE),
"AutoComplete DropDown should be hidden\n");
796 hr = IAutoCompleteDropDown_ResetEnumerator(acdropdown);
797 ok(
hr ==
S_OK,
"IAutoCompleteDropDown_ResetEnumerator failed: %x\n",
hr);
800 ok(
obj->num_resets == 1,
"Expected 1 reset, got %u\n",
obj->num_resets);
803 ok(
obj->num_resets == 1,
"Expected 1 reset, got %u\n",
obj->num_resets);
805 IAutoCompleteDropDown_Release(acdropdown);
806 IAutoComplete2_Release(autocomplete);
807 IUnknown_Release(enumerator);
824 ok(
r ==
S_OK,
"CoInitialize failed (0x%08x). Tests aborted.\n",
r);
829 ok(
hMainWnd !=
NULL,
"Failed to create parent window. Tests aborted.\n");
851 IAutoComplete_Release(ac);
static BOOL heap_free(void *mem)
#define InterlockedIncrement
#define InterlockedDecrement
static BOOL expand(LPINT ac, LPTSTR **arg, LPCTSTR pattern)
static TestACL * impl_from_IACList(IACList *iface)
static TestACL * impl_from_IEnumString(IEnumString *iface)
static void cleanup(void)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLsizei const GLchar *const * strings
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
VOID WINAPI CoTaskMemFree(LPVOID ptr)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
#define memcpy(s1, s2, n)
const GUID IID_IEnumString
#define WS_OVERLAPPEDWINDOW
#define IsEqualGUID(rguid1, rguid2)
static HRESULT WINAPI string_enumerator_Clone(IEnumString *iface, IEnumString **out)
static ULONG WINAPI string_enumerator_AddRef(IEnumString *iface)
static void test_prefix_filtering(HWND hwnd_edit)
static HRESULT WINAPI string_enumerator_Skip(IEnumString *iface, ULONG num)
static IACListVtbl aclist_vtbl
static LRESULT CALLBACK HijackerWndProc2(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static HRESULT WINAPI string_enumerator_Next(IEnumString *iface, ULONG num, LPOLESTR *strings, ULONG *num_returned)
static WNDPROC HijackerWndProc_prev
static void test_invalid_init(void)
static HRESULT string_enumerator_create(void **ppv, WCHAR **suggestions, int count)
static HRESULT WINAPI string_enumerator_QueryInterface(IEnumString *iface, REFIID riid, void **ppv)
static void check_dropdown_(const char *file, UINT line, IAutoCompleteDropDown *acdropdown, HWND hwnd_edit, WCHAR **list, UINT list_num)
static void test_custom_source(void)
static void dispatch_messages(void)
static void createMainWnd(void)
static ULONG WINAPI aclist_AddRef(IACList *iface)
static void test_killfocus(void)
static int killfocus_count
static HRESULT WINAPI aclist_Expand(IACList *iface, const WCHAR *expand)
static ULONG WINAPI aclist_Release(IACList *iface)
static HRESULT WINAPI aclist_QueryInterface(IACList *iface, REFIID riid, void **ppv)
static void test_aclist_expand(HWND hwnd_edit, void *enumerator, IAutoCompleteDropDown *acdropdown)
static IEnumStringVtbl string_enumerator_vtbl
#define check_dropdown(acdropdown, hwnd_edit, list, list_num)
static IAutoComplete * test_init(void)
static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK HijackerWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static ULONG WINAPI string_enumerator_Release(IEnumString *iface)
static const WCHAR HijackerWndProc_txt[]
static HRESULT WINAPI string_enumerator_Reset(IEnumString *iface)
IEnumString IEnumString_iface
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
#define CONTAINING_RECORD(address, type, field)
#define REGDB_E_CLASSNOTREG
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
#define GetWindowLongPtrA
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
#define SetWindowLongPtrW
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL WINAPI DestroyWindow(_In_ HWND)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)