[PATCH v2 3/3] shell32/tests: Test ImageList sync when loading an executable's icon
Gabriel Ivăncescu
gabrielopcode at gmail.com
Tue Oct 30 07:38:16 CDT 2018
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
test.ico is just a black icon of size 32x32.
dlls/shell32/tests/rsrc.rc | 2 ++
dlls/shell32/tests/shelllink.c | 43 +++++++++++++++++++++++++++++++++++++++++
dlls/shell32/tests/test.ico | Bin 0 -> 3262 bytes
3 files changed, 45 insertions(+)
create mode 100644 dlls/shell32/tests/test.ico
diff --git a/dlls/shell32/tests/rsrc.rc b/dlls/shell32/tests/rsrc.rc
index 00c949b..0706028 100644
--- a/dlls/shell32/tests/rsrc.rc
+++ b/dlls/shell32/tests/rsrc.rc
@@ -26,3 +26,5 @@ STRINGTABLE
{
1 "Folder Name Resource"
}
+
+1 ICON "test.ico"
diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c
index 3bfd9cb..4feb5dd 100644
--- a/dlls/shell32/tests/shelllink.c
+++ b/dlls/shell32/tests/shelllink.c
@@ -47,6 +47,7 @@ static HRESULT (WINAPI *pSHGetStockIconInfo)(SHSTOCKICONID, UINT, SHSTOCKICONINF
static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR, LPSTR, DWORD);
static DWORD (WINAPI *pGetShortPathNameA)(LPCSTR, LPSTR, DWORD);
static UINT (WINAPI *pSHExtractIconsW)(LPCWSTR, int, int, int, HICON *, UINT *, UINT, UINT);
+static DWORD_PTR (WINAPI *pSHGetFileInfoW)(LPCWSTR, DWORD, SHFILEINFOW *, UINT, UINT);
static BOOL (WINAPI *pIsProcessDPIAware)(void);
static const GUID _IID_IShellLinkDataList = {
@@ -1477,6 +1478,46 @@ static void test_SHGetImageList(void)
}
}
+static void test_ImageList_sync(void)
+{
+ static const UINT ImageList_size[] = { SHIL_LARGE, SHIL_SMALL };
+ int count[ARRAY_SIZE(ImageList_size)];
+ WCHAR buf[MAX_PATH];
+ SHFILEINFOW info;
+ DWORD nr;
+ UINT i;
+
+ if (!pSHGetFileInfoW)
+ {
+ win_skip("SHGetFileInfoW not available\n");
+ return;
+ }
+
+ nr = GetModuleFileNameW(NULL, buf, ARRAY_SIZE(buf));
+ ok(nr, "GetModuleFileName failed, last error %08x\n", GetLastError());
+ if (!nr) return;
+
+ nr = pSHGetFileInfoW(buf, 0, &info, sizeof(info), SHGFI_ICON);
+ ok(nr, "SHGetFileInfo returned 0, last error %08x\n", GetLastError());
+ if (!nr) return;
+
+ ok(info.hIcon != NULL, "NULL icon\n");
+ DestroyIcon(info.hIcon);
+
+ for (i = 0; i < ARRAY_SIZE(ImageList_size); i++)
+ {
+ IImageList *il;
+ HRESULT hr;
+
+ hr = SHGetImageList(ImageList_size[i], &IID_IImageList, (void**)&il);
+ ok(hr == S_OK, "got %08x\n", hr);
+ hr = IImageList_GetImageCount(il, &count[i]);
+ ok(hr == S_OK, "got %08x\n", hr);
+ IImageList_Release(il);
+ }
+ ok(count[0] == count[1], "ImageLists out of sync (large: %d, small: %d)\n", count[0], count[1]);
+}
+
START_TEST(shelllink)
{
HRESULT r;
@@ -1493,6 +1534,7 @@ START_TEST(shelllink)
pGetLongPathNameA = (void *)GetProcAddress(hkernel32, "GetLongPathNameA");
pGetShortPathNameA = (void *)GetProcAddress(hkernel32, "GetShortPathNameA");
pSHExtractIconsW = (void *)GetProcAddress(hmod, "SHExtractIconsW");
+ pSHGetFileInfoW = (void *)GetProcAddress(hmod, "SHGetFileInfoW");
pIsProcessDPIAware = (void *)GetProcAddress(huser32, "IsProcessDPIAware");
r = CoInitialize(NULL);
@@ -1511,6 +1553,7 @@ START_TEST(shelllink)
test_ExtractIcon();
test_ExtractAssociatedIcon();
test_SHGetImageList();
+ test_ImageList_sync();
CoUninitialize();
}
diff --git a/dlls/shell32/tests/test.ico b/dlls/shell32/tests/test.ico
new file mode 100644
index 0000000000000000000000000000000000000000..88ad5974402a9aa222899f05390fb6ada6067135
GIT binary patch
literal 3262
zcmeIup%DNe5Cg%(qZ#B&%Aj1zBvgU9|4BsTLd#c?o}3N?SV<;!@^()F1r$&~0R<FL
LKmi35_$_b&hYA75
literal 0
HcmV?d00001
--
1.9.1
More information about the wine-devel
mailing list