scrrun: Store compare method for dictionary.

This commit is contained in:
Nikolay Sivov 2015-02-24 11:28:41 +03:00 committed by Alexandre Julliard
parent a8b000c54d
commit 075fe10ba5
2 changed files with 61 additions and 12 deletions

View File

@ -34,8 +34,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(scrrun);
typedef struct
{
IDictionary IDictionary_iface;
LONG ref;
CompareMethod method;
} dictionary;
static inline dictionary *impl_from_IDictionary(IDictionary *iface)
@ -260,22 +261,24 @@ static HRESULT WINAPI dictionary_RemoveAll(IDictionary *iface)
return E_NOTIMPL;
}
static HRESULT WINAPI dictionary_put_CompareMode(IDictionary *iface, CompareMethod pcomp)
static HRESULT WINAPI dictionary_put_CompareMode(IDictionary *iface, CompareMethod method)
{
dictionary *This = impl_from_IDictionary(iface);
FIXME("(%p)->()\n", This);
TRACE("(%p)->(%d)\n", This, method);
return E_NOTIMPL;
This->method = method;
return S_OK;
}
static HRESULT WINAPI dictionary_get_CompareMode(IDictionary *iface, CompareMethod *pcomp)
static HRESULT WINAPI dictionary_get_CompareMode(IDictionary *iface, CompareMethod *method)
{
dictionary *This = impl_from_IDictionary(iface);
FIXME("(%p)->(%p)\n", This, pcomp);
TRACE("(%p)->(%p)\n", This, method);
return E_NOTIMPL;
*method = This->method;
return S_OK;
}
static HRESULT WINAPI dictionary__NewEnum(IDictionary *iface, IUnknown **ppunk)
@ -336,6 +339,7 @@ HRESULT WINAPI Dictionary_CreateInstance(IClassFactory *factory,IUnknown *outer,
This->IDictionary_iface.lpVtbl = &dictionary_vtbl;
This->ref = 1;
This->method = BinaryCompare;
*obj = &This->IDictionary_iface;

View File

@ -44,10 +44,7 @@ static void test_interfaces(void)
hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IDispatch, (void**)&disp);
if(FAILED(hr)) {
win_skip("Could not create FileSystem object: %08x\n", hr);
return;
}
ok(hr == S_OK, "got 0x%08x\n", hr);
VariantInit(&key);
VariantInit(&value);
@ -91,12 +88,60 @@ static void test_interfaces(void)
IDispatch_Release(disp);
}
static void test_comparemode(void)
{
CompareMethod method;
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);
if (0) /* crashes on native */
hr = IDictionary_get_CompareMode(dict, NULL);
method = 10;
hr = IDictionary_get_CompareMode(dict, &method);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(method == BinaryCompare, "got %d\n", method);
/* invalid mode value is not checked */
hr = IDictionary_put_CompareMode(dict, 10);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDictionary_get_CompareMode(dict, &method);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(method == 10, "got %d\n", method);
hr = IDictionary_put_CompareMode(dict, DatabaseCompare);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDictionary_get_CompareMode(dict, &method);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(method == DatabaseCompare, "got %d\n", method);
IDictionary_Release(dict);
}
START_TEST(dictionary)
{
IDispatch *disp;
HRESULT hr;
CoInitialize(NULL);
test_interfaces();
hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IDispatch, (void**)&disp);
if(FAILED(hr)) {
win_skip("Dictionary object is not supported: %08x\n", hr);
CoUninitialize();
return;
}
IDispatch_Release(disp);
test_interfaces();
test_comparemode();
CoUninitialize();
}