Nikolay Sivov : scrrun: Implement Exists() method for dictionary.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 2 08:51:51 CST 2015


Module: wine
Branch: master
Commit: 9419e97c3e896c33987018cf65c59e8d211b4153
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9419e97c3e896c33987018cf65c59e8d211b4153

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Feb 27 18:18:13 2015 +0300

scrrun: Implement Exists() method for dictionary.

---

 dlls/scrrun/dictionary.c       | 10 +++++++---
 dlls/scrrun/tests/dictionary.c | 19 +++++++------------
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/dlls/scrrun/dictionary.c b/dlls/scrrun/dictionary.c
index 2306fad..7c776ee 100644
--- a/dlls/scrrun/dictionary.c
+++ b/dlls/scrrun/dictionary.c
@@ -368,13 +368,17 @@ static HRESULT WINAPI dictionary_get_Count(IDictionary *iface, LONG *count)
     return S_OK;
 }
 
-static HRESULT WINAPI dictionary_Exists(IDictionary *iface, VARIANT *Key, VARIANT_BOOL *pExists)
+static HRESULT WINAPI dictionary_Exists(IDictionary *iface, VARIANT *key, VARIANT_BOOL *exists)
 {
     dictionary *This = impl_from_IDictionary(iface);
 
-    FIXME("(%p)->(%p %p)\n", This, Key, pExists);
+    TRACE("(%p)->(%s %p)\n", This, debugstr_variant(key), exists);
 
-    return E_NOTIMPL;
+    if (!exists)
+        return CTL_E_ILLEGALFUNCTIONCALL;
+
+    *exists = get_keyitem_pair(This, key) != NULL ? VARIANT_TRUE : VARIANT_FALSE;
+    return S_OK;
 }
 
 static HRESULT WINAPI dictionary_Items(IDictionary *iface, VARIANT *pItemsArray)
diff --git a/dlls/scrrun/tests/dictionary.c b/dlls/scrrun/tests/dictionary.c
index deeea50..74ab7b9 100644
--- a/dlls/scrrun/tests/dictionary.c
+++ b/dlls/scrrun/tests/dictionary.c
@@ -69,16 +69,16 @@ static void test_interfaces(void)
 
     exists = VARIANT_FALSE;
     hr = IDictionary_Exists(dict, &key, &exists);
-    todo_wine ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
-    todo_wine ok(exists == VARIANT_TRUE, "Expected TRUE but got FALSE.\n");
+    ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
+    ok(exists == VARIANT_TRUE, "Expected TRUE but got FALSE.\n");
     VariantClear(&key);
 
     exists = VARIANT_TRUE;
     V_VT(&key) = VT_BSTR;
     V_BSTR(&key) = SysAllocString(key_non_exist);
     hr = IDictionary_Exists(dict, &key, &exists);
-    todo_wine ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
-    todo_wine ok(exists == VARIANT_FALSE, "Expected FALSE but got TRUE.\n");
+    ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
+    ok(exists == VARIANT_FALSE, "Expected FALSE but got TRUE.\n");
     VariantClear(&key);
 
     hr = IDictionary_get_Count(dict, &count);
@@ -442,17 +442,15 @@ if (0) /* crashes on native */
     V_VT(&key) = VT_I2;
     V_I2(&key) = 0;
     hr = IDictionary_Exists(dict, &key, NULL);
-todo_wine
     ok(hr == CTL_E_ILLEGALFUNCTIONCALL, "got 0x%08x\n", hr);
 
     V_VT(&key) = VT_I2;
     V_I2(&key) = 0;
     exists = VARIANT_TRUE;
     hr = IDictionary_Exists(dict, &key, &exists);
-todo_wine {
     ok(hr == S_OK, "got 0x%08x\n", hr);
     ok(exists == VARIANT_FALSE, "got %x\n", exists);
-}
+
     VariantInit(&item);
     hr = IDictionary_Add(dict, &key, &item);
     ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -465,26 +463,23 @@ todo_wine {
     V_VT(&key) = VT_I2;
     V_I2(&key) = 0;
     hr = IDictionary_Exists(dict, &key, NULL);
-todo_wine
     ok(hr == CTL_E_ILLEGALFUNCTIONCALL, "got 0x%08x\n", hr);
 
     V_VT(&key) = VT_I2;
     V_I2(&key) = 0;
     exists = VARIANT_FALSE;
     hr = IDictionary_Exists(dict, &key, &exists);
-todo_wine {
     ok(hr == S_OK, "got 0x%08x\n", hr);
     ok(exists == VARIANT_TRUE, "got %x\n", exists);
-}
+
     /* key of different type, but resolves to same hash value */
     V_VT(&key) = VT_R4;
     V_R4(&key) = 0.0;
     exists = VARIANT_FALSE;
     hr = IDictionary_Exists(dict, &key, &exists);
-todo_wine {
     ok(hr == S_OK, "got 0x%08x\n", hr);
     ok(exists == VARIANT_TRUE, "got %x\n", exists);
-}
+
     IDictionary_Release(dict);
 }
 




More information about the wine-cvs mailing list