Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4cc41fc5
Commit
4cc41fc5
authored
Jan 19, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32/tests: Use SafeArraySetIID() directly.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5b6920bd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
62 deletions
+27
-62
safearray.c
dlls/oleaut32/tests/safearray.c
+27
-62
No files found.
dlls/oleaut32/tests/safearray.c
View file @
4cc41fc5
...
...
@@ -47,8 +47,6 @@ static HMODULE hOleaut32;
static
HRESULT
(
WINAPI
*
pSafeArrayAllocDescriptorEx
)(
VARTYPE
,
UINT
,
SAFEARRAY
**
);
static
HRESULT
(
WINAPI
*
pSafeArrayCopyData
)(
SAFEARRAY
*
,
SAFEARRAY
*
);
static
HRESULT
(
WINAPI
*
pSafeArrayGetIID
)(
SAFEARRAY
*
,
GUID
*
);
static
HRESULT
(
WINAPI
*
pSafeArraySetIID
)(
SAFEARRAY
*
,
REFGUID
);
static
HRESULT
(
WINAPI
*
pSafeArrayGetVartype
)(
SAFEARRAY
*
,
VARTYPE
*
);
static
HRESULT
(
WINAPI
*
pSafeArrayGetRecordInfo
)(
SAFEARRAY
*
,
IRecordInfo
**
);
static
SAFEARRAY
*
(
WINAPI
*
pSafeArrayCreateEx
)(
VARTYPE
,
UINT
,
SAFEARRAYBOUND
*
,
LPVOID
);
...
...
@@ -688,22 +686,20 @@ static void test_safearray(void)
/* IID functions */
/* init a small stack safearray */
if
(
pSafeArraySetIID
)
{
memset
(
&
b
,
0
,
sizeof
(
b
));
b
.
cDims
=
1
;
memset
(
&
iid
,
0x42
,
sizeof
(
IID
));
hres
=
pSafeArraySetIID
(
&
b
,
&
iid
);
ok
(
hres
==
E_INVALIDARG
,
"SafeArraySetIID of non IID capable safearray did not return E_INVALIDARG, but %x
\n
"
,
hres
);
hres
=
SafeArraySetIID
(
&
b
,
&
iid
);
ok
(
hres
==
E_INVALIDARG
,
"Unexpected ret value %#x.
\n
"
,
hres
);
hres
=
SafeArrayAllocDescriptor
(
1
,
&
a
);
ok
(
hres
==
S_OK
,
"SafeArrayAllocDescriptor should return S_OK, but got %x
\n
"
,
hres
);
ok
((
a
->
fFeatures
&
FADF_HAVEIID
)
==
0
,
"newly allocated descriptor with SAAD should not have FADF_HAVEIID
\n
"
);
hres
=
pSafeArraySetIID
(
a
,
&
iid
);
ok
(
hres
==
E_INVALIDARG
,
"SafeArraySetIID of newly allocated descriptor with SAAD should return E_INVALIDARG, but got %x
\n
"
,
hres
);
hres
=
SafeArrayAllocDescriptor
(
1
,
&
a
);
ok
(
hres
==
S_OK
,
"Failed to allocate array descriptor, hr %#x.
\n
"
,
hres
);
ok
((
a
->
fFeatures
&
FADF_HAVEIID
)
==
0
,
"Unexpected features mask %#x.
\n
"
,
a
->
fFeatures
);
hres
=
SafeArraySetIID
(
a
,
&
iid
);
ok
(
hres
==
E_INVALIDARG
,
"Unexpected ret value %#x.
\n
"
,
hres
);
hres
=
SafeArrayDestroyDescriptor
(
a
);
ok
(
hres
==
S_OK
,
"SADD failed with hres %x
\n
"
,
hres
);
}
if
(
!
pSafeArrayAllocDescriptorEx
)
return
;
...
...
@@ -714,7 +710,7 @@ static void test_safearray(void)
ok
(
hres
==
S_OK
,
"SafeArrayAllocDescriptorEx gave hres 0x%x
\n
"
,
hres
);
ok
(
a
->
fFeatures
==
vttypes
[
i
].
expflags
,
"SAADE(%d) resulted with flags %x, expected %x
\n
"
,
vttypes
[
i
].
vt
,
a
->
fFeatures
,
vttypes
[
i
].
expflags
);
if
(
a
->
fFeatures
&
FADF_HAVEIID
)
{
hres
=
p
SafeArrayGetIID
(
a
,
&
iid
);
hres
=
SafeArrayGetIID
(
a
,
&
iid
);
ok
(
hres
==
S_OK
,
"SAGIID failed for vt %d with hres %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
switch
(
vttypes
[
i
].
vt
)
{
case
VT_UNKNOWN
:
...
...
@@ -730,7 +726,7 @@ static void test_safearray(void)
break
;
}
}
else
{
hres
=
p
SafeArrayGetIID
(
a
,
&
iid
);
hres
=
SafeArrayGetIID
(
a
,
&
iid
);
ok
(
hres
==
E_INVALIDARG
,
"SAGIID did not fail for vt %d with hres %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
}
if
(
a
->
fFeatures
&
FADF_RECORD
)
{
...
...
@@ -751,13 +747,13 @@ static void test_safearray(void)
}
if
(
a
->
fFeatures
&
FADF_HAVEIID
)
{
hres
=
p
SafeArraySetIID
(
a
,
&
IID_IStorage
);
/* random IID */
hres
=
SafeArraySetIID
(
a
,
&
IID_IStorage
);
/* random IID */
ok
(
hres
==
S_OK
,
"SASIID failed with FADF_HAVEIID set for vt %d with %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
hres
=
p
SafeArrayGetIID
(
a
,
&
iid
);
hres
=
SafeArrayGetIID
(
a
,
&
iid
);
ok
(
hres
==
S_OK
,
"SAGIID failed with FADF_HAVEIID set for vt %d with %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
ok
(
IsEqualGUID
(
&
iid
,
&
IID_IStorage
),
"returned iid is not IID_IStorage
\n
"
);
}
else
{
hres
=
p
SafeArraySetIID
(
a
,
&
IID_IStorage
);
/* random IID */
hres
=
SafeArraySetIID
(
a
,
&
IID_IStorage
);
/* random IID */
ok
(
hres
==
E_INVALIDARG
,
"SASIID did not failed with !FADF_HAVEIID set for vt %d with %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
}
hres
=
SafeArrayDestroyDescriptor
(
a
);
...
...
@@ -885,12 +881,8 @@ static void test_SafeArrayCreateLockDestroy(void)
{
ok
((
sa
->
fFeatures
&
FADF_HAVEIID
)
==
0
,
"Non interface type should not have FADF_HAVEIID
\n
"
);
if
(
pSafeArraySetIID
)
{
hres
=
pSafeArraySetIID
(
sa
,
&
IID_IUnknown
);
ok
(
hres
==
E_INVALIDARG
,
"Non interface type allowed SetIID(), hres %x
\n
"
,
hres
);
}
hres
=
SafeArraySetIID
(
sa
,
&
IID_IUnknown
);
ok
(
hres
==
E_INVALIDARG
,
"Unexpected ret value %#x.
\n
"
,
hres
);
if
(
vt
!=
VT_RECORD
)
{
VARTYPE
aVt
;
...
...
@@ -908,12 +900,8 @@ static void test_SafeArrayCreateLockDestroy(void)
else
{
ok
(
sa
->
fFeatures
&
FADF_HAVEIID
,
"Interface type should have FADF_HAVEIID
\n
"
);
if
(
pSafeArraySetIID
)
{
hres
=
pSafeArraySetIID
(
sa
,
&
IID_IUnknown
);
ok
(
hres
==
S_OK
,
"Non interface type disallowed SetIID(), hres %x
\n
"
,
hres
);
}
hres
=
SafeArraySetIID
(
sa
,
&
IID_IUnknown
);
ok
(
hres
==
S_OK
,
"Failed to set array IID, hres %#x.
\n
"
,
hres
);
ok
((
sa
->
fFeatures
&
FADF_HAVEVARTYPE
)
==
0
,
"Interface type %d should not have FADF_HAVEVARTYPE
\n
"
,
vt
);
}
...
...
@@ -1544,25 +1532,14 @@ static void test_SafeArrayCreateEx(void)
if
(
sa
)
{
GUID
guid
;
if
(
pSafeArrayGetIID
)
{
hres
=
pSafeArrayGetIID
(
sa
,
&
guid
);
ok
(
hres
==
S_OK
,
"CreateEx (ITypeInfo) no IID hres 0x%x
\n
"
,
hres
);
if
(
hres
==
S_OK
)
{
hres
=
SafeArrayGetIID
(
sa
,
&
guid
);
ok
(
hres
==
S_OK
,
"Failed to get array IID, hres %#x.
\n
"
,
hres
);
ok
(
IsEqualGUID
(
&
guid
,
&
IID_ITypeInfo
),
"CreateEx (ITypeInfo) bad IID
\n
"
);
}
}
if
(
pSafeArraySetIID
)
{
hres
=
pSafeArraySetIID
(
sa
,
&
IID_IUnknown
);
hres
=
SafeArraySetIID
(
sa
,
&
IID_IUnknown
);
ok
(
hres
==
S_OK
,
"Failed to set IID, hres = %8x
\n
"
,
hres
);
if
(
hres
==
S_OK
&&
pSafeArrayGetIID
)
{
hres
=
pSafeArrayGetIID
(
sa
,
&
guid
);
hres
=
SafeArrayGetIID
(
sa
,
&
guid
);
ok
(
hres
==
S_OK
&&
IsEqualGUID
(
&
guid
,
&
IID_IUnknown
),
"Set bad IID
\n
"
);
}
}
hres
=
SafeArrayDestroy
(
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
}
...
...
@@ -1573,15 +1550,10 @@ static void test_SafeArrayCreateEx(void)
if
(
sa
)
{
GUID
guid
;
if
(
pSafeArrayGetIID
)
{
hres
=
pSafeArrayGetIID
(
sa
,
&
guid
);
ok
(
hres
==
S_OK
,
"CreateEx (NULL) no IID hres 0x%x
\n
"
,
hres
);
if
(
hres
==
S_OK
)
{
hres
=
SafeArrayGetIID
(
sa
,
&
guid
);
ok
(
hres
==
S_OK
,
"Failed to get array IID, hres %#x.
\n
"
,
hres
);
ok
(
IsEqualGUID
(
&
guid
,
&
IID_IDispatch
),
"CreateEx (NULL) bad IID
\n
"
);
}
}
hres
=
SafeArrayDestroy
(
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
}
...
...
@@ -1592,15 +1564,10 @@ static void test_SafeArrayCreateEx(void)
if
(
sa
)
{
GUID
guid
;
if
(
pSafeArrayGetIID
)
{
hres
=
pSafeArrayGetIID
(
sa
,
&
guid
);
ok
(
hres
==
S_OK
,
"CreateEx (NULL-Unk) no IID hres 0x%x
\n
"
,
hres
);
if
(
hres
==
S_OK
)
{
hres
=
SafeArrayGetIID
(
sa
,
&
guid
);
ok
(
hres
==
S_OK
,
"Failed to get array IID, hres %#x.
\n
"
,
hres
);
ok
(
IsEqualGUID
(
&
guid
,
&
IID_IUnknown
),
"CreateEx (NULL-Unk) bad IID
\n
"
);
}
}
hres
=
SafeArrayDestroy
(
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
}
...
...
@@ -2125,8 +2092,6 @@ START_TEST(safearray)
GETPTR
(
SafeArrayAllocDescriptorEx
);
GETPTR
(
SafeArrayCopyData
);
GETPTR
(
SafeArrayGetIID
);
GETPTR
(
SafeArraySetIID
);
GETPTR
(
SafeArrayGetVartype
);
GETPTR
(
SafeArrayCreateEx
);
GETPTR
(
SafeArrayCreateVector
);
...
...
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