[PATCH] user32/tests: Handle broken results on Win10 in test_Image_StretchMode().
Paul Gofman
gofmanp at gmail.com
Tue Jan 7 06:01:27 CST 2020
Fixes test failures on w1064 Testbot machines.
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
dlls/user32/tests/cursoricon.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/tests/cursoricon.c b/dlls/user32/tests/cursoricon.c
index 8ce1eb163e..3b86135766 100644
--- a/dlls/user32/tests/cursoricon.c
+++ b/dlls/user32/tests/cursoricon.c
@@ -2811,9 +2811,10 @@ static COLORREF get_color_from_bits(const unsigned char *bits, const BITMAPINFO
return RGB(color.rgbRed, color.rgbGreen, color.rgbBlue);
}
-#define compare_bitmap_bits(a, b, c, d, e, f, g) compare_bitmap_bits_(__LINE__, a, b, c, d, e, f, g)
+#define compare_bitmap_bits(a, b, c, d, e, f, g, h) compare_bitmap_bits_(__LINE__, a, b, c, d, e, f, g, h)
static void compare_bitmap_bits_(unsigned int line, HDC hdc, HBITMAP bitmap, BITMAPINFO *bmi,
- size_t result_bits_size, const unsigned char *expected_bits, unsigned int test_index, BOOL todo)
+ size_t result_bits_size, const unsigned char *expected_bits, unsigned int test_index, BOOL todo,
+ const unsigned char *expected_broken_bits)
{
unsigned char *result_bits;
unsigned int row, column;
@@ -2833,8 +2834,9 @@ static void compare_bitmap_bits_(unsigned int line, HDC hdc, HBITMAP bitmap, BIT
expected = get_color_from_bits(expected_bits, bmi, row, column);
todo_wine_if(todo)
- ok_(__FILE__, line)(result == expected, "Colors do not match, "
- "got 0x%06x, expected 0x%06x, test_index %u, row %u, column %u.\n",
+ ok_(__FILE__, line)(result == expected || broken(expected_broken_bits
+ && result == get_color_from_bits(expected_broken_bits, bmi, row, column)),
+ "Colors do not match, got 0x%06x, expected 0x%06x, test_index %u, row %u, column %u.\n",
result, expected, test_index, row, column);
}
HeapFree(GetProcessHeap(), 0, result_bits);
@@ -2854,6 +2856,11 @@ static void test_Image_StretchMode(void)
0x3f, 0xff, 0x00, 0x3f, 0xff, 0x3f, 0x00, 0x00,
0x3f, 0xff, 0x7f, 0x00, 0xff, 0x3f, 0x00, 0x00,
};
+ static const unsigned char expected_broken_bits_24[] =
+ {
+ 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ };
#define rgb16(r, g, b) ((WORD)(((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3)))
static const WORD test_bits_16[] =
{
@@ -2908,11 +2915,13 @@ static void test_Image_StretchMode(void)
const RGBQUAD *bmi_colors;
size_t bmi_colors_size;
BOOL todo;
+ const unsigned char *expected_broken_bits;
}
tests[] =
{
{4, 4, 2, 2, 24, test_bits_24, expected_bits_24,
- sizeof(test_bits_24), sizeof(expected_bits_24), NULL, 0, TRUE},
+ sizeof(test_bits_24), sizeof(expected_bits_24), NULL, 0, TRUE,
+ /* Broken on Win10 1607+ */ expected_broken_bits_24},
{4, 4, 2, 2, 1, test_bits_1, expected_bits_1,
sizeof(test_bits_1), sizeof(expected_bits_1), colors_bits_1,
sizeof(colors_bits_1), FALSE},
@@ -2966,7 +2975,8 @@ static void test_Image_StretchMode(void)
ok(!!bitmap_copy, "CopyImage() failed, result %u.\n", GetLastError());
compare_bitmap_bits(hdc, bitmap_copy, bmi_output, tests[test_index].result_bits_size,
- tests[test_index].expected_bits, test_index, tests[test_index].todo);
+ tests[test_index].expected_bits, test_index, tests[test_index].todo,
+ tests[test_index].expected_broken_bits);
DeleteObject(bitmap);
DeleteObject(bitmap_copy);
@@ -2976,7 +2986,8 @@ static void test_Image_StretchMode(void)
ok(!!bitmap, "LoadImageA() failed, result %u.\n", GetLastError());
DeleteFileA(filename);
compare_bitmap_bits(hdc, bitmap, bmi_output, tests[test_index].result_bits_size,
- tests[test_index].expected_bits, test_index, tests[test_index].todo);
+ tests[test_index].expected_bits, test_index, tests[test_index].todo,
+ tests[test_index].expected_broken_bits);
DeleteObject(bitmap);
}
ReleaseDC(0, hdc);
--
2.24.1
More information about the wine-devel
mailing list