[PATCH] user32/tests: Add some tests for Static/SS_BITMAP control.
Dmitry Timoshkov
dmitry at baikal.ru
Thu Feb 6 03:31:09 CST 2020
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
dlls/user32/tests/bmp1x1_32bpp.bmp | Bin 0 -> 58 bytes
dlls/user32/tests/resource.rc | 3 ++
dlls/user32/tests/static.c | 60 +++++++++++++++++++++++++++++
3 files changed, 63 insertions(+)
create mode 100644 dlls/user32/tests/bmp1x1_32bpp.bmp
diff --git a/dlls/user32/tests/bmp1x1_32bpp.bmp b/dlls/user32/tests/bmp1x1_32bpp.bmp
new file mode 100644
index 0000000000000000000000000000000000000000..3b565be8c2b1ca5b8d121df4e3b6f57822b72600
GIT binary patch
literal 58
hcmZ?rwPJt(Ga#h_#EfvP0Aw*Ruz*QaLQu)r1pq_i0r>y`
literal 0
HcmV?d00001
diff --git a/dlls/user32/tests/resource.rc b/dlls/user32/tests/resource.rc
index 4301af6d68..89aaf5a61c 100644
--- a/dlls/user32/tests/resource.rc
+++ b/dlls/user32/tests/resource.rc
@@ -249,6 +249,9 @@ FONT 8, "MS Shell Dlg"
/* @makedep: test_mono.bmp */
100 BITMAP test_mono.bmp
+/* @makedep: bmp1x1_32bpp.bmp */
+101 BITMAP bmp1x1_32bpp.bmp
+
1 MENU
{
POPUP "&File"
diff --git a/dlls/user32/tests/static.c b/dlls/user32/tests/static.c
index 8776c3a9e0..0c453d08a6 100644
--- a/dlls/user32/tests/static.c
+++ b/dlls/user32/tests/static.c
@@ -130,6 +130,65 @@ static void test_set_text(void)
DestroyWindow(hStatic);
}
+static void test_image(HBITMAP image)
+{
+ BITMAP bm;
+ HDC hdc;
+ BITMAPINFO info;
+ BYTE bits[4];
+
+ GetObjectW(image, sizeof(bm), &bm);
+ ok(bm.bmWidth == 1, "got %d\n", bm.bmWidth);
+ ok(bm.bmHeight == 1, "got %d\n", bm.bmHeight);
+ ok(bm.bmBitsPixel == 32, "got %d\n", bm.bmBitsPixel);
+ ok(bm.bmBits == NULL, "bmBits is not NULL\n");
+
+ info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ info.bmiHeader.biWidth = bm.bmWidth;
+ info.bmiHeader.biHeight = bm.bmHeight;
+ info.bmiHeader.biPlanes = 1;
+ info.bmiHeader.biBitCount = 32;
+ info.bmiHeader.biCompression = BI_RGB;
+ info.bmiHeader.biSizeImage = 4;
+ info.bmiHeader.biXPelsPerMeter = 0;
+ info.bmiHeader.biYPelsPerMeter = 0;
+ info.bmiHeader.biClrUsed = 0;
+ info.bmiHeader.biClrImportant = 0;
+
+ hdc = CreateCompatibleDC(0);
+ GetDIBits(hdc, image, 0, bm.bmHeight, bits, &info, DIB_RGB_COLORS);
+ DeleteDC(hdc);
+
+ ok(bits[0] == 0x11 && bits[1] == 0x22 && bits[2] == 0x33 && bits[3] == 0x44,
+ "bits: %02x %02x %02x %02x\n", bits[0], bits[1], bits[2], bits[3]);
+}
+
+static void test_set_image(void)
+{
+ HWND hwnd = build_static(SS_BITMAP);
+ HBITMAP bmp, image;
+
+ image = LoadImageW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(101), IMAGE_BITMAP, 0, 0, 0);
+ ok(image != NULL, "LoadImage failed\n");
+
+ test_image(image);
+
+ bmp = (HBITMAP)SendMessageW(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)image);
+ ok(bmp == NULL, "got not NULL\n");
+
+ bmp = (HBITMAP)SendMessageW(hwnd, STM_GETIMAGE, IMAGE_BITMAP, 0);
+ ok(bmp != NULL, "got NULL\n");
+ ok(bmp == image, "bmp != image\n");
+
+ bmp = (HBITMAP)SendMessageW(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)image);
+ ok(bmp != NULL, "got NULL\n");
+ ok(bmp == image, "bmp != image\n");
+ test_image(image);
+
+ DestroyWindow(hwnd);
+ DeleteObject(image);
+}
+
START_TEST(static)
{
static const char szClassName[] = "testclass";
@@ -162,6 +221,7 @@ START_TEST(static)
test_updates(SS_ETCHEDHORZ, TODO_COUNT);
test_updates(SS_ETCHEDVERT, TODO_COUNT);
test_set_text();
+ test_set_image();
DestroyWindow(hMainWnd);
}
--
2.20.1
More information about the wine-devel
mailing list