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
c1645b6d
Commit
c1645b6d
authored
Jan 08, 2017
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/tests: Some tests for ExtractIcon().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b9181615
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
0 deletions
+97
-0
shelllink.c
dlls/shell32/tests/shelllink.c
+97
-0
No files found.
dlls/shell32/tests/shelllink.c
View file @
c1645b6d
...
...
@@ -1150,6 +1150,102 @@ static void test_propertystore(void)
IShellLinkW_Release
(
linkW
);
}
static
void
test_ExtractIcon
(
void
)
{
static
const
WCHAR
nameW
[]
=
{
'\\'
,
'e'
,
'x'
,
't'
,
'r'
,
'a'
,
'c'
,
't'
,
'i'
,
'c'
,
'o'
,
'n'
,
'_'
,
't'
,
'e'
,
's'
,
't'
,
'.'
,
't'
,
'x'
,
't'
,
0
};
static
const
WCHAR
shell32W
[]
=
{
's'
,
'h'
,
'e'
,
'l'
,
'l'
,
'3'
,
'2'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
WCHAR
pathW
[
MAX_PATH
];
HICON
hicon
,
hicon2
;
char
path
[
MAX_PATH
];
HANDLE
file
;
int
r
;
/* specified instance handle */
hicon
=
ExtractIconA
(
GetModuleHandleA
(
"shell32.dll"
),
NULL
,
0
);
todo_wine
ok
(
hicon
==
NULL
,
"Got icon %p
\n
"
,
hicon
);
hicon2
=
ExtractIconA
(
GetModuleHandleA
(
"shell32.dll"
),
"shell32.dll"
,
-
1
);
ok
(
hicon2
!=
NULL
,
"Got icon %p
\n
"
,
hicon2
);
/* existing index */
hicon
=
ExtractIconA
(
NULL
,
"shell32.dll"
,
0
);
ok
(
hicon
!=
NULL
&&
HandleToLong
(
hicon
)
!=
-
1
,
"Got icon %p
\n
"
,
hicon
);
DestroyIcon
(
hicon
);
/* returns number of resources */
hicon
=
ExtractIconA
(
NULL
,
"shell32.dll"
,
-
1
);
ok
(
HandleToLong
(
hicon
)
>
1
&&
hicon
==
hicon2
,
"Got icon %p
\n
"
,
hicon
);
/* invalid index, valid dll name */
hicon
=
ExtractIconA
(
NULL
,
"shell32.dll"
,
3000
);
ok
(
hicon
==
NULL
,
"Got icon %p
\n
"
,
hicon
);
/* Create a temporary non-executable file */
GetTempPathA
(
sizeof
(
path
),
path
);
strcat
(
path
,
"
\\
extracticon_test.txt"
);
file
=
CreateFileA
(
path
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"Failed to create a test file
\n
"
);
CloseHandle
(
file
);
hicon
=
ExtractIconA
(
NULL
,
path
,
0
);
todo_wine
ok
(
hicon
==
NULL
,
"Got icon %p
\n
"
,
hicon
);
hicon
=
ExtractIconA
(
NULL
,
path
,
-
1
);
ok
(
hicon
==
NULL
,
"Got icon %p
\n
"
,
hicon
);
hicon
=
ExtractIconA
(
NULL
,
path
,
1
);
todo_wine
ok
(
hicon
==
NULL
,
"Got icon %p
\n
"
,
hicon
);
r
=
DeleteFileA
(
path
);
ok
(
r
,
"failed to delete file %s (%d)
\n
"
,
path
,
GetLastError
());
/* same for W variant */
if
(
0
)
{
/* specified instance handle, crashes on XP, 2k3 */
hicon
=
ExtractIconW
(
GetModuleHandleA
(
"shell32.dll"
),
NULL
,
0
);
ok
(
hicon
==
NULL
,
"Got icon %p
\n
"
,
hicon
);
}
hicon2
=
ExtractIconW
(
GetModuleHandleA
(
"shell32.dll"
),
shell32W
,
-
1
);
ok
(
hicon2
!=
NULL
,
"Got icon %p
\n
"
,
hicon2
);
/* existing index */
hicon
=
ExtractIconW
(
NULL
,
shell32W
,
0
);
ok
(
hicon
!=
NULL
&&
HandleToLong
(
hicon
)
!=
-
1
,
"Got icon %p
\n
"
,
hicon
);
DestroyIcon
(
hicon
);
/* returns number of resources */
hicon
=
ExtractIconW
(
NULL
,
shell32W
,
-
1
);
ok
(
HandleToLong
(
hicon
)
>
1
&&
hicon
==
hicon2
,
"Got icon %p
\n
"
,
hicon
);
/* invalid index, valid dll name */
hicon
=
ExtractIconW
(
NULL
,
shell32W
,
3000
);
ok
(
hicon
==
NULL
,
"Got icon %p
\n
"
,
hicon
);
/* Create a temporary non-executable file */
GetTempPathW
(
sizeof
(
pathW
)
/
sizeof
(
pathW
[
0
]),
pathW
);
lstrcatW
(
pathW
,
nameW
);
file
=
CreateFileW
(
pathW
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"Failed to create a test file
\n
"
);
CloseHandle
(
file
);
hicon
=
ExtractIconW
(
NULL
,
pathW
,
0
);
todo_wine
ok
(
hicon
==
NULL
,
"Got icon %p
\n
"
,
hicon
);
hicon
=
ExtractIconW
(
NULL
,
pathW
,
-
1
);
ok
(
hicon
==
NULL
,
"Got icon %p
\n
"
,
hicon
);
hicon
=
ExtractIconW
(
NULL
,
pathW
,
1
);
todo_wine
ok
(
hicon
==
NULL
,
"Got icon %p
\n
"
,
hicon
);
r
=
DeleteFileW
(
pathW
);
ok
(
r
,
"failed to delete file %s (%d)
\n
"
,
path
,
GetLastError
());
}
START_TEST
(
shelllink
)
{
HRESULT
r
;
...
...
@@ -1178,6 +1274,7 @@ START_TEST(shelllink)
test_SHGetStockIconInfo
();
test_SHExtractIcons
();
test_propertystore
();
test_ExtractIcon
();
CoUninitialize
();
}
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