Jacek Caban : win32u/tests: Add cursor icon tests.
Alexandre Julliard
julliard at winehq.org
Wed Feb 23 16:00:06 CST 2022
Module: wine
Branch: master
Commit: 745b6a300ac031435c1ebe146aa6b4eb791eccb9
URL: https://source.winehq.org/git/wine.git/?a=commit;h=745b6a300ac031435c1ebe146aa6b4eb791eccb9
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Feb 23 13:39:56 2022 +0100
win32u/tests: Add cursor icon tests.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/win32u/tests/Makefile.in | 2 +-
dlls/win32u/tests/win32u.c | 46 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/dlls/win32u/tests/Makefile.in b/dlls/win32u/tests/Makefile.in
index c0fa70e4e08..fcbcfa50e39 100644
--- a/dlls/win32u/tests/Makefile.in
+++ b/dlls/win32u/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = win32u.dll
-IMPORTS = user32 win32u
+IMPORTS = user32 gdi32 win32u
C_SRCS = \
win32u.c
diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c
index 2348c21dd80..980ba23bd73 100644
--- a/dlls/win32u/tests/win32u.c
+++ b/dlls/win32u/tests/win32u.c
@@ -180,6 +180,51 @@ static void test_NtUserBuildHwndList(void)
DestroyWindow( hwnd );
}
+static void test_cursoricon(void)
+{
+ BYTE bmp_bits[1024];
+ LONG width, height;
+ HANDLE handle;
+ unsigned int i;
+ BOOL ret;
+
+ for (i = 0; i < sizeof(bmp_bits); ++i)
+ bmp_bits[i] = 111 * i;
+
+ handle = CreateIcon( 0, 16, 16, 1, 1, bmp_bits, &bmp_bits[16 * 16 / 8] );
+ ok(handle != 0, "CreateIcon failed\n");
+
+ ret = NtUserGetIconSize( handle, 0, &width, &height );
+ ok( ret, "NtUserGetIconSize failed: %lu\n", GetLastError() );
+ ok( width == 16, "width = %ld\n", width );
+ ok( height == 32, "height = %ld\n", height );
+
+ ret = NtUserGetIconSize( handle, 6, &width, &height );
+ ok( ret, "NtUserGetIconSize failed: %lu\n", GetLastError() );
+ ok( width == 16, "width = %ld\n", width );
+ ok( height == 32, "height = %ld\n", height );
+
+ ret = NtUserDestroyCursor( handle, 0 );
+ ok( ret, "NtUserDestroyIcon failed: %lu\n", GetLastError() );
+
+ SetLastError( 0xdeadbeef );
+ ret = NtUserGetIconSize( handle, 0, &width, &height );
+ ok( !ret && GetLastError() == ERROR_INVALID_CURSOR_HANDLE,
+ "NtUserGetIconSize returned %x %lu\n", ret, GetLastError() );
+
+ /* Test a system icon */
+ handle = LoadIconA( 0, (LPCSTR)IDI_HAND );
+ ok( handle != NULL, "LoadIcon icon failed, error %lu\n", GetLastError() );
+
+ ret = NtUserGetIconSize( handle, 0, &width, &height );
+ ok( width == 32, "width = %ld\n", width );
+ ok( height == 64, "height = %ld\n", height );
+ ok( ret, "NtUserGetIconSize failed: %lu\n", GetLastError() );
+
+ ret = DestroyIcon(handle);
+ ok(ret, "Destroy icon failed, error %lu.\n", GetLastError());
+}
+
START_TEST(win32u)
{
/* native win32u.dll fails if user32 is not loaded, so make sure it's fully initialized */
@@ -188,6 +233,7 @@ START_TEST(win32u)
test_NtUserEnumDisplayDevices();
test_window_props();
test_NtUserBuildHwndList();
+ test_cursoricon();
test_NtUserCloseWindowStation();
}
More information about the wine-cvs
mailing list