oleaut32/tests: Dynamically load some functions that are missing on early NT4 releases.
This commit is contained in:
parent
af3114a5c4
commit
8375c8e003
|
@ -29,6 +29,9 @@
|
|||
#include "tmarshal.h"
|
||||
#include "tmarshal_dispids.h"
|
||||
|
||||
static HRESULT (WINAPI *pVarAdd)(LPVARIANT,LPVARIANT,LPVARIANT);
|
||||
|
||||
|
||||
#define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error 0x%08lx\n", (unsigned long int)hr)
|
||||
|
||||
/* ULL suffix is not portable */
|
||||
|
@ -481,8 +484,6 @@ static HRESULT WINAPI Widget_VariantCArray(
|
|||
VARIANT values[])
|
||||
{
|
||||
ULONG i;
|
||||
VARIANT inc, res;
|
||||
HRESULT hr;
|
||||
|
||||
trace("VariantCArray(%u,%p)\n", count, values);
|
||||
|
||||
|
@ -490,21 +491,29 @@ static HRESULT WINAPI Widget_VariantCArray(
|
|||
for (i = 0; i < count; i++)
|
||||
ok(V_VT(&values[i]) == VT_I4, "values[%d] is not VT_I4\n", i);
|
||||
|
||||
V_VT(&inc) = VT_I4;
|
||||
V_I4(&inc) = 1;
|
||||
for (i = 0; i < count; i++) {
|
||||
VariantInit(&res);
|
||||
hr = VarAdd(&values[i], &inc, &res);
|
||||
if (FAILED(hr)) {
|
||||
ok(0, "VarAdd failed at %u with error 0x%x\n", i, hr);
|
||||
return hr;
|
||||
}
|
||||
hr = VariantCopy(&values[i], &res);
|
||||
if (FAILED(hr)) {
|
||||
ok(0, "VariantCopy failed at %u with error 0x%x\n", i, hr);
|
||||
return hr;
|
||||
if (pVarAdd)
|
||||
{
|
||||
VARIANT inc, res;
|
||||
HRESULT hr;
|
||||
|
||||
V_VT(&inc) = VT_I4;
|
||||
V_I4(&inc) = 1;
|
||||
for (i = 0; i < count; i++) {
|
||||
VariantInit(&res);
|
||||
hr = pVarAdd(&values[i], &inc, &res);
|
||||
if (FAILED(hr)) {
|
||||
ok(0, "VarAdd failed at %u with error 0x%x\n", i, hr);
|
||||
return hr;
|
||||
}
|
||||
hr = VariantCopy(&values[i], &res);
|
||||
if (FAILED(hr)) {
|
||||
ok(0, "VariantCopy failed at %u with error 0x%x\n", i, hr);
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
win_skip("VarAdd is not available\n");
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1593,6 +1602,8 @@ static void test_libattr(void)
|
|||
START_TEST(tmarshal)
|
||||
{
|
||||
HRESULT hr;
|
||||
HANDLE hOleaut32 = GetModuleHandleA("oleaut32.dll");
|
||||
pVarAdd = (void*)GetProcAddress(hOleaut32, "VarAdd");
|
||||
|
||||
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
|
||||
|
||||
|
|
|
@ -36,12 +36,16 @@
|
|||
# define V_U2(A) (*(A))
|
||||
#endif
|
||||
|
||||
static HRESULT (WINAPI *pSafeArrayGetIID)(SAFEARRAY*,GUID*);
|
||||
static HRESULT (WINAPI *pSafeArrayGetVartype)(SAFEARRAY*,VARTYPE*);
|
||||
static HRESULT (WINAPI *pVarBstrCmp)(BSTR,BSTR,LCID,ULONG);
|
||||
|
||||
static inline SF_TYPE get_union_type(SAFEARRAY *psa)
|
||||
{
|
||||
VARTYPE vt;
|
||||
HRESULT hr;
|
||||
|
||||
hr = SafeArrayGetVartype(psa, &vt);
|
||||
hr = pSafeArrayGetVartype(psa, &vt);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
if(psa->fFeatures & FADF_VARIANT) return SF_VARIANT;
|
||||
|
@ -129,7 +133,10 @@ static void check_safearray(void *buffer, LPSAFEARRAY lpsa)
|
|||
return;
|
||||
}
|
||||
|
||||
if(FAILED(SafeArrayGetVartype(lpsa, &vt)))
|
||||
if (!pSafeArrayGetVartype || !pSafeArrayGetIID)
|
||||
return;
|
||||
|
||||
if(FAILED(pSafeArrayGetVartype(lpsa, &vt)))
|
||||
vt = 0;
|
||||
|
||||
sftype = get_union_type(lpsa);
|
||||
|
@ -158,7 +165,7 @@ static void check_safearray(void *buffer, LPSAFEARRAY lpsa)
|
|||
if(sftype == SF_HAVEIID)
|
||||
{
|
||||
GUID guid;
|
||||
SafeArrayGetIID(lpsa, &guid);
|
||||
pSafeArrayGetIID(lpsa, &guid);
|
||||
ok(IsEqualGUID(&guid, wiresa), "guid mismatch\n");
|
||||
wiresa += sizeof(GUID);
|
||||
}
|
||||
|
@ -259,9 +266,12 @@ static void test_marshal_LPSAFEARRAY(void)
|
|||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
LPSAFEARRAY_UserUnmarshal(&umcb.Flags, buffer, &lpsa2);
|
||||
ok(lpsa2 != NULL, "LPSAFEARRAY didn't unmarshal\n");
|
||||
SafeArrayGetVartype(lpsa, &vt);
|
||||
SafeArrayGetVartype(lpsa2, &vt2);
|
||||
ok(vt == vt2, "vts differ %x %x\n", vt, vt2);
|
||||
if (pSafeArrayGetVartype)
|
||||
{
|
||||
pSafeArrayGetVartype(lpsa, &vt);
|
||||
pSafeArrayGetVartype(lpsa2, &vt2);
|
||||
ok(vt == vt2, "vts differ %x %x\n", vt, vt2);
|
||||
}
|
||||
ok(lpsa2->cLocks == 0, "got lock count %u, expected 0\n", lpsa2->cLocks);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
LPSAFEARRAY_UserFree(&umcb.Flags, &lpsa2);
|
||||
|
@ -302,9 +312,12 @@ static void test_marshal_LPSAFEARRAY(void)
|
|||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
LPSAFEARRAY_UserUnmarshal(&umcb.Flags, buffer, &lpsa2);
|
||||
ok(lpsa2 != NULL, "LPSAFEARRAY didn't unmarshal\n");
|
||||
SafeArrayGetVartype(lpsa, &vt);
|
||||
SafeArrayGetVartype(lpsa2, &vt2);
|
||||
ok(vt == vt2, "vts differ %x %x\n", vt, vt2);
|
||||
if (pSafeArrayGetVartype)
|
||||
{
|
||||
pSafeArrayGetVartype(lpsa, &vt);
|
||||
pSafeArrayGetVartype(lpsa2, &vt2);
|
||||
ok(vt == vt2, "vts differ %x %x\n", vt, vt2);
|
||||
}
|
||||
ok(lpsa2->cLocks == 0, "got lock count %u, expected 0\n", lpsa2->cLocks);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
LPSAFEARRAY_UserFree(&umcb.Flags, &lpsa2);
|
||||
|
@ -374,8 +387,11 @@ static void test_marshal_LPSAFEARRAY(void)
|
|||
hr = SafeArrayAllocData(lpsa);
|
||||
ok(hr == S_OK, "saad failed %08x\n", hr);
|
||||
|
||||
hr = SafeArrayGetVartype(lpsa, &vt);
|
||||
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
||||
if (pSafeArrayGetVartype)
|
||||
{
|
||||
hr = pSafeArrayGetVartype(lpsa, &vt);
|
||||
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
||||
}
|
||||
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa);
|
||||
|
@ -455,7 +471,8 @@ static void test_marshal_LPSAFEARRAY(void)
|
|||
ok(hr == S_OK, "Failed to get bstr element at hres 0x%x\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok(VarBstrCmp(values[i], gotvalue, 0, 0) == VARCMP_EQ, "String %d does not match\n", i);
|
||||
if (pVarBstrCmp)
|
||||
ok(pVarBstrCmp(values[i], gotvalue, 0, 0) == VARCMP_EQ, "String %d does not match\n", i);
|
||||
SysFreeString(gotvalue);
|
||||
}
|
||||
}
|
||||
|
@ -480,8 +497,11 @@ static void test_marshal_LPSAFEARRAY(void)
|
|||
hr = SafeArrayAllocData(lpsa);
|
||||
ok(hr == S_OK, "saad failed %08x\n", hr);
|
||||
|
||||
hr = SafeArrayGetVartype(lpsa, &vt);
|
||||
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
||||
if (pSafeArrayGetVartype)
|
||||
{
|
||||
hr = pSafeArrayGetVartype(lpsa, &vt);
|
||||
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
||||
}
|
||||
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa);
|
||||
|
@ -1273,9 +1293,12 @@ static void test_marshal_VARIANT(void)
|
|||
SafeArrayGetUBound(V_ARRAY(&v), 1, &bound);
|
||||
SafeArrayGetUBound(V_ARRAY(&v2), 1, &bound2);
|
||||
ok(bound == bound2, "array ubounds differ\n");
|
||||
SafeArrayGetVartype(V_ARRAY(&v), &vt);
|
||||
SafeArrayGetVartype(V_ARRAY(&v2), &vt2);
|
||||
ok(vt == vt2, "array vts differ %x %x\n", vt, vt2);
|
||||
if (pSafeArrayGetVartype)
|
||||
{
|
||||
pSafeArrayGetVartype(V_ARRAY(&v), &vt);
|
||||
pSafeArrayGetVartype(V_ARRAY(&v2), &vt2);
|
||||
ok(vt == vt2, "array vts differ %x %x\n", vt, vt2);
|
||||
}
|
||||
VARIANT_UserFree(&umcb.Flags, &v2);
|
||||
HeapFree(GetProcessHeap(), 0, oldbuffer);
|
||||
|
||||
|
@ -1313,9 +1336,12 @@ static void test_marshal_VARIANT(void)
|
|||
SafeArrayGetUBound(*V_ARRAYREF(&v), 1, &bound);
|
||||
SafeArrayGetUBound(*V_ARRAYREF(&v2), 1, &bound2);
|
||||
ok(bound == bound2, "array ubounds differ\n");
|
||||
SafeArrayGetVartype(*V_ARRAYREF(&v), &vt);
|
||||
SafeArrayGetVartype(*V_ARRAYREF(&v2), &vt2);
|
||||
ok(vt == vt2, "array vts differ %x %x\n", vt, vt2);
|
||||
if (pSafeArrayGetVartype)
|
||||
{
|
||||
pSafeArrayGetVartype(*V_ARRAYREF(&v), &vt);
|
||||
pSafeArrayGetVartype(*V_ARRAYREF(&v2), &vt2);
|
||||
ok(vt == vt2, "array vts differ %x %x\n", vt, vt2);
|
||||
}
|
||||
VARIANT_UserFree(&umcb.Flags, &v2);
|
||||
HeapFree(GetProcessHeap(), 0, oldbuffer);
|
||||
hr = SafeArrayDestroy(lpsa);
|
||||
|
@ -1481,6 +1507,16 @@ static void test_marshal_VARIANT(void)
|
|||
|
||||
START_TEST(usrmarshal)
|
||||
{
|
||||
HANDLE hOleaut32 = GetModuleHandleA("oleaut32.dll");
|
||||
#define GETPTR(func) p##func = (void*)GetProcAddress(hOleaut32, #func)
|
||||
GETPTR(SafeArrayGetIID);
|
||||
GETPTR(SafeArrayGetVartype);
|
||||
GETPTR(VarBstrCmp);
|
||||
#undef GETPTR
|
||||
|
||||
if (!pSafeArrayGetIID || !pSafeArrayGetVartype)
|
||||
win_skip("SafeArrayGetIID and/or SafeArrayGetVartype is not available, some tests will be skipped\n");
|
||||
|
||||
CoInitialize(NULL);
|
||||
|
||||
test_marshal_LPSAFEARRAY();
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
static HMODULE hOleaut32;
|
||||
|
||||
static HRESULT (WINAPI *pVarBstrCmp)(BSTR,BSTR,LCID,ULONG);
|
||||
static HRESULT (WINAPI *pVarFormatNumber)(LPVARIANT,int,int,int,int,ULONG,BSTR*);
|
||||
static HRESULT (WINAPI *pVarFormat)(LPVARIANT,LPOLESTR,int,int,ULONG,BSTR*);
|
||||
static HRESULT (WINAPI *pVarWeekdayName)(int,int,int,ULONG,BSTR*);
|
||||
|
@ -525,28 +526,30 @@ static void test_VarWeekdayName(void)
|
|||
"Null pointer: expected E_INVALIDARG, got 0x%08x\n", hres);
|
||||
|
||||
/* Check all combinations */
|
||||
for (iWeekday = 1; iWeekday <= 7; ++iWeekday)
|
||||
{
|
||||
for (fAbbrev = 0; fAbbrev <= 1; ++fAbbrev)
|
||||
pVarBstrCmp = (void*)GetProcAddress(hOleaut32, "VarBstrCmp");
|
||||
if (pVarBstrCmp)
|
||||
for (iWeekday = 1; iWeekday <= 7; ++iWeekday)
|
||||
{
|
||||
/* 0 = Default, 1 = Sunday, 2 = Monday, .. */
|
||||
for (iFirstDay = 0; iFirstDay <= 7; ++iFirstDay)
|
||||
for (fAbbrev = 0; fAbbrev <= 1; ++fAbbrev)
|
||||
{
|
||||
VARWDN_O(iWeekday, fAbbrev, iFirstDay, 0);
|
||||
if (iFirstDay == 0)
|
||||
firstDay = defaultFirstDay;
|
||||
else
|
||||
/* Translate from 0=Sunday to 0=Monday in the modulo 7 space */
|
||||
firstDay = iFirstDay - 2;
|
||||
day = (7 + iWeekday - 1 + firstDay) % 7;
|
||||
ok(VARCMP_EQ == VarBstrCmp(out, dayNames[day][fAbbrev],
|
||||
LOCALE_USER_DEFAULT, 0),
|
||||
"VarWeekdayName(%d,%d,%d): got wrong dayname: '%s'\n",
|
||||
iWeekday, fAbbrev, iFirstDay, buff);
|
||||
SysFreeString(out);
|
||||
/* 0 = Default, 1 = Sunday, 2 = Monday, .. */
|
||||
for (iFirstDay = 0; iFirstDay <= 7; ++iFirstDay)
|
||||
{
|
||||
VARWDN_O(iWeekday, fAbbrev, iFirstDay, 0);
|
||||
if (iFirstDay == 0)
|
||||
firstDay = defaultFirstDay;
|
||||
else
|
||||
/* Translate from 0=Sunday to 0=Monday in the modulo 7 space */
|
||||
firstDay = iFirstDay - 2;
|
||||
day = (7 + iWeekday - 1 + firstDay) % 7;
|
||||
ok(VARCMP_EQ == pVarBstrCmp(out, dayNames[day][fAbbrev],
|
||||
LOCALE_USER_DEFAULT, 0),
|
||||
"VarWeekdayName(%d,%d,%d): got wrong dayname: '%s'\n",
|
||||
iWeekday, fAbbrev, iFirstDay, buff);
|
||||
SysFreeString(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Cleanup */
|
||||
for (day = 0; day <= 6; ++day)
|
||||
|
|
|
@ -5326,6 +5326,9 @@ static void test_VarAdd(void)
|
|||
SysFreeString(rbstr);
|
||||
}
|
||||
|
||||
static HRESULT (WINAPI *pVarCmp)(LPVARIANT,LPVARIANT,LCID,ULONG);
|
||||
static HRESULT (WINAPI *pVarCat)(LPVARIANT,LPVARIANT,LPVARIANT);
|
||||
|
||||
static void test_VarCat(void)
|
||||
{
|
||||
LCID lcid;
|
||||
|
@ -5342,6 +5345,8 @@ static void test_VarCat(void)
|
|||
HRESULT hres;
|
||||
HRESULT expected_error_num;
|
||||
|
||||
CHECKPTR(VarCat);
|
||||
|
||||
/* Set date format for testing */
|
||||
lcid = LOCALE_USER_DEFAULT;
|
||||
GetLocaleInfo(lcid,LOCALE_SSHORTDATE,orig_date_format,128);
|
||||
|
@ -5458,7 +5463,7 @@ static void test_VarCat(void)
|
|||
V_I8(&right) = 0;
|
||||
}
|
||||
|
||||
hres = VarCat(&left, &right, &result);
|
||||
hres = pVarCat(&left, &right, &result);
|
||||
|
||||
/* Determine the error code for the vt combination */
|
||||
ok(hres == expected_error_num,
|
||||
|
@ -5485,10 +5490,11 @@ static void test_VarCat(void)
|
|||
V_BSTR(&left) = SysAllocString(sz12);
|
||||
V_BSTR(&right) = SysAllocString(sz34);
|
||||
V_BSTR(&expected) = SysAllocString(sz1234);
|
||||
hres = VarCat(&left,&right,&result);
|
||||
hres = pVarCat(&left,&right,&result);
|
||||
ok(hres == S_OK, "VarCat failed with error 0x%08x\n", hres);
|
||||
ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ,
|
||||
"VarCat: VT_BSTR concat with VT_BSTR failed to return correct result\n");
|
||||
if (pVarCmp)
|
||||
ok(pVarCmp(&result,&expected,lcid,0) == VARCMP_EQ,
|
||||
"VarCat: VT_BSTR concat with VT_BSTR failed to return correct result\n");
|
||||
|
||||
VariantClear(&left);
|
||||
VariantClear(&right);
|
||||
|
@ -5498,7 +5504,7 @@ static void test_VarCat(void)
|
|||
V_VT(&left) = VT_ERROR;
|
||||
V_VT(&right) = VT_BSTR;
|
||||
V_BSTR(&right) = SysAllocString(sz1234);
|
||||
hres = VarCat(&left,&right,&result);
|
||||
hres = pVarCat(&left,&right,&result);
|
||||
ok(hres == DISP_E_TYPEMISMATCH, "VarCat should have returned DISP_E_TYPEMISMATCH instead of 0x%08x\n", hres);
|
||||
ok(V_VT(&result) == VT_EMPTY,
|
||||
"VarCat: VT_ERROR concat with VT_BSTR should have returned VT_EMPTY\n");
|
||||
|
@ -5510,7 +5516,7 @@ static void test_VarCat(void)
|
|||
V_VT(&left) = VT_BSTR;
|
||||
V_VT(&right) = VT_ERROR;
|
||||
V_BSTR(&left) = SysAllocString(sz1234);
|
||||
hres = VarCat(&left,&right,&result);
|
||||
hres = pVarCat(&left,&right,&result);
|
||||
ok(hres == DISP_E_TYPEMISMATCH, "VarCat should have returned DISP_E_TYPEMISMATCH instead of 0x%08x\n", hres);
|
||||
ok(V_VT(&result) == VT_EMPTY,
|
||||
"VarCat: VT_BSTR concat with VT_ERROR should have returned VT_EMPTY\n");
|
||||
|
@ -5527,11 +5533,14 @@ static void test_VarCat(void)
|
|||
V_INT(&left) = 12;
|
||||
V_BOOL(&right) = TRUE;
|
||||
V_BSTR(&expected) = SysAllocString(sz12_true);
|
||||
hres = VarCat(&left,&right,&result);
|
||||
hres = pVarCat(&left,&right,&result);
|
||||
ok(hres == S_OK, "VarCat failed with error 0x%08x\n", hres);
|
||||
hres = VarCmp(&result,&expected,lcid,0);
|
||||
ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08x for %s, %s\n",
|
||||
hres, variantstr(&result), variantstr(&expected));
|
||||
if (pVarCmp)
|
||||
{
|
||||
hres = pVarCmp(&result,&expected,lcid,0);
|
||||
ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08x for %s, %s\n",
|
||||
hres, variantstr(&result), variantstr(&expected));
|
||||
}
|
||||
|
||||
VariantClear(&left);
|
||||
VariantClear(&right);
|
||||
|
@ -5544,11 +5553,14 @@ static void test_VarCat(void)
|
|||
V_INT(&left) = 12;
|
||||
V_BOOL(&right) = FALSE;
|
||||
V_BSTR(&expected) = SysAllocString(sz12_false);
|
||||
hres = VarCat(&left,&right,&result);
|
||||
hres = pVarCat(&left,&right,&result);
|
||||
ok(hres == S_OK, "VarCat failed with error 0x%08x\n", hres);
|
||||
hres = VarCmp(&result,&expected,lcid,0);
|
||||
ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08x for %s, %s\n",
|
||||
hres, variantstr(&result), variantstr(&expected));
|
||||
if (pVarCmp)
|
||||
{
|
||||
hres = pVarCmp(&result,&expected,lcid,0);
|
||||
ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08x for %s, %s\n",
|
||||
hres, variantstr(&result), variantstr(&expected));
|
||||
}
|
||||
|
||||
VariantClear(&left);
|
||||
VariantClear(&right);
|
||||
|
@ -5562,10 +5574,11 @@ static void test_VarCat(void)
|
|||
V_INT(&left) = 12;
|
||||
V_INT(&right) = 34;
|
||||
V_BSTR(&expected) = SysAllocString(sz1234);
|
||||
hres = VarCat(&left,&right,&result);
|
||||
hres = pVarCat(&left,&right,&result);
|
||||
ok(hres == S_OK, "VarCat failed with error 0x%08x\n", hres);
|
||||
ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ,
|
||||
"VarCat: NUMBER concat with NUMBER returned incorrect result\n");
|
||||
if (pVarCmp)
|
||||
ok(pVarCmp(&result,&expected,lcid,0) == VARCMP_EQ,
|
||||
"VarCat: NUMBER concat with NUMBER returned incorrect result\n");
|
||||
|
||||
VariantClear(&left);
|
||||
VariantClear(&right);
|
||||
|
@ -5576,10 +5589,11 @@ static void test_VarCat(void)
|
|||
V_VT(&right) = VT_BSTR;
|
||||
V_INT(&left) = 12;
|
||||
V_BSTR(&right) = SysAllocString(sz34);
|
||||
hres = VarCat(&left,&right,&result);
|
||||
hres = pVarCat(&left,&right,&result);
|
||||
ok(hres == S_OK, "VarCat failed with error 0x%08x\n", hres);
|
||||
ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ,
|
||||
"VarCat: NUMBER concat with VT_BSTR, incorrect result\n");
|
||||
if (pVarCmp)
|
||||
ok(pVarCmp(&result,&expected,lcid,0) == VARCMP_EQ,
|
||||
"VarCat: NUMBER concat with VT_BSTR, incorrect result\n");
|
||||
|
||||
VariantClear(&left);
|
||||
VariantClear(&right);
|
||||
|
@ -5589,10 +5603,11 @@ static void test_VarCat(void)
|
|||
V_VT(&right) = VT_INT;
|
||||
V_BSTR(&left) = SysAllocString(sz12);
|
||||
V_INT(&right) = 34;
|
||||
hres = VarCat(&left,&right,&result);
|
||||
hres = pVarCat(&left,&right,&result);
|
||||
ok(hres == S_OK, "VarCat failed with error 0x%08x\n", hres);
|
||||
ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ,
|
||||
"VarCat: VT_BSTR concat with NUMBER, incorrect result\n");
|
||||
if (pVarCmp)
|
||||
ok(pVarCmp(&result,&expected,lcid,0) == VARCMP_EQ,
|
||||
"VarCat: VT_BSTR concat with NUMBER, incorrect result\n");
|
||||
|
||||
VariantClear(&left);
|
||||
VariantClear(&right);
|
||||
|
@ -5608,11 +5623,12 @@ static void test_VarCat(void)
|
|||
V_DATE(&right) = 29494.0;
|
||||
V_BSTR(&expected)= SysAllocString(sz12_date);
|
||||
V_BSTR(&expected_broken)= SysAllocString(sz12_date_broken);
|
||||
hres = VarCat(&left,&right,&result);
|
||||
hres = pVarCat(&left,&right,&result);
|
||||
ok(hres == S_OK, "VarCat failed with error 0x%08x\n", hres);
|
||||
ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ ||
|
||||
broken(VarCmp(&result,&expected_broken,lcid,0) == VARCMP_EQ), /* Some W98 and NT4 (intermittent) */
|
||||
"VarCat: VT_BSTR concat with VT_DATE returned incorrect result\n");
|
||||
if (pVarCmp)
|
||||
ok(pVarCmp(&result,&expected,lcid,0) == VARCMP_EQ ||
|
||||
broken(pVarCmp(&result,&expected_broken,lcid,0) == VARCMP_EQ), /* Some W98 and NT4 (intermittent) */
|
||||
"VarCat: VT_BSTR concat with VT_DATE returned incorrect result\n");
|
||||
|
||||
VariantClear(&left);
|
||||
VariantClear(&right);
|
||||
|
@ -5628,11 +5644,12 @@ static void test_VarCat(void)
|
|||
V_BSTR(&right) = SysAllocString(sz12);
|
||||
V_BSTR(&expected)= SysAllocString(date_sz12);
|
||||
V_BSTR(&expected_broken)= SysAllocString(date_sz12_broken);
|
||||
hres = VarCat(&left,&right,&result);
|
||||
hres = pVarCat(&left,&right,&result);
|
||||
ok(hres == S_OK, "VarCat failed with error 0x%08x\n", hres);
|
||||
ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ ||
|
||||
broken(VarCmp(&result,&expected_broken,lcid,0) == VARCMP_EQ), /* Some W98 and NT4 (intermittent) */
|
||||
"VarCat: VT_DATE concat with VT_BSTR returned incorrect result\n");
|
||||
if (pVarCmp)
|
||||
ok(pVarCmp(&result,&expected,lcid,0) == VARCMP_EQ ||
|
||||
broken(pVarCmp(&result,&expected_broken,lcid,0) == VARCMP_EQ), /* Some W98 and NT4 (intermittent) */
|
||||
"VarCat: VT_DATE concat with VT_BSTR returned incorrect result\n");
|
||||
|
||||
VariantClear(&left);
|
||||
VariantClear(&right);
|
||||
|
@ -5647,10 +5664,11 @@ static void test_VarCat(void)
|
|||
V_BSTR(&left) = SysAllocString(sz_empty);
|
||||
V_BSTR(&right) = SysAllocString(sz_empty);
|
||||
V_BSTR(&expected)= SysAllocString(sz_empty);
|
||||
hres = VarCat(&left,&right,&result);
|
||||
hres = pVarCat(&left,&right,&result);
|
||||
ok(hres == S_OK, "VarCat failed with error 0x%08x\n", hres);
|
||||
ok(VarCmp(&result,&left,lcid,0) == VARCMP_EQ,
|
||||
"VarCat: EMPTY concat with EMPTY did not return empty VT_BSTR\n");
|
||||
if (pVarCmp)
|
||||
ok(pVarCmp(&result,&left,lcid,0) == VARCMP_EQ,
|
||||
"VarCat: EMPTY concat with EMPTY did not return empty VT_BSTR\n");
|
||||
|
||||
/* Restore original date format settings */
|
||||
SetLocaleInfo(lcid,LOCALE_SSHORTDATE,orig_date_format);
|
||||
|
@ -5665,18 +5683,18 @@ static void test_VarCat(void)
|
|||
V_BOOL(&left) = VARIANT_TRUE;
|
||||
V_VT(&right) = VT_BSTR;
|
||||
V_BSTR(&right) = SysAllocStringLen(NULL,0);
|
||||
hres = VarCat(&left, &right, &result);
|
||||
hres = pVarCat(&left, &right, &result);
|
||||
ok(hres == S_OK, "VarCat failed: %08x\n", hres);
|
||||
if(!strcmp_wa(V_BSTR(&result), "True")) {
|
||||
V_VT(&right) = VT_BOOL;
|
||||
V_BOOL(&right) = 100;
|
||||
hres = VarCat(&left, &right, &result);
|
||||
hres = pVarCat(&left, &right, &result);
|
||||
ok(hres == S_OK, "VarCat failed: %08x\n", hres);
|
||||
test_bstr_var(&result, "TrueTrue");
|
||||
VariantClear(&result);
|
||||
|
||||
V_BOOL(&right) = VARIANT_FALSE;
|
||||
hres = VarCat(&left, &right, &result);
|
||||
hres = pVarCat(&left, &right, &result);
|
||||
ok(hres == S_OK, "VarCat failed: %08x\n", hres);
|
||||
test_bstr_var(&result, "TrueFalse");
|
||||
VariantClear(&result);
|
||||
|
@ -6363,12 +6381,12 @@ static void test_VarAnd(void)
|
|||
SysFreeString(false_str);
|
||||
}
|
||||
|
||||
static HRESULT (WINAPI *pVarCmp)(LPVARIANT,LPVARIANT,LCID,ULONG);
|
||||
|
||||
static void test_cmp( int line, LCID lcid, UINT flags, VARIANT *left, VARIANT *right, HRESULT result )
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
CHECKPTR(VarCmp);
|
||||
|
||||
hres = pVarCmp(left,right,lcid,flags);
|
||||
ok_(__FILE__,line)(hres == result, "VarCmp(%s,%s): expected 0x%x, got hres=0x%x\n",
|
||||
variantstr(left), variantstr(right), result, hres );
|
||||
|
@ -8700,8 +8718,8 @@ START_TEST(vartest)
|
|||
test_VarEqv();
|
||||
test_VarMul();
|
||||
test_VarAdd();
|
||||
test_VarCmp(); /* Before test_VarCat() which needs VarCmp() */
|
||||
test_VarCat();
|
||||
test_VarCmp();
|
||||
test_VarAnd();
|
||||
test_VarDiv();
|
||||
test_VarIdiv();
|
||||
|
|
Loading…
Reference in New Issue