scrrun/tests: Build without -DWINE_NO_LONG_TYPES.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
aea21ea244
commit
0190087e42
|
@ -1,4 +1,3 @@
|
|||
EXTRADEFS = -DWINE_NO_LONG_TYPES
|
||||
TESTDLL = scrrun.dll
|
||||
IMPORTS = ole32 shlwapi uuid oleaut32 user32
|
||||
|
||||
|
|
|
@ -40,13 +40,13 @@ static void _test_provideclassinfo(IDispatch *disp, const GUID *guid, int line)
|
|||
HRESULT hr;
|
||||
|
||||
hr = IDispatch_QueryInterface(disp, &IID_IProvideClassInfo, (void **)&classinfo);
|
||||
ok_(__FILE__,line) (hr == S_OK, "Failed to get IProvideClassInfo, %#x.\n", hr);
|
||||
ok_(__FILE__,line) (hr == S_OK, "Failed to get IProvideClassInfo, %#lx.\n", hr);
|
||||
|
||||
hr = IProvideClassInfo_GetClassInfo(classinfo, &ti);
|
||||
ok_(__FILE__,line) (hr == S_OK, "GetClassInfo() failed, %#x.\n", hr);
|
||||
ok_(__FILE__,line) (hr == S_OK, "GetClassInfo() failed, %#lx.\n", hr);
|
||||
|
||||
hr = ITypeInfo_GetTypeAttr(ti, &attr);
|
||||
ok_(__FILE__,line) (hr == S_OK, "GetTypeAttr() failed, %#x.\n", hr);
|
||||
ok_(__FILE__,line) (hr == S_OK, "GetTypeAttr() failed, %#lx.\n", hr);
|
||||
|
||||
ok_(__FILE__,line) (IsEqualGUID(&attr->guid, guid), "Unexpected typeinfo %s, expected %s\n", wine_dbgstr_guid(&attr->guid),
|
||||
wine_dbgstr_guid(guid));
|
||||
|
@ -74,19 +74,19 @@ static void test_interfaces(void)
|
|||
|
||||
hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||
&IID_IDispatch, (void**)&disp);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
VariantInit(&key);
|
||||
VariantInit(&value);
|
||||
|
||||
hr = IDispatch_QueryInterface(disp, &IID_IDictionary, (void**)&dict);
|
||||
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IDispatch_QueryInterface(disp, &IID_IObjectWithSite, (void**)&site);
|
||||
ok(hr == E_NOINTERFACE, "got 0x%08x, expected 0x%08x\n", hr, E_NOINTERFACE);
|
||||
ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
|
||||
ok(hr == E_NOINTERFACE, "got 0x%08x, expected 0x%08x\n", hr, E_NOINTERFACE);
|
||||
ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
test_provideclassinfo(disp, &CLSID_Dictionary);
|
||||
|
||||
|
@ -95,12 +95,12 @@ static void test_interfaces(void)
|
|||
V_VT(&value) = VT_BSTR;
|
||||
V_BSTR(&value) = SysAllocString(L"a");
|
||||
hr = IDictionary_Add(dict, &key, &value);
|
||||
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
VariantClear(&value);
|
||||
|
||||
exists = VARIANT_FALSE;
|
||||
hr = IDictionary_Exists(dict, &key, &exists);
|
||||
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(exists == VARIANT_TRUE, "Expected TRUE but got FALSE.\n");
|
||||
VariantClear(&key);
|
||||
|
||||
|
@ -108,13 +108,13 @@ static void test_interfaces(void)
|
|||
V_VT(&key) = VT_BSTR;
|
||||
V_BSTR(&key) = SysAllocString(L"b");
|
||||
hr = IDictionary_Exists(dict, &key, &exists);
|
||||
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(exists == VARIANT_FALSE, "Expected FALSE but got TRUE.\n");
|
||||
VariantClear(&key);
|
||||
|
||||
hr = IDictionary_get_Count(dict, &count);
|
||||
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
|
||||
ok(count == 1, "got %d, expected 1\n", count);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(count == 1, "Unexpected value %lu.\n", count);
|
||||
|
||||
IDictionary_Release(dict);
|
||||
IDispatch_Release(disp);
|
||||
|
@ -129,29 +129,29 @@ static void test_comparemode(void)
|
|||
|
||||
hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||
&IID_IDictionary, (void**)&dict);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\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(hr == S_OK, "Unexpected hr %#lx.\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);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IDictionary_get_CompareMode(dict, &method);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(method == 10, "got %d\n", method);
|
||||
|
||||
hr = IDictionary_put_CompareMode(dict, DatabaseCompare);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IDictionary_get_CompareMode(dict, &method);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(method == DatabaseCompare, "got %d\n", method);
|
||||
|
||||
/* try to change mode of a non-empty dict */
|
||||
|
@ -159,10 +159,10 @@ static void test_comparemode(void)
|
|||
V_I2(&key) = 0;
|
||||
VariantInit(&item);
|
||||
hr = IDictionary_Add(dict, &key, &item);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IDictionary_put_CompareMode(dict, BinaryCompare);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
IDictionary_Release(dict);
|
||||
}
|
||||
|
@ -356,58 +356,56 @@ static void test_hash_value(void)
|
|||
|
||||
hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||
&IID_IDictionary, (void**)&dict);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
V_VT(&key) = VT_BSTR;
|
||||
V_BSTR(&key) = NULL;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == 0, "got %d\n", V_I4(&hash));
|
||||
ok(!V_I4(&hash), "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(str_hash_tests); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(str_hash_tests); ++i)
|
||||
{
|
||||
expected = get_str_hash(str_hash_tests[i], BinaryCompare);
|
||||
|
||||
hr = IDictionary_put_CompareMode(dict, BinaryCompare);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
V_VT(&key) = VT_BSTR;
|
||||
V_BSTR(&key) = SysAllocString(str_hash_tests[i]);
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: binary mode: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: db mode: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
VariantClear(&key);
|
||||
|
||||
expected = get_str_hash(str_hash_tests[i], TextCompare);
|
||||
hr = IDictionary_put_CompareMode(dict, TextCompare);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
V_VT(&key) = VT_BSTR;
|
||||
V_BSTR(&key) = SysAllocString(str_hash_tests[i]);
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: text mode: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: db mode: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
VariantClear(&key);
|
||||
|
||||
expected = get_str_hash(str_hash_tests[i], DatabaseCompare);
|
||||
hr = IDictionary_put_CompareMode(dict, DatabaseCompare);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
V_VT(&key) = VT_BSTR;
|
||||
V_BSTR(&key) = SysAllocString(str_hash_tests[i]);
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: db mode: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: db mode: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
VariantClear(&key);
|
||||
}
|
||||
|
||||
|
@ -415,49 +413,49 @@ static void test_hash_value(void)
|
|||
V_INT(&key) = 1;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == ~0u, "got hash 0x%08x\n", V_I4(&hash));
|
||||
ok(V_I4(&hash) == ~0u, "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
V_VT(&key) = VT_UINT;
|
||||
V_UINT(&key) = 1;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == ~0u, "got hash 0x%08x\n", V_I4(&hash));
|
||||
ok(V_I4(&hash) == ~0u, "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
V_VT(&key) = VT_I1;
|
||||
V_I1(&key) = 1;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == ~0u || broken(V_I4(&hash) == 0xa1), "got hash 0x%08x\n", V_I4(&hash));
|
||||
ok(V_I4(&hash) == ~0u || broken(V_I4(&hash) == 0xa1), "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
V_VT(&key) = VT_I8;
|
||||
V_I8(&key) = 1;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == ~0u, "got hash 0x%08x\n", V_I4(&hash));
|
||||
ok(V_I4(&hash) == ~0u, "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
V_VT(&key) = VT_UI2;
|
||||
V_UI2(&key) = 1;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == ~0u, "got hash 0x%08x\n", V_I4(&hash));
|
||||
ok(V_I4(&hash) == ~0u, "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
V_VT(&key) = VT_UI4;
|
||||
V_UI4(&key) = 1;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == ~0u, "got hash 0x%08x\n", V_I4(&hash));
|
||||
ok(V_I4(&hash) == ~0u, "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(int_hash_tests); i++) {
|
||||
SHORT i2;
|
||||
|
@ -470,59 +468,53 @@ static void test_hash_value(void)
|
|||
V_I2(&key) = int_hash_tests[i];
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
|
||||
i2 = int_hash_tests[i];
|
||||
V_VT(&key) = VT_I2|VT_BYREF;
|
||||
V_I2REF(&key) = &i2;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
|
||||
V_VT(&key) = VT_I4;
|
||||
V_I4(&key) = int_hash_tests[i];
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
|
||||
i4 = int_hash_tests[i];
|
||||
V_VT(&key) = VT_I4|VT_BYREF;
|
||||
V_I4REF(&key) = &i4;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
|
||||
expected = get_num_hash((FLOAT)(BYTE)int_hash_tests[i]);
|
||||
V_VT(&key) = VT_UI1;
|
||||
V_UI1(&key) = int_hash_tests[i];
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
|
||||
ui1 = int_hash_tests[i];
|
||||
V_VT(&key) = VT_UI1|VT_BYREF;
|
||||
V_UI1REF(&key) = &ui1;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
}
|
||||
|
||||
/* nan */
|
||||
|
@ -533,10 +525,10 @@ static void test_hash_value(void)
|
|||
V_R4(&key) = fx4.f;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == ~0u || broken(V_I4(&hash) == 0 /* win2k */ ||
|
||||
V_I4(&hash) == 0x1f4 /* vista, win2k8 */), "got hash 0x%08x\n", V_I4(&hash));
|
||||
V_I4(&hash) == 0x1f4 /* vista, win2k8 */), "Unexpected hr %#lx.\n", V_I4(&hash));
|
||||
|
||||
/* inf */
|
||||
fx4.f = 10.0;
|
||||
|
@ -547,9 +539,9 @@ static void test_hash_value(void)
|
|||
V_R4(&key) = fx4.f;
|
||||
V_I4(&hash) = 10;
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == 0, "got hash 0x%08x\n", V_I4(&hash));
|
||||
ok(!V_I4(&hash), "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
/* nan */
|
||||
fx8.d = 10.0;
|
||||
|
@ -559,19 +551,19 @@ static void test_hash_value(void)
|
|||
V_R8(&key) = fx8.d;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == ~0u || broken(V_I4(&hash) == 0 /* win2k */ ||
|
||||
V_I4(&hash) == 0x1f4 /* vista, win2k8 */), "got hash 0x%08x\n", V_I4(&hash));
|
||||
V_I4(&hash) == 0x1f4 /* vista, win2k8 */), "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
V_VT(&key) = VT_DATE;
|
||||
V_DATE(&key) = fx8.d;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == ~0u || broken(V_I4(&hash) == 0 /* win2k */ ||
|
||||
V_I4(&hash) == 0x1f4 /* vista, win2k8 */), "got hash 0x%08x\n", V_I4(&hash));
|
||||
V_I4(&hash) == 0x1f4 /* vista, win2k8 */), "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
/* inf */
|
||||
fx8.d = 10.0;
|
||||
|
@ -583,17 +575,17 @@ static void test_hash_value(void)
|
|||
V_R8(&key) = fx8.d;
|
||||
V_I4(&hash) = 10;
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == 0, "got hash 0x%08x\n", V_I4(&hash));
|
||||
ok(!V_I4(&hash), "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
V_VT(&key) = VT_DATE;
|
||||
V_DATE(&key) = fx8.d;
|
||||
V_I4(&hash) = 10;
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == 0, "got hash 0x%08x\n", V_I4(&hash));
|
||||
ok(!V_I4(&hash), "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(float_hash_tests); i++) {
|
||||
double dbl;
|
||||
|
@ -606,58 +598,52 @@ static void test_hash_value(void)
|
|||
V_R4(&key) = float_hash_tests[i];
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
|
||||
flt = float_hash_tests[i];
|
||||
V_VT(&key) = VT_R4|VT_BYREF;
|
||||
V_R4REF(&key) = &flt;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
|
||||
V_VT(&key) = VT_R8;
|
||||
V_R8(&key) = float_hash_tests[i];
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
|
||||
dbl = float_hash_tests[i];
|
||||
V_VT(&key) = VT_R8|VT_BYREF;
|
||||
V_R8REF(&key) = &dbl;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
|
||||
V_VT(&key) = VT_DATE;
|
||||
V_DATE(&key) = float_hash_tests[i];
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
|
||||
V_VT(&key) = VT_DATE|VT_BYREF;
|
||||
date = float_hash_tests[i];
|
||||
V_DATEREF(&key) = &date;
|
||||
VariantInit(&hash);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||
expected);
|
||||
ok(V_I4(&hash) == expected, "%d: got hash %#lx, expected %#lx.\n", i, V_I4(&hash), expected);
|
||||
}
|
||||
|
||||
/* interface pointers as keys */
|
||||
|
@ -666,9 +652,9 @@ static void test_hash_value(void)
|
|||
VariantInit(&hash);
|
||||
V_I4(&hash) = 1;
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == 0, "got hash 0x%08x, expected 0\n", V_I4(&hash));
|
||||
ok(!V_I4(&hash), "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
/* QI doesn't work */
|
||||
V_VT(&key) = VT_UNKNOWN;
|
||||
|
@ -676,18 +662,18 @@ static void test_hash_value(void)
|
|||
VariantInit(&hash);
|
||||
expected = get_ptr_hash(&test_unk2);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k */, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == ~0u, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
|
||||
ok(V_I4(&hash) == ~0u, "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
V_VT(&key) = VT_UNKNOWN;
|
||||
V_UNKNOWN(&key) = &test_unk;
|
||||
VariantInit(&hash);
|
||||
expected = get_ptr_hash(&test_unk);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
|
||||
ok(V_I4(&hash) == expected, "got hash %#lx, expected %#lx\n", V_I4(&hash), expected);
|
||||
|
||||
/* interface without IDispatch support */
|
||||
V_VT(&key) = VT_DISPATCH;
|
||||
|
@ -695,18 +681,18 @@ static void test_hash_value(void)
|
|||
VariantInit(&hash);
|
||||
expected = get_ptr_hash(&test_unk);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
|
||||
ok(V_I4(&hash) == expected, "got hash %#lx, expected %#lx\n", V_I4(&hash), expected);
|
||||
|
||||
V_VT(&key) = VT_DISPATCH;
|
||||
V_DISPATCH(&key) = &test_disp;
|
||||
VariantInit(&hash);
|
||||
expected = get_ptr_hash(&test_disp);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
|
||||
ok(V_I4(&hash) == expected, "got hash %#lx, expected %#lx\n", V_I4(&hash), expected);
|
||||
|
||||
/* same with BYREF */
|
||||
if (0) { /* crashes on native */
|
||||
|
@ -720,9 +706,9 @@ if (0) { /* crashes on native */
|
|||
VariantInit(&hash);
|
||||
V_I4(&hash) = 1;
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == 0, "got hash 0x%08x, expected 0\n", V_I4(&hash));
|
||||
ok(!V_I4(&hash), "Unexpected hash %#lx.\n", V_I4(&hash));
|
||||
|
||||
V_VT(&key) = VT_UNKNOWN|VT_BYREF;
|
||||
unk = &test_unk;
|
||||
|
@ -730,9 +716,9 @@ if (0) { /* crashes on native */
|
|||
VariantInit(&hash);
|
||||
expected = get_ptr_hash(&test_unk);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
|
||||
ok(V_I4(&hash) == expected, "got hash %#lx, expected %#lx\n", V_I4(&hash), expected);
|
||||
|
||||
/* interface without IDispatch support */
|
||||
V_VT(&key) = VT_DISPATCH|VT_BYREF;
|
||||
|
@ -741,9 +727,9 @@ if (0) { /* crashes on native */
|
|||
VariantInit(&hash);
|
||||
expected = get_ptr_hash(&test_unk);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
|
||||
ok(V_I4(&hash) == expected, "got hash %#lx, expected %#lx\n", V_I4(&hash), expected);
|
||||
|
||||
V_VT(&key) = VT_DISPATCH|VT_BYREF;
|
||||
disp = &test_disp;
|
||||
|
@ -751,9 +737,9 @@ if (0) { /* crashes on native */
|
|||
VariantInit(&hash);
|
||||
expected = get_ptr_hash(&test_disp);
|
||||
hr = IDictionary_get_HashVal(dict, &key, &hash);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
|
||||
ok(V_I4(&hash) == expected, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
|
||||
ok(V_I4(&hash) == expected, "got hash %#lx, expected %#lx\n", V_I4(&hash), expected);
|
||||
|
||||
IDictionary_Release(dict);
|
||||
}
|
||||
|
@ -767,7 +753,7 @@ static void test_Exists(void)
|
|||
|
||||
hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||
&IID_IDictionary, (void**)&dict);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
if (0) /* crashes on native */
|
||||
hr = IDictionary_Exists(dict, NULL, NULL);
|
||||
|
@ -775,34 +761,34 @@ static void test_Exists(void)
|
|||
V_VT(&key) = VT_I2;
|
||||
V_I2(&key) = 0;
|
||||
hr = IDictionary_Exists(dict, &key, NULL);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
V_VT(&key) = VT_I2;
|
||||
V_I2(&key) = 0;
|
||||
exists = VARIANT_TRUE;
|
||||
hr = IDictionary_Exists(dict, &key, &exists);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\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);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
V_VT(&key) = VT_R4;
|
||||
V_R4(&key) = 0.0;
|
||||
hr = IDictionary_Add(dict, &key, &item);
|
||||
ok(hr == CTL_E_KEY_ALREADY_EXISTS, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_KEY_ALREADY_EXISTS, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
V_VT(&key) = VT_I2;
|
||||
V_I2(&key) = 0;
|
||||
hr = IDictionary_Exists(dict, &key, NULL);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ILLEGALFUNCTIONCALL, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
V_VT(&key) = VT_I2;
|
||||
V_I2(&key) = 0;
|
||||
exists = VARIANT_FALSE;
|
||||
hr = IDictionary_Exists(dict, &key, &exists);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(exists == VARIANT_TRUE, "got %x\n", exists);
|
||||
|
||||
/* key of different type, but resolves to same hash value */
|
||||
|
@ -810,7 +796,7 @@ static void test_Exists(void)
|
|||
V_R4(&key) = 0.0;
|
||||
exists = VARIANT_FALSE;
|
||||
hr = IDictionary_Exists(dict, &key, &exists);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(exists == VARIANT_TRUE, "got %x\n", exists);
|
||||
|
||||
IDictionary_Release(dict);
|
||||
|
@ -825,14 +811,14 @@ static void test_Keys(void)
|
|||
|
||||
hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||
&IID_IDictionary, (void**)&dict);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IDictionary_Keys(dict, NULL);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
VariantInit(&keys);
|
||||
hr = IDictionary_Keys(dict, &keys);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&keys) == (VT_ARRAY|VT_VARIANT), "got %d\n", V_VT(&keys));
|
||||
VariantClear(&keys);
|
||||
|
||||
|
@ -840,25 +826,25 @@ static void test_Keys(void)
|
|||
V_R4(&key) = 0.0;
|
||||
VariantInit(&item);
|
||||
hr = IDictionary_Add(dict, &key, &item);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
VariantInit(&keys);
|
||||
hr = IDictionary_Keys(dict, &keys);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&keys) == (VT_ARRAY|VT_VARIANT), "got %d\n", V_VT(&keys));
|
||||
|
||||
VariantInit(&key);
|
||||
index = 0;
|
||||
hr = SafeArrayGetElement(V_ARRAY(&keys), &index, &key);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&key) == VT_R4, "got %d\n", V_VT(&key));
|
||||
|
||||
index = SafeArrayGetDim(V_ARRAY(&keys));
|
||||
ok(index == 1, "got %d\n", index);
|
||||
ok(index == 1, "Unexpected value %ld.\n", index);
|
||||
|
||||
hr = SafeArrayGetUBound(V_ARRAY(&keys), 1, &index);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(index == 0, "got %d\n", index);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(index == 0, "Unexpected value %ld.\n", index);
|
||||
|
||||
VariantClear(&keys);
|
||||
|
||||
|
@ -873,7 +859,7 @@ static void test_Remove(void)
|
|||
|
||||
hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||
&IID_IDictionary, (void**)&dict);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
if (0)
|
||||
hr = IDictionary_Remove(dict, NULL);
|
||||
|
@ -882,14 +868,14 @@ static void test_Remove(void)
|
|||
V_VT(&key) = VT_R4;
|
||||
V_R4(&key) = 0.0;
|
||||
hr = IDictionary_Remove(dict, &key);
|
||||
ok(hr == CTL_E_ELEMENT_NOT_FOUND, "got 0x%08x\n", hr);
|
||||
ok(hr == CTL_E_ELEMENT_NOT_FOUND, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
VariantInit(&item);
|
||||
hr = IDictionary_Add(dict, &key, &item);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IDictionary_Remove(dict, &key);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
IDictionary_Release(dict);
|
||||
}
|
||||
|
@ -902,21 +888,21 @@ static void test_Item(void)
|
|||
|
||||
hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||
&IID_IDictionary, (void**)&dict);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\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(hr == S_OK, "Unexpected hr %#lx.\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(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&item) == VT_EMPTY, "got %d\n", V_VT(&item));
|
||||
|
||||
IDictionary_Release(dict);
|
||||
|
@ -931,7 +917,7 @@ static void test_Add(void)
|
|||
|
||||
hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||
&IID_IDictionary, (void**)&dict);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
str = SysAllocString(L"testW");
|
||||
V_VT(&key) = VT_I2;
|
||||
|
@ -939,10 +925,10 @@ static void test_Add(void)
|
|||
V_VT(&item) = VT_BSTR|VT_BYREF;
|
||||
V_BSTRREF(&item) = &str;
|
||||
hr = IDictionary_Add(dict, &key, &item);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IDictionary_get_Item(dict, &key, &item);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&item) == VT_BSTR, "got %d\n", V_VT(&item));
|
||||
|
||||
SysFreeString(str);
|
||||
|
@ -961,107 +947,107 @@ static void test_IEnumVARIANT(void)
|
|||
|
||||
hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||
&IID_IDictionary, (void**)&dict);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
if (0) /* crashes on native */
|
||||
hr = IDictionary__NewEnum(dict, NULL);
|
||||
|
||||
hr = IDictionary__NewEnum(dict, &enum1);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IDictionary__NewEnum(dict, &enum2);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(enum1 != enum2, "got %p, %p\n", enum2, enum1);
|
||||
IUnknown_Release(enum2);
|
||||
|
||||
hr = IUnknown_QueryInterface(enum1, &IID_IEnumVARIANT, (void**)&enumvar);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
IUnknown_Release(enum1);
|
||||
|
||||
/* dictionary is empty */
|
||||
hr = IEnumVARIANT_Skip(enumvar, 1);
|
||||
ok(hr == S_FALSE, "got 0x%08x\n", hr);
|
||||
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IEnumVARIANT_Skip(enumvar, 0);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
V_VT(&key) = VT_I2;
|
||||
V_I2(&key) = 1;
|
||||
V_VT(&item) = VT_I4;
|
||||
V_I4(&item) = 100;
|
||||
hr = IDictionary_Add(dict, &key, &item);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IEnumVARIANT_Skip(enumvar, 0);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IEnumVARIANT_Reset(enumvar);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
hr = IEnumVARIANT_Skip(enumvar, 1);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
hr = IEnumVARIANT_Skip(enumvar, 1);
|
||||
ok(hr == S_FALSE, "got 0x%08x\n", hr);
|
||||
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
V_VT(&key) = VT_I2;
|
||||
V_I2(&key) = 4000;
|
||||
V_VT(&item) = VT_I4;
|
||||
V_I4(&item) = 200;
|
||||
hr = IDictionary_Add(dict, &key, &item);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
V_VT(&key) = VT_I2;
|
||||
V_I2(&key) = 0;
|
||||
V_VT(&item) = VT_I4;
|
||||
V_I4(&item) = 300;
|
||||
hr = IDictionary_Add(dict, &key, &item);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IEnumVARIANT_Reset(enumvar);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
VariantInit(&key);
|
||||
hr = IEnumVARIANT_Next(enumvar, 1, &key, &fetched);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&key) == VT_I2, "got %d\n", V_VT(&key));
|
||||
ok(V_I2(&key) == 1, "got %d\n", V_I2(&key));
|
||||
ok(fetched == 1, "got %u\n", fetched);
|
||||
ok(fetched == 1, "Unexpected value %lu.\n", fetched);
|
||||
|
||||
hr = IEnumVARIANT_Reset(enumvar);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = IDictionary_Remove(dict, &key);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
VariantInit(&key);
|
||||
hr = IEnumVARIANT_Next(enumvar, 1, &key, &fetched);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&key) == VT_I2, "got %d\n", V_VT(&key));
|
||||
ok(V_I2(&key) == 4000, "got %d\n", V_I2(&key));
|
||||
ok(fetched == 1, "got %u\n", fetched);
|
||||
ok(fetched == 1, "Unexpected value %lu.\n", fetched);
|
||||
|
||||
VariantInit(&key);
|
||||
hr = IEnumVARIANT_Next(enumvar, 1, &key, &fetched);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
ok(V_VT(&key) == VT_I2, "got %d\n", V_VT(&key));
|
||||
ok(V_I2(&key) == 0, "got %d\n", V_I2(&key));
|
||||
ok(fetched == 1, "got %u\n", fetched);
|
||||
ok(fetched == 1, "Unexpected value %lu.\n", fetched);
|
||||
|
||||
/* enumeration reached the bottom, add one more pair */
|
||||
VariantInit(&key);
|
||||
hr = IEnumVARIANT_Next(enumvar, 1, &key, &fetched);
|
||||
ok(hr == S_FALSE, "got 0x%08x\n", hr);
|
||||
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
V_VT(&key) = VT_I2;
|
||||
V_I2(&key) = 13;
|
||||
V_VT(&item) = VT_I4;
|
||||
V_I4(&item) = 350;
|
||||
hr = IDictionary_Add(dict, &key, &item);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
/* still doesn't work until Reset() */
|
||||
VariantInit(&key);
|
||||
hr = IEnumVARIANT_Next(enumvar, 1, &key, &fetched);
|
||||
ok(hr == S_FALSE, "got 0x%08x\n", hr);
|
||||
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
||||
|
||||
IEnumVARIANT_Release(enumvar);
|
||||
IDictionary_Release(dict);
|
||||
|
@ -1077,7 +1063,7 @@ START_TEST(dictionary)
|
|||
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);
|
||||
win_skip("Dictionary object is not supported: hr %#lx.\n", hr);
|
||||
CoUninitialize();
|
||||
return;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue