scrrun: Implement Item() property for dictionary.
This commit is contained in:
parent
7727a48595
commit
1bc4c57e55
|
@ -316,22 +316,34 @@ static HRESULT WINAPI dictionary_putref_Item(IDictionary *iface, VARIANT *Key, V
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI dictionary_put_Item(IDictionary *iface, VARIANT *Key, VARIANT *pRetItem)
|
static HRESULT WINAPI dictionary_put_Item(IDictionary *iface, VARIANT *key, VARIANT *item)
|
||||||
{
|
{
|
||||||
dictionary *This = impl_from_IDictionary(iface);
|
dictionary *This = impl_from_IDictionary(iface);
|
||||||
|
struct keyitem_pair *pair;
|
||||||
|
|
||||||
FIXME("(%p)->(%p %p)\n", This, Key, pRetItem);
|
TRACE("(%p)->(%s %s)\n", This, debugstr_variant(key), debugstr_variant(item));
|
||||||
|
|
||||||
return E_NOTIMPL;
|
if ((pair = get_keyitem_pair(This, key)))
|
||||||
|
return VariantCopyInd(&pair->item, item);
|
||||||
|
|
||||||
|
return IDictionary_Add(iface, key, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI dictionary_get_Item(IDictionary *iface, VARIANT *Key, VARIANT *pRetItem)
|
static HRESULT WINAPI dictionary_get_Item(IDictionary *iface, VARIANT *key, VARIANT *item)
|
||||||
{
|
{
|
||||||
dictionary *This = impl_from_IDictionary(iface);
|
dictionary *This = impl_from_IDictionary(iface);
|
||||||
|
struct keyitem_pair *pair;
|
||||||
|
|
||||||
FIXME("(%p)->(%p %p)\n", This, Key, pRetItem );
|
TRACE("(%p)->(%s %p)\n", This, debugstr_variant(key), item);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
if ((pair = get_keyitem_pair(This, key)))
|
||||||
|
VariantCopy(item, &pair->item);
|
||||||
|
else {
|
||||||
|
VariantInit(item);
|
||||||
|
return IDictionary_Add(iface, key, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI dictionary_Add(IDictionary *iface, VARIANT *key, VARIANT *item)
|
static HRESULT WINAPI dictionary_Add(IDictionary *iface, VARIANT *key, VARIANT *item)
|
||||||
|
|
|
@ -574,6 +574,34 @@ todo_wine
|
||||||
IDictionary_Release(dict);
|
IDictionary_Release(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_Item(void)
|
||||||
|
{
|
||||||
|
VARIANT key, item;
|
||||||
|
IDictionary *dict;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||||
|
&IID_IDictionary, (void**)&dict);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
V_VT(&key) = VT_I2;
|
||||||
|
V_I2(&key) = 10;
|
||||||
|
V_VT(&item) = VT_I2;
|
||||||
|
V_I2(&item) = 123;
|
||||||
|
hr = IDictionary_get_Item(dict, &key, &item);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
ok(V_VT(&item) == VT_EMPTY, "got %d\n", V_VT(&item));
|
||||||
|
|
||||||
|
V_VT(&key) = VT_I2;
|
||||||
|
V_I2(&key) = 10;
|
||||||
|
V_VT(&item) = VT_I2;
|
||||||
|
hr = IDictionary_get_Item(dict, &key, &item);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
ok(V_VT(&item) == VT_EMPTY, "got %d\n", V_VT(&item));
|
||||||
|
|
||||||
|
IDictionary_Release(dict);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(dictionary)
|
START_TEST(dictionary)
|
||||||
{
|
{
|
||||||
IDispatch *disp;
|
IDispatch *disp;
|
||||||
|
@ -596,6 +624,7 @@ START_TEST(dictionary)
|
||||||
test_Exists();
|
test_Exists();
|
||||||
test_Keys();
|
test_Keys();
|
||||||
test_Remove();
|
test_Remove();
|
||||||
|
test_Item();
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue