Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/comctl32/tests/bmp1x1_32bpp.bmp | Bin 0 -> 58 bytes dlls/comctl32/tests/resources.h | 1 + dlls/comctl32/tests/rsrc.rc | 3 + dlls/comctl32/tests/static.c | 92 +++++++++++++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 dlls/comctl32/tests/bmp1x1_32bpp.bmp
diff --git a/dlls/comctl32/tests/bmp1x1_32bpp.bmp b/dlls/comctl32/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/comctl32/tests/resources.h b/dlls/comctl32/tests/resources.h index 53522c0a09..c4692654ae 100644 --- a/dlls/comctl32/tests/resources.h +++ b/dlls/comctl32/tests/resources.h @@ -23,6 +23,7 @@
#define IDB_BITMAP_128x15 10 #define IDB_BITMAP_80x15 11 +#define IDB_BITMAP_1x1_32BPP 12
#define IDS_TBADD1 16 #define IDS_TBADD2 17 diff --git a/dlls/comctl32/tests/rsrc.rc b/dlls/comctl32/tests/rsrc.rc index 6eb4fe8a0a..df22053d4c 100644 --- a/dlls/comctl32/tests/rsrc.rc +++ b/dlls/comctl32/tests/rsrc.rc @@ -101,6 +101,9 @@ IDB_BITMAP_128x15 BITMAP bmp128x15.bmp /* @makedep: bmp80x15.bmp */ IDB_BITMAP_80x15 BITMAP bmp80x15.bmp
+/* @makedep: bmp1x1_32bpp.bmp */ +IDB_BITMAP_1x1_32BPP BITMAP bmp1x1_32bpp.bmp + IDD_PROP_PAGE_WITH_CUSTOM_DEFAULT_BUTTON DIALOG 5, 43, 227, 215 STYLE WS_CHILD | WS_DISABLED FONT 8, "MS Shell Dlg" diff --git a/dlls/comctl32/tests/static.c b/dlls/comctl32/tests/static.c index a65e352728..0e44c4ed7a 100644 --- a/dlls/comctl32/tests/static.c +++ b/dlls/comctl32/tests/static.c @@ -24,6 +24,7 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include "commctrl.h" +#include "resources.h"
#include "wine/test.h"
@@ -133,6 +134,96 @@ static void test_set_text(void) DestroyWindow(hStatic); }
+static void test_image(HBITMAP image, BOOL is_dib, BOOL is_premult) +{ + 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); + if (is_dib) + { +todo_wine + ok(bm.bmBits != NULL, "bmBits is NULL\n"); +if (bm.bmBits) +{ + memcpy(bits, bm.bmBits, 4); + if (is_premult) + ok(bits[0] == 0x05 && bits[1] == 0x09 && bits[2] == 0x0e && bits[3] == 0x44, + "bits: %02x %02x %02x %02x\n", bits[0], bits[1], bits[2], bits[3]); + else + 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]); +} + } + else + 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); + + if (is_premult) +todo_wine + ok(bits[0] == 0x05 && bits[1] == 0x09 && bits[2] == 0x0e && bits[3] == 0x44, + "bits: %02x %02x %02x %02x\n", bits[0], bits[1], bits[2], bits[3]); + else + 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 = create_static(SS_BITMAP); + HBITMAP bmp1, bmp2, image; + + image = LoadImageW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(IDB_BITMAP_1x1_32BPP), IMAGE_BITMAP, 0, 0, 0); + ok(image != NULL, "LoadImage failed\n"); + + test_image(image, FALSE, FALSE); + + bmp1 = (HBITMAP)SendMessageW(hwnd, STM_GETIMAGE, IMAGE_BITMAP, 0); + ok(bmp1 == NULL, "got not NULL\n"); + + bmp1 = (HBITMAP)SendMessageW(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)image); + ok(bmp1 == NULL, "got not NULL\n"); + + bmp1 = (HBITMAP)SendMessageW(hwnd, STM_GETIMAGE, IMAGE_BITMAP, 0); + ok(bmp1 != NULL, "got NULL\n"); +todo_wine + ok(bmp1 != image, "bmp == image\n"); + test_image(bmp1, TRUE, TRUE); + + bmp2 = (HBITMAP)SendMessageW(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)image); + ok(bmp2 != NULL, "got NULL\n"); +todo_wine + ok(bmp2 != image, "bmp == image\n"); + ok(bmp1 == bmp2, "bmp1 != bmp2\n"); + test_image(bmp2, TRUE, TRUE); + + DestroyWindow(hwnd); + + test_image(bmp2, TRUE, TRUE); + + DeleteObject(image); +} + START_TEST(static) { static const char classname[] = "testclass"; @@ -171,6 +262,7 @@ START_TEST(static) test_updates(SS_ETCHEDHORZ, TODO_COUNT); test_updates(SS_ETCHEDVERT, TODO_COUNT); test_set_text(); + test_set_image();
DestroyWindow(hMainWnd);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=64643
Your paranoid android.
=== w1064v1809_ar (32 bit report) ===
comctl32: datetime.c:796: Test failed: Expected 06/02/2020, got 2020/02/06