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
9e05c66c
Commit
9e05c66c
authored
Mar 16, 2016
by
Theodore Dubois
Committed by
Alexandre Julliard
Mar 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/tests: Additional tests for IQueryAssociations.
Signed-off-by:
Theodore Dubois
<
tblodt@icloud.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
04a339e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
assoc.c
dlls/shell32/tests/assoc.c
+65
-0
No files found.
dlls/shell32/tests/assoc.c
View file @
9e05c66c
...
...
@@ -100,14 +100,79 @@ static struct assoc_getstring_test getstring_tests[] =
{
NULL
}
};
static
void
getstring_test
(
LPCWSTR
assocName
,
HKEY
progIdKey
,
ASSOCSTR
str
,
LPCWSTR
expected_string
,
int
line_num
)
{
IQueryAssociations
*
assoc
;
HRESULT
hr
;
WCHAR
*
buffer
;
DWORD
len
;
hr
=
CoCreateInstance
(
&
CLSID_QueryAssociations
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IQueryAssociations
,
(
void
*
)
&
assoc
);
ok
(
hr
==
S_OK
,
"line %d: failed to create IQueryAssociations, 0x%x
\n
"
,
line_num
,
hr
);
hr
=
IQueryAssociations_Init
(
assoc
,
0
,
assocName
,
progIdKey
,
NULL
);
ok
(
hr
==
S_OK
,
"line %d: IQueryAssociations::Init failed, 0x%x
\n
"
,
line_num
,
hr
);
hr
=
IQueryAssociations_GetString
(
assoc
,
0
,
str
,
NULL
,
NULL
,
&
len
);
if
(
hr
!=
S_FALSE
)
{
if
(
expected_string
)
{
ok
(
SUCCEEDED
(
hr
),
"line %d: GetString returned 0x%x, expected success
\n
"
,
line_num
,
hr
);
}
else
{
ok
(
FAILED
(
hr
),
"line %d: GetString returned 0x%x, expected failure
\n
"
,
line_num
,
hr
);
}
}
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
ok
(
buffer
!=
NULL
,
"line %d: out of memory
\n
"
,
line_num
);
hr
=
IQueryAssociations_GetString
(
assoc
,
0
,
str
,
NULL
,
buffer
,
&
len
);
if
(
expected_string
)
{
ok
(
lstrcmpW
(
buffer
,
expected_string
)
==
0
,
"line %d: GetString returned %s, expected %s
\n
"
,
line_num
,
wine_dbgstr_w
(
buffer
),
wine_dbgstr_w
(
expected_string
));
}
}
static
void
test_IQueryAssociations_GetString
(
void
)
{
static
WCHAR
test_extensionW
[]
=
{
'.'
,
't'
,
'e'
,
's'
,
't'
,
0
};
static
WCHAR
test_progidW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'f'
,
'i'
,
'l'
,
'e'
,
0
};
static
WCHAR
DefaultIconW
[]
=
{
'D'
,
'e'
,
'f'
,
'a'
,
'u'
,
'l'
,
't'
,
'I'
,
'c'
,
'o'
,
'n'
,
0
};
/* folder.ico, why not */
static
WCHAR
test_iconW
[]
=
{
's'
,
'h'
,
'e'
,
'l'
,
'l'
,
'3'
,
'2'
,
'.'
,
'd'
,
'l'
,
'l'
,
','
,
'1'
,
0
};
HKEY
test_extension_key
;
HKEY
test_progid_key
;
HKEY
test_defaulticon_key
;
LRESULT
r
;
struct
assoc_getstring_test
*
ptr
=
getstring_tests
;
IQueryAssociations
*
assoc
;
HRESULT
hr
;
DWORD
len
;
int
i
=
0
;
r
=
RegCreateKeyExW
(
HKEY_CLASSES_ROOT
,
test_extensionW
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
test_extension_key
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"RegCreateKeyExW(HKCR,
\"
.test
\"
) failed: 0x%lx
\n
"
,
r
);
r
=
RegSetValueExW
(
test_extension_key
,
NULL
,
0
,
REG_SZ
,
(
PBYTE
)
test_progidW
,
sizeof
(
test_progidW
));
ok
(
r
==
ERROR_SUCCESS
,
"RegSetValueExW(HKCR
\\
.test, NULL,
\"
testfile
\"
) failed: 0x%lx
\n
"
,
r
);
/* adding progid key with no information shuld fail to return information */
r
=
RegCreateKeyExW
(
HKEY_CLASSES_ROOT
,
test_progidW
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
test_progid_key
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"RegCreateKeyExW(HKCR,
\"
testfile
\"
) failed: 0x%lx
\n
"
,
r
);
getstring_test
(
test_extensionW
,
NULL
,
ASSOCSTR_DEFAULTICON
,
NULL
,
__LINE__
);
getstring_test
(
test_progidW
,
NULL
,
ASSOCSTR_DEFAULTICON
,
NULL
,
__LINE__
);
getstring_test
(
NULL
,
test_progid_key
,
ASSOCSTR_DEFAULTICON
,
NULL
,
__LINE__
);
/* adding information to the progid should return that information */
r
=
RegCreateKeyExW
(
test_progid_key
,
DefaultIconW
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
test_defaulticon_key
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"RegCreateKeyExW(HKCR
\\
testfile
\\
DefaultIcon) failed: 0x%lx
\n
"
,
r
);
r
=
RegSetValueExW
(
test_defaulticon_key
,
NULL
,
0
,
REG_SZ
,
(
PBYTE
)
test_iconW
,
sizeof
(
test_iconW
));
ok
(
r
==
ERROR_SUCCESS
,
"RegSetValueExW(HKCR
\\
testfile
\\
DefaultIcon, NULL,
\"
folder.ico
\"
) failed: 0x%lx
\n
"
,
r
);
getstring_test
(
test_extensionW
,
NULL
,
ASSOCSTR_DEFAULTICON
,
test_iconW
,
__LINE__
);
getstring_test
(
test_progidW
,
NULL
,
ASSOCSTR_DEFAULTICON
,
test_iconW
,
__LINE__
);
getstring_test
(
NULL
,
test_progid_key
,
ASSOCSTR_DEFAULTICON
,
test_iconW
,
__LINE__
);
RegDeleteKeyW
(
HKEY_CLASSES_ROOT
,
test_extensionW
);
RegDeleteKeyW
(
HKEY_CLASSES_ROOT
,
test_progidW
);
hr
=
CoCreateInstance
(
&
CLSID_QueryAssociations
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IQueryAssociations
,
(
void
*
)
&
assoc
);
ok
(
hr
==
S_OK
,
"failed to create object, 0x%x
\n
"
,
hr
);
...
...
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