11#define _ATL_NO_VARIANT_THROW
55#define expect_bool (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_bool_imp
56#define expect_int (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_int_imp
57#define expect_uint (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_uint_imp
58#define expect_double (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_double_imp
59#define expect_error (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_error_imp
60#define expect_empty (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_empty_imp
70 CComBSTR bstr(
L"TESTW");
71 CComVariant olestr((LPCOLESTR)bstr), comstr(bstr);
72 ok(
V_VT(&olestr) ==
VT_BSTR,
"Expected .vt to be VT_LPWSTR, was %u\n",
V_VT(&olestr));
74 ok(
V_VT(&comstr) ==
VT_BSTR,
"Expected .vt to be VT_LPWSTR, was %u\n",
V_VT(&comstr));
78 CComVariant cstr((
LPCSTR)
"TESTA");
79 ok(
V_VT(&cstr) ==
VT_BSTR,
"Expected .vt to be VT_LPWSTR, was %u\n",
V_VT(&cstr));
83 CComVariant trueVal(
true), falseVal(
false);
84 ok(
V_VT(&trueVal) ==
VT_BOOL,
"Expected .vt to be BOOL, was %u\n",
V_VT(&trueVal));
85 ok(
V_BOOL(&trueVal) == VARIANT_TRUE,
"Expected value to be VARIANT_TRUE, was: %u\n",
V_BOOL(&trueVal));
86 ok(
V_VT(&falseVal) ==
VT_BOOL,
"Expected .vt to be BOOL, was %u\n",
V_VT(&falseVal));
87 ok(
V_BOOL(&falseVal) == VARIANT_FALSE,
"Expected value to be VARIANT_TRUE, was: %u\n",
V_BOOL(&falseVal));
95 CComVariant c1((
char)33);
96 ok(
V_VT(&c1) ==
VT_I1,
"Expected .vt to be VT_I1, was %u\n",
V_VT(&c1));
97 ok(
V_I1(&c1) == (
char)33,
"Expected value to be 33, was: %d\n",
V_I1(&c1));
100 CComVariant
s1((
short)12345);
102 ok(
V_I2(&
s1) == (
short)12345,
"Expected value to be 12345, was: %d\n",
V_I1(&
s1));
105 CComVariant us1((
unsigned short)12345);
106 ok(
V_VT(&us1) ==
VT_UI2,
"Expected .vt to be VT_UI2, was %u\n",
V_VT(&us1));
107 ok(
V_UI2(&us1) == (
unsigned short)12345,
"Expected value to be 12345, was: %u\n",
V_UI2(&us1));
110 CComVariant i1((
int)4,
VT_I4), i2((
int)3,
VT_INT), i3((
int)2,
VT_I2), i4((
int)1);
117 CComVariant ui1((
unsigned int)4,
VT_UI4), ui2((
unsigned int)3,
VT_UINT), ui3((
unsigned int)2,
VT_UI2), ui4((
unsigned int)1);
131 CComVariant ul1((
unsigned long)33);
135 CComVariant
f1(3.4f);
137 ok(
V_R4(&
f1) == 3.4f,
"Expected value to be 3.4f, was: %f\n",
V_R4(&
f1));
149 ok(
V_VT(&l1) ==
VT_I8,
"Expected .vt to be VT_I8, was %u\n",
V_VT(&l1));
160 cy.int64 = 12030912309123ll;
162 ok(
V_VT(&c1) ==
VT_CY,
"Expected .vt to be VT_CY, was %u\n",
V_VT(&c1));
174 CComVariant empty2(
empty);
178 CComBSTR bstr(
L"TESTW");
179 CComVariant olestr((LPCOLESTR)bstr);
180 CComVariant olestr2(olestr);
181 ok(
V_VT(&olestr2) ==
VT_BSTR,
"Expected .vt to be VT_LPWSTR, was %u\n",
V_VT(&olestr2));
185 CComVariant trueVal(
true);
186 CComVariant trueVal2(trueVal);
187 ok(
V_VT(&trueVal2) ==
VT_BOOL,
"Expected .vt to be BOOL, was %u\n",
V_VT(&trueVal2));
188 ok(
V_BOOL(&trueVal2) == VARIANT_TRUE,
"Expected value to be VARIANT_TRUE, was: %u\n",
V_BOOL(&trueVal2));
197 CComVariant c1((
char)33);
199 ok(
V_VT(&c2) ==
VT_I1,
"Expected .vt to be VT_I1, was %u\n",
V_VT(&c2));
200 ok(
V_I1(&c2) == (
char)33,
"Expected value to be 33, was: %d\n",
V_I1(&c2));
203 CComVariant
s1((
short)12345);
206 ok(
V_I2(&
s2) == (
short)12345,
"Expected value to be 12345, was: %d\n",
V_I1(&
s2));
209 CComVariant us1((
unsigned short)12345);
210 CComVariant us2(us1);
211 ok(
V_VT(&us2) ==
VT_UI2,
"Expected .vt to be VT_UI2, was %u\n",
V_VT(&us2));
212 ok(
V_UI2(&us2) == (
unsigned short)12345,
"Expected value to be 12345, was: %u\n",
V_UI2(&us2));
215 CComVariant i1((
int)4,
VT_I4);
220 CComVariant ui1((
unsigned int)4,
VT_UI4);
221 CComVariant ui2(ui1);
225 CComVariant l1((
long)4,
VT_I4);
230 CComVariant ul1((
unsigned long)33);
231 CComVariant ul2(ul1);
235 CComVariant
f1(3.4f);
238 ok(
V_R4(&
f2) == 3.4f,
"Expected value to be 3.4f, was: %f\n",
V_R4(&
f2));
241 CComVariant d1(3.4,
VT_R8);
249 ok(
V_VT(&l2) ==
VT_I8,
"Expected .vt to be VT_I8, was %u\n",
V_VT(&l2));
261 cy.int64 = 12030912309123ll;
264 ok(
V_VT(&c2) ==
VT_CY,
"Expected .vt to be VT_I8, was %u\n",
V_VT(&c2));
275 CComVariant empty2 =
empty;
279 CComBSTR bstr(
L"TESTW");
280 CComVariant olestr = (LPCOLESTR)bstr;
281 ok(
V_VT(&olestr) ==
VT_BSTR,
"Expected .vt to be VT_LPWSTR, was %u\n",
V_VT(&olestr));
283 CComVariant olestr2 = olestr;
284 ok(
V_VT(&olestr2) ==
VT_BSTR,
"Expected .vt to be VT_LPWSTR, was %u\n",
V_VT(&olestr2));
288 CComVariant trueVal =
true;
289 ok(
V_VT(&trueVal) ==
VT_BOOL,
"Expected .vt to be BOOL, was %u\n",
V_VT(&trueVal));
290 ok(
V_BOOL(&trueVal) == VARIANT_TRUE,
"Expected value to be VARIANT_TRUE, was: %u\n",
V_BOOL(&trueVal));
291 CComVariant trueVal2 = trueVal;
292 ok(
V_VT(&trueVal2) ==
VT_BOOL,
"Expected .vt to be BOOL, was %u\n",
V_VT(&trueVal2));
293 ok(
V_BOOL(&trueVal2) == VARIANT_TRUE,
"Expected value to be VARIANT_TRUE, was: %u\n",
V_BOOL(&trueVal2));
296 CComVariant
b1 = (
BYTE)33;
304 CComVariant c1 = (
char)33;
305 ok(
V_VT(&c1) ==
VT_I1,
"Expected .vt to be VT_I1, was %u\n",
V_VT(&c1));
306 ok(
V_I1(&c1) == (
char)33,
"Expected value to be 33, was: %d\n",
V_I1(&c1));
308 ok(
V_VT(&c2) ==
VT_I1,
"Expected .vt to be VT_I1, was %u\n",
V_VT(&c2));
309 ok(
V_I1(&c2) == (
char)33,
"Expected value to be 33, was: %d\n",
V_I1(&c2));
314 ok(
V_I2(&
s1) == (
short)12345,
"Expected value to be 12345, was: %d\n",
V_I1(&
s1));
317 ok(
V_I2(&
s2) == (
short)12345,
"Expected value to be 12345, was: %d\n",
V_I1(&
s2));
320 CComVariant us1 = (
unsigned short)12345;
321 ok(
V_VT(&us1) ==
VT_UI2,
"Expected .vt to be VT_UI2, was %u\n",
V_VT(&us1));
322 ok(
V_UI2(&us1) == (
unsigned short)12345,
"Expected value to be 12345, was: %u\n",
V_UI2(&us1));
323 CComVariant us2 = us1;
324 ok(
V_VT(&us2) ==
VT_UI2,
"Expected .vt to be VT_UI2, was %u\n",
V_VT(&us2));
325 ok(
V_UI2(&us2) == (
unsigned short)12345,
"Expected value to be 12345, was: %u\n",
V_UI2(&us2));
328 CComVariant i1 = (
int)4;
334 CComVariant ui1 = (
unsigned int)4;
336 CComVariant ui2 = ui1;
340 CComVariant l1 = (
long)4;
346 CComVariant ul1 = (
unsigned long)33;
348 CComVariant ul2 = ul1;
352 CComVariant
f1 = 3.4f;
354 ok(
V_R4(&
f1) == 3.4f,
"Expected value to be 3.4f, was: %f\n",
V_R4(&
f1));
357 ok(
V_R4(&
f2) == 3.4f,
"Expected value to be 3.4f, was: %f\n",
V_R4(&
f2));
360 CComVariant d1 = 3.4;
368 ok(
V_VT(&l1) ==
VT_I8,
"Expected .vt to be VT_I8, was %u\n",
V_VT(&l1));
371 ok(
V_VT(&l2) ==
VT_I8,
"Expected .vt to be VT_I8, was %u\n",
V_VT(&l2));
385 cy.int64 = 12030912309123ll;
387 ok(
V_VT(&c1) ==
VT_CY,
"Expected .vt to be VT_I8, was %u\n",
V_VT(&c1));
390 ok(
V_VT(&c2) ==
VT_CY,
"Expected .vt to be VT_I8, was %u\n",
V_VT(&c2));
403 ok(
SUCCEEDED(
hr),
"Expected .Clear() to succeed, but it failed: 0x%lx\n",
hr);
408 CComBSTR bstr(
L"TESTW");
409 CComVariant olestr((LPCOLESTR)bstr),
empty;
412 ok(
SUCCEEDED(
hr),
"Expected .Copy() to succeed, but it failed: 0x%lx\n",
hr);
418 ok(
SUCCEEDED(
hr),
"Expected .Clear() to succeed, but it failed: 0x%lx\n",
hr);
419 ok(
V_VT(&olestr) ==
VT_EMPTY,
"Expected .vt to be VT_EMPTY, was %u\n",
V_VT(&olestr));
425 ok(
SUCCEEDED(
hr),
"Expected .Copy() to succeed, but it failed: 0x%lx\n",
hr);
434 ok(
SUCCEEDED(
hr),
"Expected .Copy() to succeed, but it failed: 0x%lx\n",
hr);
441 cy.int64 = 12030912309123ll;
445 ok(
SUCCEEDED(
hr),
"Expected .Copy() to succeed, but it failed: 0x%lx\n",
hr);
450 CComVariant
var = (
int)333;
454 ok(
SUCCEEDED(
hr),
"Expected .ChangeType() to succeed, but it failed: 0x%lx\n",
hr);
456 ok(
V_VT(&var2) ==
VT_BSTR,
"Expected .vt to be VT_LPWSTR, was %u\n",
V_VT(&var2));
461 ok(
SUCCEEDED(
hr),
"Expected .ChangeType() to succeed, but it failed: 0x%lx\n",
hr);
static void test_construction()
void expect_double_imp(const CComVariant &ccv, double value, unsigned short type)
void expect_int_imp(const CComVariant &ccv, int value, unsigned short type)
void expect_bool_imp(const CComVariant &ccv, bool value)
void expect_uint_imp(const CComVariant &ccv, unsigned int value, unsigned short type)
static void test_copyconstructor()
static void test_assign()
void expect_error_imp(const CComVariant &ccv, SCODE value)
void expect_empty_imp(const CComVariant &ccv)
static BOOL IsWindows8OrGreater()
static const WCHAR empty[]
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
GLuint GLuint GLsizei GLenum type
static CRYPT_DATA_BLOB b2[]
static CRYPT_DATA_BLOB b1[]
_Out_opt_ int _Out_opt_ int * cy
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)