[PATCH 2/2] shell32/tests: Some tests for ExtractAssociatedIcon()
Nikolay Sivov
nsivov at codeweavers.com
Sun Jan 8 12:54:47 CST 2017
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/shell32/tests/shelllink.c | 52 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c
index 293f69c10d..b789db4a18 100644
--- a/dlls/shell32/tests/shelllink.c
+++ b/dlls/shell32/tests/shelllink.c
@@ -1246,6 +1246,57 @@ todo_wine
ok(r, "failed to delete file %s (%d)\n", path, GetLastError());
}
+static void test_ExtractAssociatedIcon(void)
+{
+ char pathA[MAX_PATH];
+ HICON hicon;
+ WORD index;
+
+ /* empty path */
+ index = 0;
+ *pathA = 0;
+ hicon = ExtractAssociatedIconA(NULL, pathA, &index);
+todo_wine {
+ ok(hicon != NULL, "Got icon %p\n", hicon);
+ ok(!*pathA, "Unexpected path %s\n", pathA);
+ ok(index == 0, "Unexpected index %u\n", index);
+}
+ DestroyIcon(hicon);
+
+ /* by index */
+ index = 0;
+ strcpy(pathA, "shell32.dll");
+ hicon = ExtractAssociatedIconA(NULL, pathA, &index);
+ ok(hicon != NULL, "Got icon %p\n", hicon);
+ ok(!strcmp(pathA, "shell32.dll"), "Unexpected path %s\n", pathA);
+ ok(index == 0, "Unexpected index %u\n", index);
+ DestroyIcon(hicon);
+
+ /* valid dll name, invalid index */
+ index = 5000;
+ strcpy(pathA, "user32.dll");
+ hicon = ExtractAssociatedIconA(NULL, pathA, &index);
+ CharLowerBuffA(pathA, -1);
+todo_wine {
+ ok(hicon != NULL, "Got icon %p\n", hicon);
+ ok(!!strstr(pathA, "shell32.dll"), "Unexpected path %s\n", pathA);
+}
+ ok(index != 5000, "Unexpected index %u\n", index);
+ DestroyIcon(hicon);
+
+ /* associated icon */
+ index = 0xcaca;
+ strcpy(pathA, "dummy.exe");
+ hicon = ExtractAssociatedIconA(NULL, pathA, &index);
+ CharLowerBuffA(pathA, -1);
+todo_wine {
+ ok(hicon != NULL, "Got icon %p\n", hicon);
+ ok(!!strstr(pathA, "shell32.dll"), "Unexpected path %s\n", pathA);
+}
+ ok(index != 0xcaca, "Unexpected index %u\n", index);
+ DestroyIcon(hicon);
+}
+
START_TEST(shelllink)
{
HRESULT r;
@@ -1275,6 +1326,7 @@ START_TEST(shelllink)
test_SHExtractIcons();
test_propertystore();
test_ExtractIcon();
+ test_ExtractAssociatedIcon();
CoUninitialize();
}
--
2.11.0
More information about the wine-patches
mailing list