=?UTF-8?Q?Gabriel=20Iv=C4=83ncescu=20?=: shell32/tests: Add tests for ResetEnumerator.

Alexandre Julliard julliard at winehq.org
Thu Nov 8 14:47:25 CST 2018


Module: wine
Branch: master
Commit: 17213acd171b897a4d53a6bdaca22ac18b87b46c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=17213acd171b897a4d53a6bdaca22ac18b87b46c

Author: Gabriel Iv─âncescu <gabrielopcode at gmail.com>
Date:   Wed Nov  7 17:14:16 2018 +0200

shell32/tests: Add tests for ResetEnumerator.

Signed-off-by: Gabriel Iv─âncescu <gabrielopcode at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shell32/tests/autocomplete.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/dlls/shell32/tests/autocomplete.c b/dlls/shell32/tests/autocomplete.c
index 8265bf9..6921202 100644
--- a/dlls/shell32/tests/autocomplete.c
+++ b/dlls/shell32/tests/autocomplete.c
@@ -514,6 +514,7 @@ static void test_custom_source(void)
     struct string_enumerator *obj;
     IUnknown *enumerator;
     IAutoComplete2 *autocomplete;
+    IAutoCompleteDropDown *acdropdown;
     HWND hwnd_edit;
     WCHAR buffer[20];
     HRESULT hr;
@@ -525,11 +526,16 @@ static void test_custom_source(void)
     hr = CoCreateInstance(&CLSID_AutoComplete, NULL, CLSCTX_INPROC_SERVER, &IID_IAutoComplete2, (void**)&autocomplete);
     ok(hr == S_OK, "CoCreateInstance failed: %x\n", hr);
 
+    hr = IAutoComplete2_QueryInterface(autocomplete, &IID_IAutoCompleteDropDown, (LPVOID*)&acdropdown);
+    ok(hr == S_OK, "No IAutoCompleteDropDown interface: %x\n", hr);
+
     string_enumerator_create((void**)&enumerator, suggestions, ARRAY_SIZE(suggestions));
     obj = (struct string_enumerator*)enumerator;
 
     hr = IAutoComplete2_SetOptions(autocomplete, ACO_AUTOSUGGEST | ACO_AUTOAPPEND);
     ok(hr == S_OK, "IAutoComplete2_SetOptions failed: %x\n", hr);
+    hr = IAutoCompleteDropDown_ResetEnumerator(acdropdown);
+    ok(hr == S_OK, "IAutoCompleteDropDown_ResetEnumerator failed: %x\n", hr);
     hr = IAutoComplete2_Init(autocomplete, hwnd_edit, enumerator, NULL, NULL);
     ok(hr == S_OK, "IAutoComplete_Init failed: %x\n", hr);
 
@@ -546,6 +552,9 @@ static void test_custom_source(void)
     SendMessageW(hwnd_edit, WM_GETTEXT, ARRAY_SIZE(buffer), (LPARAM)buffer);
     ok(buffer[0] == '\0', "Expected empty string, got %s\n", wine_dbgstr_w(buffer));
     ok(obj->num_resets == 1, "Expected 1 reset, got %u\n", obj->num_resets);
+    hr = IAutoCompleteDropDown_ResetEnumerator(acdropdown);
+    ok(hr == S_OK, "IAutoCompleteDropDown_ResetEnumerator failed: %x\n", hr);
+    ok(obj->num_resets == 1, "Expected 1 reset, got %u\n", obj->num_resets);
     obj->num_resets = 0;
 
     /* hijack the window procedure */
@@ -565,6 +574,8 @@ static void test_custom_source(void)
     dispatch_messages();
     SendMessageW(hwnd_edit, WM_GETTEXT, ARRAY_SIZE(buffer), (LPARAM)buffer);
     ok(buffer[0] == '\0', "Expected empty string, got %s\n", wine_dbgstr_w(buffer));
+    hr = IAutoCompleteDropDown_ResetEnumerator(acdropdown);
+    ok(hr == S_OK, "IAutoCompleteDropDown_ResetEnumerator failed: %x\n", hr);
 
     HijackerWndProc_prev = (WNDPROC)SetWindowLongPtrW(hwnd_edit, GWLP_WNDPROC, (LONG_PTR)HijackerWndProc2);
     SendMessageW(hwnd_edit, WM_CHAR, 'a', 1);
@@ -577,6 +588,17 @@ static void test_custom_source(void)
     /* end of hijacks */
 
     test_aclist_expand(hwnd_edit, enumerator);
+    obj->num_resets = 0;
+
+    hr = IAutoCompleteDropDown_ResetEnumerator(acdropdown);
+    ok(hr == S_OK, "IAutoCompleteDropDown_ResetEnumerator failed: %x\n", hr);
+    SendMessageW(hwnd_edit, WM_CHAR, 'x', 1);
+    dispatch_messages();
+    ok(obj->num_resets == 1, "Expected 1 reset, got %u\n", obj->num_resets);
+    SendMessageW(hwnd_edit, WM_CHAR, 'x', 1);
+    dispatch_messages();
+    ok(obj->num_resets == 1, "Expected 1 reset, got %u\n", obj->num_resets);
+    IAutoCompleteDropDown_Release(acdropdown);
 
     ShowWindow(hMainWnd, SW_HIDE);
     DestroyWindow(hwnd_edit);




More information about the wine-cvs mailing list