uiautomationcore/tests: Enable compilation with long types.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-03-05 12:09:02 +01:00 committed by Alexandre Julliard
parent b0eec770d0
commit c7bbb107cd
2 changed files with 40 additions and 41 deletions

View File

@ -1,4 +1,3 @@
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = uiautomationcore.dll
IMPORTS = uiautomationcore user32 ole32 oleaut32

View File

@ -61,33 +61,33 @@ static void test_UiaHostProviderFromHwnd(void)
p = (void *)0xdeadbeef;
hr = UiaHostProviderFromHwnd(NULL, &p);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(p == NULL, "Unexpected instance.\n");
hr = UiaHostProviderFromHwnd(hwnd, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
p = NULL;
hr = UiaHostProviderFromHwnd(hwnd, &p);
ok(hr == S_OK, "Failed to get host provider, hr %#x.\n", hr);
ok(hr == S_OK, "Failed to get host provider, hr %#lx.\n", hr);
p2 = NULL;
hr = UiaHostProviderFromHwnd(hwnd, &p2);
ok(hr == S_OK, "Failed to get host provider, hr %#x.\n", hr);
ok(hr == S_OK, "Failed to get host provider, hr %#lx.\n", hr);
ok(p != p2, "Unexpected instance.\n");
IRawElementProviderSimple_Release(p2);
hr = IRawElementProviderSimple_get_HostRawElementProvider(p, &p2);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(p2 == NULL, "Unexpected instance.\n");
hr = IRawElementProviderSimple_GetPropertyValue(p, UIA_NativeWindowHandlePropertyId, &v);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v));
ok(V_I4(&v) == HandleToUlong(hwnd), "V_I4(&v) = %#x, expected %#x\n", V_I4(&v), HandleToUlong(hwnd));
ok(V_I4(&v) == HandleToUlong(hwnd), "V_I4(&v) = %#lx, expected %#lx\n", V_I4(&v), HandleToUlong(hwnd));
hr = IRawElementProviderSimple_GetPropertyValue(p, UIA_ProviderDescriptionPropertyId, &v);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&v) == VT_BSTR, "V_VT(&v) = %d\n", V_VT(&v));
VariantClear(&v);
@ -98,12 +98,12 @@ static void test_UiaHostProviderFromHwnd(void)
unk = (void *)0xdeadbeef;
hr = IRawElementProviderSimple_GetPatternProvider(p, i, &unk);
ok(hr == S_OK, "Unexpected hr %#x, %d.\n", hr, i);
ok(hr == S_OK, "Unexpected hr %#lx, %d.\n", hr, i);
ok(!unk, "Pattern %d returned %p\n", i, unk);
}
hr = IRawElementProviderSimple_get_ProviderOptions(p, &prov_opt);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok((prov_opt == ProviderOptions_ServerSideProvider) ||
broken(prov_opt == ProviderOptions_ClientSideProvider), /* Windows < 10 1507 */
"Unexpected provider options %#x\n", prov_opt);
@ -112,17 +112,17 @@ static void test_UiaHostProviderFromHwnd(void)
DestroyWindow(hwnd);
hr = IRawElementProviderSimple_GetPropertyValue(p, UIA_NativeWindowHandlePropertyId, &v);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v));
ok(V_I4(&v) == HandleToUlong(hwnd), "V_I4(&v) = %#x, expected %#x\n", V_I4(&v), HandleToUlong(hwnd));
ok(V_I4(&v) == HandleToUlong(hwnd), "V_I4(&v) = %#lx, expected %#lx\n", V_I4(&v), HandleToUlong(hwnd));
hr = IRawElementProviderSimple_GetPropertyValue(p, UIA_ProviderDescriptionPropertyId, &v);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(V_VT(&v) == VT_BSTR, "V_VT(&v) = %d\n", V_VT(&v));
VariantClear(&v);
hr = IRawElementProviderSimple_get_ProviderOptions(p, &prov_opt);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok((prov_opt == ProviderOptions_ServerSideProvider) ||
broken(prov_opt == ProviderOptions_ClientSideProvider), /* Windows < 10 1507 */
"Unexpected provider options %#x\n", prov_opt);
@ -141,16 +141,16 @@ static DWORD WINAPI uia_reserved_val_iface_marshal_thread(LPVOID param)
CoInitializeEx(NULL, COINIT_MULTITHREADED);
hr = CoGetInterfaceAndReleaseStream(stream[0], &IID_IUnknown, (void **)&unk_ns);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = CoGetInterfaceAndReleaseStream(stream[1], &IID_IUnknown, (void **)&unk_ma);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = UiaGetReservedNotSupportedValue(&unk_ns2);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = UiaGetReservedMixedAttributeValue(&unk_ma2);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(unk_ns2 == unk_ns, "UiaGetReservedNotSupported pointer mismatch, unk_ns2 %p, unk_ns %p\n", unk_ns2, unk_ns);
ok(unk_ma2 == unk_ma, "UiaGetReservedMixedAttribute pointer mismatch, unk_ma2 %p, unk_ma %p\n", unk_ma2, unk_ma);
@ -171,83 +171,83 @@ static void test_uia_reserved_value_ifaces(void)
/* ReservedNotSupportedValue. */
hr = UiaGetReservedNotSupportedValue(NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = UiaGetReservedNotSupportedValue(&unk_ns);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(unk_ns != NULL, "UiaGetReservedNotSupportedValue returned NULL interface.\n");
refcnt = IUnknown_AddRef(unk_ns);
ok(refcnt == 1, "Expected refcnt %d, got %d\n", 1, refcnt);
ok(refcnt == 1, "Expected refcnt %d, got %ld\n", 1, refcnt);
refcnt = IUnknown_AddRef(unk_ns);
ok(refcnt == 1, "Expected refcnt %d, got %d\n", 1, refcnt);
ok(refcnt == 1, "Expected refcnt %d, got %ld\n", 1, refcnt);
refcnt = IUnknown_Release(unk_ns);
ok(refcnt == 1, "Expected refcnt %d, got %d\n", 1, refcnt);
ok(refcnt == 1, "Expected refcnt %d, got %ld\n", 1, refcnt);
hr = UiaGetReservedNotSupportedValue(&unk_ns2);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(unk_ns2 != NULL, "UiaGetReservedNotSupportedValue returned NULL interface.");
ok(unk_ns2 == unk_ns, "UiaGetReservedNotSupported pointer mismatch, unk_ns2 %p, unk_ns %p\n", unk_ns2, unk_ns);
marshal = NULL;
hr = IUnknown_QueryInterface(unk_ns, &IID_IMarshal, (void **)&marshal);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(marshal != NULL, "Failed to get IMarshal interface.\n");
refcnt = IMarshal_AddRef(marshal);
ok(refcnt == 2, "Expected refcnt %d, got %d\n", 2, refcnt);
ok(refcnt == 2, "Expected refcnt %d, got %ld\n", 2, refcnt);
refcnt = IMarshal_Release(marshal);
ok(refcnt == 1, "Expected refcnt %d, got %d\n", 1, refcnt);
ok(refcnt == 1, "Expected refcnt %d, got %ld\n", 1, refcnt);
refcnt = IMarshal_Release(marshal);
ok(refcnt == 0, "Expected refcnt %d, got %d\n", 0, refcnt);
ok(refcnt == 0, "Expected refcnt %d, got %ld\n", 0, refcnt);
/* ReservedMixedAttributeValue. */
hr = UiaGetReservedMixedAttributeValue(NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = UiaGetReservedMixedAttributeValue(&unk_ma);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(unk_ma != NULL, "UiaGetReservedMixedAttributeValue returned NULL interface.");
refcnt = IUnknown_AddRef(unk_ma);
ok(refcnt == 1, "Expected refcnt %d, got %d\n", 1, refcnt);
ok(refcnt == 1, "Expected refcnt %d, got %ld\n", 1, refcnt);
refcnt = IUnknown_AddRef(unk_ma);
ok(refcnt == 1, "Expected refcnt %d, got %d\n", 1, refcnt);
ok(refcnt == 1, "Expected refcnt %d, got %ld\n", 1, refcnt);
refcnt = IUnknown_Release(unk_ma);
ok(refcnt == 1, "Expected refcnt %d, got %d\n", 1, refcnt);
ok(refcnt == 1, "Expected refcnt %d, got %ld\n", 1, refcnt);
hr = UiaGetReservedMixedAttributeValue(&unk_ma2);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(unk_ma2 != NULL, "UiaGetReservedMixedAttributeValue returned NULL interface.");
ok(unk_ma2 == unk_ma, "UiaGetReservedMixedAttribute pointer mismatch, unk_ma2 %p, unk_ma %p\n", unk_ma2, unk_ma);
marshal = NULL;
hr = IUnknown_QueryInterface(unk_ma, &IID_IMarshal, (void **)&marshal);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(marshal != NULL, "Failed to get IMarshal interface.\n");
refcnt = IMarshal_AddRef(marshal);
ok(refcnt == 2, "Expected refcnt %d, got %d\n", 2, refcnt);
ok(refcnt == 2, "Expected refcnt %d, got %ld\n", 2, refcnt);
refcnt = IMarshal_Release(marshal);
ok(refcnt == 1, "Expected refcnt %d, got %d\n", 1, refcnt);
ok(refcnt == 1, "Expected refcnt %d, got %ld\n", 1, refcnt);
refcnt = IMarshal_Release(marshal);
ok(refcnt == 0, "Expected refcnt %d, got %d\n", 0, refcnt);
ok(refcnt == 0, "Expected refcnt %d, got %ld\n", 0, refcnt);
/* Test cross-thread marshaling behavior. */
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
hr = CoMarshalInterThreadInterfaceInStream(&IID_IUnknown, unk_ns, &stream[0]);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = CoMarshalInterThreadInterfaceInStream(&IID_IUnknown, unk_ma, &stream[1]);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
thread = CreateThread(NULL, 0, uia_reserved_val_iface_marshal_thread, (void *)stream, 0, NULL);
while (MsgWaitForMultipleObjects(1, &thread, FALSE, INFINITE, QS_ALLINPUT) != WAIT_OBJECT_0)