Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
6ee95c77
Commit
6ee95c77
authored
Aug 23, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 23, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Correctly test VARIANT_BOOL value in VarCat.
parent
bf4b8691
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
+40
-2
vartest.c
dlls/oleaut32/tests/vartest.c
+38
-0
variant.c
dlls/oleaut32/variant.c
+2
-2
No files found.
dlls/oleaut32/tests/vartest.c
View file @
6ee95c77
...
...
@@ -345,6 +345,20 @@ static void test_var_call2( int line, HRESULT (WINAPI *func)(LPVARIANT,LPVARIANT
VariantClear
(
&
result
);
}
static
int
strcmp_wa
(
const
WCHAR
*
strw
,
const
char
*
stra
)
{
WCHAR
buf
[
512
];
MultiByteToWideChar
(
CP_ACP
,
0
,
stra
,
-
1
,
buf
,
sizeof
(
buf
));
return
lstrcmpW
(
strw
,
buf
);
}
#define test_bstr_var(a,b) _test_bstr_var(__LINE__,a,b)
static
void
_test_bstr_var
(
unsigned
line
,
const
VARIANT
*
v
,
const
char
*
str
)
{
ok_
(
__FILE__
,
line
)(
V_VT
(
v
)
==
VT_BSTR
,
"unexpected vt=%d
\n
"
,
V_VT
(
v
));
if
(
V_VT
(
v
)
==
VT_BSTR
)
ok
(
!
strcmp_wa
(
V_BSTR
(
v
),
str
),
"v=%s, expected %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
v
)),
str
);
}
static
void
test_VariantInit
(
void
)
{
...
...
@@ -5645,6 +5659,30 @@ static void test_VarCat(void)
VariantClear
(
&
right
);
VariantClear
(
&
result
);
VariantClear
(
&
expected
);
/* Test boolean conversion */
V_VT
(
&
left
)
=
VT_BOOL
;
V_BOOL
(
&
left
)
=
VARIANT_TRUE
;
V_VT
(
&
right
)
=
VT_BSTR
;
V_BSTR
(
&
right
)
=
SysAllocStringLen
(
NULL
,
0
);
hres
=
VarCat
(
&
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
);
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
);
ok
(
hres
==
S_OK
,
"VarCat failed: %08x
\n
"
,
hres
);
test_bstr_var
(
&
result
,
"TrueFalse"
);
VariantClear
(
&
result
);
}
else
{
skip
(
"Got %s as True, assuming non-English locale
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
result
)));
}
}
static
HRESULT
(
WINAPI
*
pVarAnd
)(
LPVARIANT
,
LPVARIANT
,
LPVARIANT
);
...
...
dlls/oleaut32/variant.c
View file @
6ee95c77
...
...
@@ -2624,7 +2624,7 @@ HRESULT WINAPI VarCat(LPVARIANT left, LPVARIANT right, LPVARIANT out)
{
/* Bools are handled as localized True/False strings instead of 0/-1 as in MSDN */
V_VT
(
&
bstrvar_left
)
=
VT_BSTR
;
if
(
V_BOOL
(
left
)
==
TRUE
)
if
(
V_BOOL
(
left
))
V_BSTR
(
&
bstrvar_left
)
=
SysAllocString
(
str_true
);
else
V_BSTR
(
&
bstrvar_left
)
=
SysAllocString
(
str_false
);
...
...
@@ -2664,7 +2664,7 @@ HRESULT WINAPI VarCat(LPVARIANT left, LPVARIANT right, LPVARIANT out)
{
/* Bools are handled as localized True/False strings instead of 0/-1 as in MSDN */
V_VT
(
&
bstrvar_right
)
=
VT_BSTR
;
if
(
V_BOOL
(
right
)
==
TRUE
)
if
(
V_BOOL
(
right
))
V_BSTR
(
&
bstrvar_right
)
=
SysAllocString
(
str_true
);
else
V_BSTR
(
&
bstrvar_right
)
=
SysAllocString
(
str_false
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment