From: RĂ©mi Bernon rbernon@codeweavers.com
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/user32/tests/Makefile.in | 2 +- dlls/user32/tests/win.c | 686 ++++++++++++++++++++++++++++++++++ 2 files changed, 687 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/tests/Makefile.in b/dlls/user32/tests/Makefile.in index dd101d69f3c..5b058b7d914 100644 --- a/dlls/user32/tests/Makefile.in +++ b/dlls/user32/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = user32.dll -IMPORTS = user32 gdi32 advapi32 hid +IMPORTS = user32 gdi32 advapi32 hid dwmapi
C_SRCS = \ broadcast.c \ diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index a37afd2dc5e..6f9c566a651 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -31,6 +31,7 @@ #include "wingdi.h" #include "winuser.h" #include "winreg.h" +#include "dwmapi.h"
#include "wine/test.h"
@@ -12004,6 +12005,689 @@ static void test_cancel_mode(void) DestroyWindow(hwnd2); }
+/* The window manager is not willing to fully honor window position + requests. For instance, Mutter does not allow windows to overlap + the top bar. For such WMs, we cannot reliably do + check_screen_surface tests, because we captured a different + background to compare with. */ +BOOL composition_broken_wm = FALSE; + +#define capture_surface(hdc, x, y, width, height, surface, surface_size) capture_surface_(__LINE__, hdc, x, y, width, height, surface, surface_size) +static SIZE_T capture_surface_(int line, HDC hdc, int x, int y, int width, int height, DWORD *surface, SIZE_T surface_size) +{ + BITMAPINFOHEADER info; + HBITMAP bmp_obj; + SIZE_T data_size; + BITMAP bmp; + DWORD count; + BOOL ret; + HDC hdc_dst; + + hdc_dst = CreateCompatibleDC(hdc); + ok_(__FILE__, line)(hdc_dst != 0, "CreateCompatibleDC failed, last error %u\n", GetLastError()); + bmp_obj = CreateCompatibleBitmap(hdc, width, height); + ok_(__FILE__, line)(bmp_obj != 0, "CreateCompatibleBitmap failed, last error %u\n", GetLastError()); + +#ifndef CAPTUREBLT +#define CAPTUREBLT 0x40000000 +#endif + + SelectObject(hdc_dst, bmp_obj); + ret = BitBlt(hdc_dst, 0, 0, width, height, hdc, x, y, SRCCOPY | CAPTUREBLT); + ok_(__FILE__, line)(ret, "BitBlt failed, last error %u\n", GetLastError()); + count = GetObjectW(bmp_obj, sizeof(BITMAP), &bmp); + ok_(__FILE__, line)(count == sizeof(BITMAP), "GetObjectW failed, last error %u\n", GetLastError()); + + info.biSize = sizeof(BITMAPINFOHEADER); + info.biWidth = bmp.bmWidth; + info.biHeight = bmp.bmHeight; + info.biPlanes = 1; + info.biBitCount = 32; + info.biCompression = BI_RGB; + info.biSizeImage = 0; + info.biXPelsPerMeter = 0; + info.biYPelsPerMeter = 0; + info.biClrUsed = 0; + info.biClrImportant = 0; + + data_size = ((bmp.bmWidth * info.biBitCount + 31) / 32) * 4 * bmp.bmHeight; + ok_(__FILE__, line)( data_size == surface_size, "Got %Iu bytes, expected %Iu\n", data_size, surface_size ); + count = GetDIBits(hdc_dst, bmp_obj, 0, bmp.bmHeight, surface, (BITMAPINFO*)&info, DIB_RGB_COLORS); + ok_(__FILE__, line)(count == bmp.bmHeight, "GetDIBits failed, last error %u\n", GetLastError()); + + DeleteObject(bmp_obj); + DeleteDC(hdc_dst); + +#if 0 + { + BITMAPFILEHEADER header; + HANDLE file; + + header.bfType = 0x4d42; + header.bfSize = sizeof(header) + sizeof(info) + data_size; + header.bfOffBits = sizeof(header) + sizeof(info); + + file = CreateFileW(L"surface.bmp", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "CreateFileW failed, error %u\n", GetLastError()); + ret = WriteFile(file, &header, sizeof(header), &count, NULL); + ok(ret && count == sizeof(header), "WriteFile failed, error %u\n", GetLastError()); + ret = WriteFile(file, &info, sizeof(info), &count, NULL); + ok(ret && count == sizeof(info), "WriteFile failed, error %u\n", GetLastError()); + ret = WriteFile(file, surface, data_size, &count, NULL); + ok(ret && count == data_size, "WriteFile failed, error %u\n", GetLastError()); + CloseHandle(file); + } +#endif + + return data_size; +} + +static void dump_surface(int line, const DWORD *surface, SIZE_T surface_size, const char *prefix) +{ + int i, pos; + char buf[1024]; + + if (surface_size / 4 > 16) + return; + pos = sprintf(buf, "%s", prefix); + for (i = 0; i < surface_size / 4; i++) + pos += sprintf(buf + pos, " %08x", surface[i]); + trace_(__FILE__, line)("%s\n", buf); +} + +#define capture_screen_surface(hwnd, surface, surface_size) capture_screen_surface_(__LINE__, hwnd, surface, surface_size) +static SIZE_T capture_screen_surface_(int line, HWND hwnd, DWORD *surface, SIZE_T surface_size) +{ + SIZE_T data_size, i; + RECT rect, rect_win; + HDC hdc; + + GetWindowRect(hwnd, &rect_win); + GetClientRect(hwnd, &rect); + OffsetRect(&rect, -rect.left, -rect.top); + + hdc = GetDC(NULL); + ok_(__FILE__, line)(hdc != 0, "GetDC failed, last error %u\n", GetLastError()); + if (DwmFlush() == E_NOTIMPL) flush_events( TRUE ); + data_size = capture_surface_(line, hdc, rect_win.left, rect_win.top, rect.right, rect.bottom, surface, surface_size); + ReleaseDC(NULL, hdc); + + for (i = data_size / 4; i != 0; i--) surface[i - 1] &= 0xffffff; + return data_size; +} + +#define check_screen_surface(hwnd, expect, expect_size, todo) check_screen_surface_(__LINE__, hwnd, expect, expect_size, todo) +static void check_screen_surface_(int line, HWND hwnd, const DWORD *expect, SIZE_T expect_size, BOOL todo) +{ + SIZE_T data_size; + DWORD *data; + + if (composition_broken_wm) + return; + + data = malloc(expect_size); + ok_(__FILE__, line)(data != NULL, "Failed to allocate %Iu bytes\n", expect_size); + data_size = capture_screen_surface_(line, hwnd, data, expect_size); + if (data_size != expect_size) + { + todo_wine_if(todo) + ok_(__FILE__, line)(0, "Unexpected screen surface size %Iu, expected %Iu", data_size, expect_size); + } + else if (memcmp( data, expect, data_size )) + { + todo_wine_if(todo) + ok_(__FILE__, line)(0, "Unexpected screen surface data\n"); + dump_surface(line, expect, expect_size, "expected:"); + dump_surface(line, data, data_size, "got: "); + } + else if (todo) + trace_(__FILE__, line)("Got expected screen surface data\n"); + free(data); +} + +#define capture_client_surface(hwnd, surface, surface_size) capture_client_surface_(__LINE__, hwnd, surface, surface_size) +static SIZE_T capture_client_surface_(int line, HWND hwnd, DWORD *surface, SIZE_T surface_size) +{ + SIZE_T data_size; + RECT rect; + HDC hdc; + + GetClientRect(hwnd, &rect); + OffsetRect(&rect, -rect.left, -rect.top); + + hdc = GetDC(hwnd); + ok_(__FILE__, line)(hdc != 0, "GetDC failed, last error %u\n", GetLastError()); + data_size = capture_surface_(line, hdc, 0, 0, rect.right, rect.bottom, surface, surface_size); + ReleaseDC(hwnd, hdc); + + return data_size; +} + +#define check_client_surface(hwnd, expect, expect_size, todo) check_client_surface_(__LINE__, hwnd, expect, expect_size, todo) +static void check_client_surface_(int line, HWND hwnd, const DWORD *expect, SIZE_T expect_size, BOOL todo) +{ + SIZE_T data_size; + DWORD *data; + + data = malloc(expect_size); + ok_(__FILE__, line)(data != NULL, "Failed to allocate %Iu bytes\n", expect_size); + data_size = capture_client_surface_(line, hwnd, data, expect_size); + if (data_size != expect_size) + { + todo_wine_if(todo) + ok_(__FILE__, line)(0, "Unexpected client surface size %Iu, expected %Iu", data_size, expect_size); + } + else if (memcmp( data, expect, data_size )) + { + todo_wine_if(todo) + ok_(__FILE__, line)(0, "Unexpected client surface data\n"); + dump_surface(line, expect, expect_size, "expected:"); + dump_surface(line, data, data_size, "got: "); + } + else if (todo) + trace_(__FILE__, line)("Got expected client surface data\n"); + free(data); +} + +static void paint_client_rect(HWND hwnd, COLORREF color) +{ + HDC hdc = GetDC(hwnd); + HPEN pen = CreatePen(PS_SOLID, 0, color); + HBRUSH brush = CreateSolidBrush(color); + RECT rect; + GetClientRect(hwnd, &rect); + + SelectObject(hdc, pen); + SelectObject(hdc, brush); + Rectangle(hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); + DeleteObject(brush); + DeleteObject(pen); + DeleteDC(hdc); +} + +LRESULT WINAPI test_surface_composition_winproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch (msg) + { + case WM_ERASEBKGND: return 0; + case WM_NCPAINT: + case WM_PAINT: + { + BeginPaint(hwnd, NULL); + EndPaint(hwnd, NULL); + return 0; + } + default: + return DefWindowProcW(hwnd, msg, wparam, lparam); + } +} + +static void test_surface_composition(void) +{ +#define COLOR1 0x00ff0000 +#define COLOR2 0x0000ffff +#define BGRA2RGB(x) RGB((x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff) + static const DWORD minimized_surface[] = + { + 0x00000000 + }; + static const DWORD hidden_surface[] = + { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + }; + static const DWORD partial_surface[] = + { + 0x00000000, 0x00000000, COLOR1, COLOR1, + 0x00000000, 0x00000000, COLOR1, COLOR1, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + }; + static const DWORD painted_surface[] = + { + COLOR1, COLOR1, COLOR1, COLOR1, + COLOR1, COLOR1, COLOR1, COLOR1, + COLOR1, COLOR1, COLOR1, COLOR1, + COLOR1, COLOR1, COLOR1, COLOR1, + }; + static const DWORD painted_child_surface[] = { + COLOR1, COLOR1, COLOR1, COLOR1, + COLOR1, COLOR2, COLOR2, COLOR1, + COLOR1, COLOR2, COLOR2, COLOR1, + COLOR1, COLOR1, COLOR1, COLOR1, + }; + + DWORD screen_surface[ARRAY_SIZE(painted_surface)]; + DWORD layered_const_surface[ARRAY_SIZE(painted_surface)]; + DWORD layered_child_surface[ARRAY_SIZE(painted_child_surface)]; + DWORD layered_child_const_surface[ARRAY_SIZE(painted_child_surface)]; + DWORD layered_child_alpha_surface[ARRAY_SIZE(painted_child_surface)]; + + BLENDFUNCTION blend_cst_alpha = { AC_SRC_OVER, 0, 0x7f, 0 }; + BLENDFUNCTION blend_src_alpha = { AC_SRC_OVER, 0, 0xff, AC_SRC_ALPHA }; + WNDCLASSEXW wc; + BITMAPINFO info; + HBITMAP bmp_obj; + HRESULT hres; + SIZE_T i; + DWORD *data; + HWND hwnd, hwnd_child; + RECT rect; + BOOL ret; + HDC hdc_dst, hdc_src; + + wc.cbSize = sizeof(WNDCLASSEXW); + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = test_surface_composition_winproc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = GetModuleHandleW(NULL); + wc.hIcon = 0; + wc.hCursor = 0; + wc.hbrBackground = 0; + wc.lpszMenuName = NULL; + wc.lpszClassName = L"surface"; + wc.hIconSm = 0; + RegisterClassExW(&wc); + + + hres = DwmFlush(); + todo_wine ok(hres == S_OK || broken(hres == DWM_E_COMPOSITIONDISABLED), "DwmFlush returned %#x\n", hres); + if (hres == DWM_E_COMPOSITIONDISABLED) + { + win_skip("Cannot reliably capture screen surfaces, skipping tests\n"); + return; + } + + hwnd = CreateWindowW(L"surface", L"", WS_POPUP, 0, 0, 4, 4, NULL, NULL, NULL, NULL); + ok(hwnd != 0, "CreateWindowW failed, last error %u\n", GetLastError()); + flush_events( TRUE ); + + capture_screen_surface(hwnd, screen_surface, sizeof(screen_surface)); + + for (i = 0; i < ARRAY_SIZE(painted_surface); i++) + { + BYTE sr = (screen_surface[i] >> 16) & 0xff, dr = (painted_surface[i] >> 16) & 0xff; + BYTE sg = (screen_surface[i] >> 8) & 0xff, dg = (painted_surface[i] >> 8) & 0xff; + BYTE sb = (screen_surface[i] >> 0) & 0xff, db = (painted_surface[i] >> 0) & 0xff; + BYTE da = 0x7f; + dr = min(max((sr * (0xff - da) + dr * da + 0x7f) / 0xff, 0), 0xff); + dg = min(max((sg * (0xff - da) + dg * da + 0x7f) / 0xff, 0), 0xff); + db = min(max((sb * (0xff - da) + db * da + 0x7f) / 0xff, 0), 0xff); + layered_const_surface[i] = BGRA2RGB(RGB(dr, dg, db)); + } + + memcpy(layered_child_surface, screen_surface, sizeof(screen_surface)); + for (i = 0; i < ARRAY_SIZE(painted_child_surface); i++) + { + if (painted_child_surface[i] == painted_surface[i]) + layered_child_surface[i] = painted_surface[i]; + } + + for (i = 0; i < ARRAY_SIZE(painted_child_surface); i++) + { + BYTE sr = (screen_surface[i] >> 16) & 0xff, dr = (painted_child_surface[i] >> 16) & 0xff; + BYTE sg = (screen_surface[i] >> 8) & 0xff, dg = (painted_child_surface[i] >> 8) & 0xff; + BYTE sb = (screen_surface[i] >> 0) & 0xff, db = (painted_child_surface[i] >> 0) & 0xff; + BYTE da = 0x7f; + dr = min(max((sr * (0xff - da) + dr * da + 0x7f) / 0xff, 0), 0xff); + dg = min(max((sg * (0xff - da) + dg * da + 0x7f) / 0xff, 0), 0xff); + db = min(max((sb * (0xff - da) + db * da + 0x7f) / 0xff, 0), 0xff); + layered_child_const_surface[i] = BGRA2RGB(RGB(dr, dg, db)); + } + + for (i = 0; i < ARRAY_SIZE(painted_child_surface); i++) + { + BYTE sr = (screen_surface[i] >> 16) & 0xff, dr = (painted_child_surface[i] >> 16) & 0xff; + BYTE sg = (screen_surface[i] >> 8) & 0xff, dg = (painted_child_surface[i] >> 8) & 0xff; + BYTE sb = (screen_surface[i] >> 0) & 0xff, db = (painted_child_surface[i] >> 0) & 0xff; + BYTE sa = painted_child_surface[i] == COLOR2 ? 0xff : 0x00; + dr = min(max((sr * (0xff - sa) + dr * 0xff + 0x7f) / 0xff, 0), 0xff); + dg = min(max((sg * (0xff - sa) + dg * 0xff + 0x7f) / 0xff, 0), 0xff); + db = min(max((sb * (0xff - sa) + db * 0xff + 0x7f) / 0xff, 0), 0xff); + layered_child_alpha_surface[i] = BGRA2RGB(RGB(dr, dg, db)); + } + + + ShowWindow(hwnd, SW_SHOW); + flush_events( TRUE ); + GetWindowRect(hwnd, &rect); + if (rect.left != 0 || rect.top != 0) + { + skip("window manager does not honor requested position\n"); + composition_broken_wm = TRUE; + } + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + + ShowWindow(hwnd, SW_HIDE); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), FALSE); + check_screen_surface(hwnd, screen_surface, sizeof(screen_surface), FALSE); + + ShowWindow(hwnd, SW_SHOW); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + + ShowWindow(hwnd, SW_MINIMIZE); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, minimized_surface, sizeof(minimized_surface), FALSE); + check_screen_surface(hwnd, minimized_surface, sizeof(minimized_surface), FALSE); + + ShowWindow(hwnd, SW_RESTORE); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + + SetWindowPos(hwnd, 0, -100, -100, 0, 0, SWP_NOSIZE); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_screen_surface(hwnd, hidden_surface, sizeof(hidden_surface), FALSE); + + SetWindowPos(hwnd, 0, -2, -2, 0, 0, SWP_NOSIZE); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, partial_surface, sizeof(partial_surface), TRUE); + + SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + + hwnd_child = CreateWindowW(L"surface", L"", WS_CHILD | WS_VISIBLE, 1, 1, 2, 2, hwnd, NULL, NULL, NULL); + ok(hwnd_child != 0, "CreateWindowW failed, last error %u\n", GetLastError()); + + flush_events( TRUE ); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + paint_client_rect(hwnd_child, BGRA2RGB(COLOR2)); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + + SetWindowLongW(hwnd, GWL_STYLE, GetWindowLongW(hwnd, GWL_STYLE) | WS_CLIPCHILDREN); + + paint_client_rect(hwnd_child, BGRA2RGB(COLOR2)); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + + DestroyWindow(hwnd_child); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + + DestroyWindow(hwnd); + + + /* WS_EX_LAYERED */ + + hwnd = CreateWindowW(L"surface", L"", WS_POPUP | WS_VISIBLE, 0, 0, 4, 4, 0, NULL, NULL, NULL); + ok(hwnd != 0, "CreateWindowW failed, last error %u\n", GetLastError()); + flush_events( TRUE ); + + SetWindowLongW(hwnd, GWL_EXSTYLE, GetWindowLongW(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + + ShowWindow(hwnd, SW_HIDE); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_screen_surface(hwnd, screen_surface, sizeof(screen_surface), FALSE); + + ShowWindow(hwnd, SW_SHOW); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + + hwnd_child = CreateWindowW(L"surface", L"", WS_CHILD | WS_VISIBLE, 1, 1, 2, 2, hwnd, NULL, NULL, NULL); + ok(hwnd_child != 0, "CreateWindowW failed, last error %u\n", GetLastError()); + + flush_events( TRUE ); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + paint_client_rect(hwnd_child, BGRA2RGB(COLOR2)); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), TRUE); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + + SetWindowLongW(hwnd, GWL_STYLE, GetWindowLongW(hwnd, GWL_STYLE) | WS_CLIPCHILDREN); + + paint_client_rect(hwnd_child, BGRA2RGB(COLOR2)); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), TRUE); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), TRUE); + + DestroyWindow(hwnd_child); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), TRUE); + + DestroyWindow(hwnd); + + + /* SetLayeredWindowAttributes / LWA_ALPHA */ + + hwnd = CreateWindowW(L"surface", L"", WS_POPUP, 0, 0, 4, 4, 0, NULL, NULL, NULL); + ok(hwnd != 0, "CreateWindowW failed, last error %u\n", GetLastError()); + + SetWindowLongW(hwnd, GWL_EXSTYLE, GetWindowLongW(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, screen_surface, sizeof(screen_surface), FALSE); + + ShowWindow(hwnd, SW_SHOW); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, screen_surface, sizeof(screen_surface), FALSE); + + ret = SetLayeredWindowAttributes(hwnd, 0, 0x7f, LWA_ALPHA); + ok(ret, "SetLayeredWindowAttributes failed, last error %u\n", GetLastError()); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, layered_const_surface, sizeof(layered_const_surface), TRUE); + + hwnd_child = CreateWindowW(L"surface", L"", WS_CHILD | WS_VISIBLE, 1, 1, 2, 2, hwnd, NULL, NULL, NULL); + ok(hwnd_child != 0, "CreateWindowW failed, last error %u\n", GetLastError()); + + flush_events( TRUE ); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, layered_const_surface, sizeof(layered_const_surface), TRUE); + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + paint_client_rect(hwnd_child, BGRA2RGB(COLOR2)); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, layered_child_const_surface, sizeof(layered_child_const_surface), TRUE); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, layered_const_surface, sizeof(layered_const_surface), TRUE); + + SetWindowLongW(hwnd, GWL_STYLE, GetWindowLongW(hwnd, GWL_STYLE) | WS_CLIPCHILDREN); + + paint_client_rect(hwnd_child, BGRA2RGB(COLOR2)); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, layered_child_const_surface, sizeof(layered_child_const_surface), TRUE); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, layered_child_const_surface, sizeof(layered_child_const_surface), TRUE); + + DestroyWindow(hwnd_child); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, layered_child_const_surface, sizeof(layered_child_const_surface), TRUE); + + DestroyWindow(hwnd); + + + /* SetLayeredWindowAttributes / LWA_COLORKEY */ + + hwnd = CreateWindowW(L"surface", L"", WS_POPUP, 0, 0, 4, 4, 0, NULL, NULL, NULL); + ok(hwnd != 0, "CreateWindowW failed, last error %u\n", GetLastError()); + + SetWindowLongW(hwnd, GWL_EXSTYLE, GetWindowLongW(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); + ret = SetLayeredWindowAttributes(hwnd, BGRA2RGB(COLOR2), 0, LWA_COLORKEY); + ok(ret, "SetLayeredWindowAttributes failed, last error %u\n", GetLastError()); + ShowWindow(hwnd, SW_SHOW); + flush_events( TRUE ); + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + + hwnd_child = CreateWindowW(L"surface", L"", WS_CHILD | WS_VISIBLE, 1, 1, 2, 2, hwnd, NULL, NULL, NULL); + ok(hwnd_child != 0, "CreateWindowW failed, last error %u\n", GetLastError()); + flush_events( TRUE ); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + paint_client_rect(hwnd_child, BGRA2RGB(COLOR2)); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, layered_child_surface, sizeof(layered_child_surface), FALSE); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + + SetWindowLongW(hwnd, GWL_STYLE, GetWindowLongW(hwnd, GWL_STYLE) | WS_CLIPCHILDREN); + + paint_client_rect(hwnd_child, BGRA2RGB(COLOR2)); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, layered_child_surface, sizeof(layered_child_surface), FALSE); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, layered_child_surface, sizeof(layered_child_surface), FALSE); + + DestroyWindow(hwnd_child); + check_client_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), FALSE); + check_screen_surface(hwnd, layered_child_surface, sizeof(layered_child_surface), FALSE); + + GetClientRect(hwnd, &rect); + OffsetRect(&rect, -rect.left, -rect.top); + + memset(&info, 0, sizeof(info)); + info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + info.bmiHeader.biWidth = rect.right; + info.bmiHeader.biHeight = rect.bottom; + info.bmiHeader.biPlanes = 1; + info.bmiHeader.biBitCount = 32; + info.bmiHeader.biCompression = BI_RGB; + info.bmiHeader.biSizeImage = rect.right * rect.bottom * 4; + + hdc_dst = GetDC(hwnd); + ok(hdc_dst != 0, "GetDC failed, last error %u\n", GetLastError()); + hdc_src = CreateCompatibleDC(hdc_dst); + ok(hdc_src != 0, "CreateCompatibleDC failed, last error %u\n", GetLastError()); + bmp_obj = CreateDIBSection(hdc_src, &info, DIB_RGB_COLORS, (void **)&data, NULL, 0x0); + ok(bmp_obj != 0, "CreateBitmap failed, last error %u\n", GetLastError()); + SelectObject(hdc_src, bmp_obj); + ret = BitBlt(hdc_src, 0, 0, rect.right, rect.bottom, hdc_dst, 0, 0, SRCCOPY); + ok(ret, "BitBlt failed, last error %u\n", GetLastError()); + ReleaseDC(hwnd, hdc_dst); + + for (i = rect.bottom * rect.right; i != 0; i--) + if (data[i - 1] == COLOR2) data[i - 1] |= 0xff000000; + + DestroyWindow(hwnd); + + + /* UpdateLayeredWindow */ + + hdc_dst = GetDC(NULL); + hwnd = CreateWindowW(L"surface", L"", WS_POPUP, 0, 0, 4, 4, 0, NULL, NULL, NULL); + ok(hwnd != 0, "CreateWindowW failed, last error %u\n", GetLastError()); + + SetWindowLongW(hwnd, GWL_EXSTYLE, GetWindowLongW(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, screen_surface, sizeof(screen_surface), FALSE); + + ret = UpdateLayeredWindow(hwnd, hdc_dst, NULL, (SIZE *)&rect.right, hdc_src, (POINT *)&rect.left, 0, NULL, ULW_OPAQUE); + ok(ret, "UpdateLayeredWindow failed, last error %u\n", GetLastError()); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, screen_surface, sizeof(screen_surface), FALSE); + + ShowWindow(hwnd, SW_SHOW); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), TRUE); + + ret = UpdateLayeredWindow(hwnd, hdc_dst, NULL, (SIZE *)&rect.right, hdc_src, (POINT *)&rect.left, BGRA2RGB(COLOR2), NULL, ULW_COLORKEY); + ok(ret, "UpdateLayeredWindow failed, last error %u\n", GetLastError()); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, layered_child_surface, sizeof(layered_child_surface), TRUE); + + ret = UpdateLayeredWindow(hwnd, hdc_dst, NULL, (SIZE *)&rect.right, hdc_src, (POINT *)&rect.left, 0, &blend_cst_alpha, ULW_ALPHA); + ok(ret, "UpdateLayeredWindow failed, last error %u\n", GetLastError()); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, layered_child_const_surface, sizeof(layered_child_const_surface), TRUE); + + ret = UpdateLayeredWindow(hwnd, hdc_dst, NULL, (SIZE *)&rect.right, hdc_src, (POINT *)&rect.left, 0, &blend_src_alpha, ULW_ALPHA); + ok(ret, "UpdateLayeredWindow failed, last error %u\n", GetLastError()); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, layered_child_alpha_surface, sizeof(layered_child_alpha_surface), TRUE); + + DeleteObject(bmp_obj); + DeleteDC(hdc_src); + ReleaseDC(NULL, hdc_dst); + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, layered_child_alpha_surface, sizeof(layered_child_alpha_surface), TRUE); + + hwnd_child = CreateWindowW(L"surface", L"", WS_CHILD | WS_VISIBLE, 1, 1, 2, 2, hwnd, NULL, NULL, NULL); + ok(hwnd_child != 0, "CreateWindowW failed, last error %u\n", GetLastError()); + flush_events( TRUE ); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, layered_child_alpha_surface, sizeof(layered_child_alpha_surface), TRUE); + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + paint_client_rect(hwnd_child, BGRA2RGB(COLOR2)); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, layered_child_alpha_surface, sizeof(layered_child_alpha_surface), TRUE); + + DestroyWindow(hwnd_child); + DestroyWindow(hwnd); + + + UnregisterClassW(L"surface", NULL); + +#undef BGRA2RGB +#undef COLOR1 +#undef COLOR2 +} + START_TEST(win) { char **argv; @@ -12178,6 +12862,8 @@ START_TEST(win) DestroyWindow(hwndMain2); DestroyWindow(hwndMain);
+ test_surface_composition(); + /* Make sure that following tests are executed last, under Windows they * tend to break the tests which are sensitive to z-order and activation * state of hwndMain and hwndMain2 windows.
From: RĂ©mi Bernon rbernon@codeweavers.com
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/user32/tests/Makefile.in | 2 +- dlls/user32/tests/win.c | 216 +++++++++++++++++++++++++++++++++- 2 files changed, 213 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/tests/Makefile.in b/dlls/user32/tests/Makefile.in index 5b058b7d914..326c44528ec 100644 --- a/dlls/user32/tests/Makefile.in +++ b/dlls/user32/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = user32.dll -IMPORTS = user32 gdi32 advapi32 hid dwmapi +IMPORTS = user32 gdi32 advapi32 hid dwmapi d3d9
C_SRCS = \ broadcast.c \ diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 6f9c566a651..b0796e4babd 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -32,6 +32,7 @@ #include "winuser.h" #include "winreg.h" #include "dwmapi.h" +#include "d3d9.h"
#include "wine/test.h"
@@ -12189,6 +12190,57 @@ static void check_client_surface_(int line, HWND hwnd, const DWORD *expect, SIZE free(data); }
+struct d3d9_context +{ + IDirect3D9 *d3d; + IDirect3DDevice9 *device; +}; + +static struct d3d9_context *create_d3d9_context(HWND hwnd) +{ + D3DPRESENT_PARAMETERS params; + struct d3d9_context *ctx; + HRESULT hr; + RECT rect; + + if (!(ctx = malloc(sizeof(struct d3d9_context)))) return NULL; + ctx->d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(ctx->d3d != NULL, "Direct3DCreate9 failed, last error %u\n", GetLastError()); + + GetClientRect(hwnd, &rect); + OffsetRect(&rect, -rect.left, -rect.top); + + memset(¶ms, 0, sizeof(params)); + params.Windowed = TRUE; + params.SwapEffect = D3DSWAPEFFECT_DISCARD; + params.hDeviceWindow = hwnd; + params.BackBufferFormat = D3DFMT_X8R8G8B8; + params.BackBufferWidth = rect.right; + params.BackBufferHeight = rect.bottom; + + hr = IDirect3D9_CreateDevice(ctx->d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, + D3DCREATE_SOFTWARE_VERTEXPROCESSING, ¶ms, &ctx->device); + ok(hr == S_OK, "IDirect3D9_CreateDevice returned %#x\n", hr); + + return ctx; +} + +static void paint_d3d9_client_rect(struct d3d9_context *ctx, DWORD color) +{ + HRESULT hr; + hr = IDirect3DDevice9_Clear(ctx->device, 0, NULL, D3DCLEAR_TARGET, color, 1.0f, 0); + ok(hr == S_OK, "IDirect3DDevice9_Clear returned %#x\n", hr); + hr = IDirect3DDevice9_Present(ctx->device, NULL, NULL, NULL, NULL); + ok(hr == S_OK, "IDirect3DDevice9_Present returned %#x\n", hr); +} + +static void destroy_d3d9_context(struct d3d9_context *ctx) +{ + IDirect3DDevice9_Release(ctx->device); + IDirect3D9_Release(ctx->d3d); + free(ctx); +} + static void paint_client_rect(HWND hwnd, COLORREF color) { HDC hdc = GetDC(hwnd); @@ -12226,6 +12278,8 @@ static void test_surface_composition(void) { #define COLOR1 0x00ff0000 #define COLOR2 0x0000ffff +#define COLOR3 0x00ff00ff +#define COLOR4 0x00ffff00 #define BGRA2RGB(x) RGB((x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff) static const DWORD minimized_surface[] = { @@ -12252,6 +12306,27 @@ static void test_surface_composition(void) COLOR1, COLOR1, COLOR1, COLOR1, COLOR1, COLOR1, COLOR1, COLOR1, }; + static const DWORD painted_surface2[] = + { + COLOR2, COLOR2, COLOR2, COLOR2, + COLOR2, COLOR2, COLOR2, COLOR2, + COLOR2, COLOR2, COLOR2, COLOR2, + COLOR2, COLOR2, COLOR2, COLOR2, + }; + static const DWORD painted_surface3[] = + { + COLOR3, COLOR3, COLOR3, COLOR3, + COLOR3, COLOR3, COLOR3, COLOR3, + COLOR3, COLOR3, COLOR3, COLOR3, + COLOR3, COLOR3, COLOR3, COLOR3, + }; + static const DWORD painted_surface4[] = + { + COLOR4, COLOR4, COLOR4, COLOR4, + COLOR4, COLOR4, COLOR4, COLOR4, + COLOR4, COLOR4, COLOR4, COLOR4, + COLOR4, COLOR4, COLOR4, COLOR4, + }; static const DWORD painted_child_surface[] = { COLOR1, COLOR1, COLOR1, COLOR1, COLOR1, COLOR2, COLOR2, COLOR1, @@ -12261,10 +12336,14 @@ static void test_surface_composition(void)
DWORD screen_surface[ARRAY_SIZE(painted_surface)]; DWORD layered_const_surface[ARRAY_SIZE(painted_surface)]; + DWORD layered_const_surface2[ARRAY_SIZE(painted_surface2)]; + DWORD layered_const_surface3[ARRAY_SIZE(painted_surface3)]; + DWORD layered_const_surface4[ARRAY_SIZE(painted_surface4)]; DWORD layered_child_surface[ARRAY_SIZE(painted_child_surface)]; DWORD layered_child_const_surface[ARRAY_SIZE(painted_child_surface)]; DWORD layered_child_alpha_surface[ARRAY_SIZE(painted_child_surface)];
+ struct d3d9_context *d3d9_ctx1, *d3d9_ctx2; BLENDFUNCTION blend_cst_alpha = { AC_SRC_OVER, 0, 0x7f, 0 }; BLENDFUNCTION blend_src_alpha = { AC_SRC_OVER, 0, 0xff, AC_SRC_ALPHA }; WNDCLASSEXW wc; @@ -12319,6 +12398,42 @@ static void test_surface_composition(void) layered_const_surface[i] = BGRA2RGB(RGB(dr, dg, db)); }
+ for (i = 0; i < ARRAY_SIZE(painted_surface2); i++) + { + BYTE sr = (screen_surface[i] >> 16) & 0xff, dr = (painted_surface2[i] >> 16) & 0xff; + BYTE sg = (screen_surface[i] >> 8) & 0xff, dg = (painted_surface2[i] >> 8) & 0xff; + BYTE sb = (screen_surface[i] >> 0) & 0xff, db = (painted_surface2[i] >> 0) & 0xff; + BYTE da = 0x7f; + dr = min(max((sr * (0xff - da) + dr * da + 0x7f) / 0xff, 0), 0xff); + dg = min(max((sg * (0xff - da) + dg * da + 0x7f) / 0xff, 0), 0xff); + db = min(max((sb * (0xff - da) + db * da + 0x7f) / 0xff, 0), 0xff); + layered_const_surface2[i] = BGRA2RGB(RGB(dr, dg, db)); + } + + for (i = 0; i < ARRAY_SIZE(painted_surface3); i++) + { + BYTE sr = (screen_surface[i] >> 16) & 0xff, dr = (painted_surface3[i] >> 16) & 0xff; + BYTE sg = (screen_surface[i] >> 8) & 0xff, dg = (painted_surface3[i] >> 8) & 0xff; + BYTE sb = (screen_surface[i] >> 0) & 0xff, db = (painted_surface3[i] >> 0) & 0xff; + BYTE da = 0x7f; + dr = min(max((sr * (0xff - da) + dr * da + 0x7f) / 0xff, 0), 0xff); + dg = min(max((sg * (0xff - da) + dg * da + 0x7f) / 0xff, 0), 0xff); + db = min(max((sb * (0xff - da) + db * da + 0x7f) / 0xff, 0), 0xff); + layered_const_surface3[i] = BGRA2RGB(RGB(dr, dg, db)); + } + + for (i = 0; i < ARRAY_SIZE(painted_surface4); i++) + { + BYTE sr = (screen_surface[i] >> 16) & 0xff, dr = (painted_surface4[i] >> 16) & 0xff; + BYTE sg = (screen_surface[i] >> 8) & 0xff, dg = (painted_surface4[i] >> 8) & 0xff; + BYTE sb = (screen_surface[i] >> 0) & 0xff, db = (painted_surface4[i] >> 0) & 0xff; + BYTE da = 0x7f; + dr = min(max((sr * (0xff - da) + dr * da + 0x7f) / 0xff, 0), 0xff); + dg = min(max((sg * (0xff - da) + dg * da + 0x7f) / 0xff, 0), 0xff); + db = min(max((sb * (0xff - da) + db * da + 0x7f) / 0xff, 0), 0xff); + layered_const_surface4[i] = BGRA2RGB(RGB(dr, dg, db)); + } + memcpy(layered_child_surface, screen_surface, sizeof(screen_surface)); for (i = 0; i < ARRAY_SIZE(painted_child_surface); i++) { @@ -12658,10 +12773,6 @@ static void test_surface_composition(void) check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); check_screen_surface(hwnd, layered_child_alpha_surface, sizeof(layered_child_alpha_surface), TRUE);
- DeleteObject(bmp_obj); - DeleteDC(hdc_src); - ReleaseDC(NULL, hdc_dst); - paint_client_rect(hwnd, BGRA2RGB(COLOR1)); check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); check_screen_surface(hwnd, layered_child_alpha_surface, sizeof(layered_child_alpha_surface), TRUE); @@ -12681,11 +12792,108 @@ static void test_surface_composition(void) DestroyWindow(hwnd);
+ /* D3D / GDI interactions */ + + hwnd = CreateWindowW(L"surface", L"", WS_POPUP | WS_VISIBLE, 0, 0, 4, 4, 0, NULL, NULL, NULL); + ok(hwnd != 0, "CreateWindowW failed, last error %u\n", GetLastError()); + d3d9_ctx1 = create_d3d9_context(hwnd); + d3d9_ctx2 = create_d3d9_context(hwnd); + flush_events( TRUE ); + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + + paint_d3d9_client_rect(d3d9_ctx1, COLOR2); + check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); + check_screen_surface(hwnd, painted_surface2, sizeof(painted_surface2), FALSE); + + paint_d3d9_client_rect(d3d9_ctx2, COLOR3); + check_client_surface(hwnd, painted_surface3, sizeof(painted_surface3), TRUE); + check_screen_surface(hwnd, painted_surface3, sizeof(painted_surface3), FALSE); + + paint_client_rect(hwnd, BGRA2RGB(COLOR4)); + check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); + check_screen_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); + + destroy_d3d9_context(d3d9_ctx1); + destroy_d3d9_context(d3d9_ctx2); + DestroyWindow(hwnd); + + + /* D3D / SLWA interactions */ + + hwnd = CreateWindowW(L"surface", L"", WS_POPUP, 0, 0, 4, 4, 0, NULL, NULL, NULL); + ok(hwnd != 0, "CreateWindowW failed, last error %u\n", GetLastError()); + d3d9_ctx1 = create_d3d9_context(hwnd); + d3d9_ctx2 = create_d3d9_context(hwnd); + + SetWindowLongW(hwnd, GWL_EXSTYLE, GetWindowLongW(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); + ret = SetLayeredWindowAttributes(hwnd, 0, 0x7f, LWA_ALPHA); + ok(ret, "SetLayeredWindowAttributes failed, last error %u\n", GetLastError()); + + ShowWindow(hwnd, SW_SHOW); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_screen_surface(hwnd, layered_const_surface, sizeof(layered_const_surface), TRUE); + + paint_d3d9_client_rect(d3d9_ctx1, COLOR2); + check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); + check_screen_surface(hwnd, layered_const_surface2, sizeof(layered_const_surface2), TRUE); + + paint_d3d9_client_rect(d3d9_ctx2, COLOR3); + check_client_surface(hwnd, painted_surface3, sizeof(painted_surface3), TRUE); + check_screen_surface(hwnd, layered_const_surface3, sizeof(layered_const_surface3), TRUE); + + paint_client_rect(hwnd, BGRA2RGB(COLOR4)); + check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); + check_screen_surface(hwnd, layered_const_surface4, sizeof(layered_const_surface4), TRUE); + + destroy_d3d9_context(d3d9_ctx1); + destroy_d3d9_context(d3d9_ctx2); + DestroyWindow(hwnd); + + + /* D3D / ULW interactions */ + + hwnd = CreateWindowW(L"surface", L"", WS_POPUP, 0, 0, 4, 4, 0, NULL, NULL, NULL); + ok(hwnd != 0, "CreateWindowW failed, last error %u\n", GetLastError()); + d3d9_ctx1 = create_d3d9_context(hwnd); + + SetWindowLongW(hwnd, GWL_EXSTYLE, GetWindowLongW(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); + ret = UpdateLayeredWindow(hwnd, hdc_dst, NULL, (SIZE *)&rect.right, hdc_src, (POINT *)&rect.left, 0, NULL, ULW_OPAQUE); + ok(ret, "UpdateLayeredWindow failed, last error %u\n", GetLastError()); + + ShowWindow(hwnd, SW_SHOW); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), TRUE); + + paint_d3d9_client_rect(d3d9_ctx1, COLOR2); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), TRUE); + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), TRUE); + + destroy_d3d9_context(d3d9_ctx1); + DestroyWindow(hwnd); + + + DeleteObject(bmp_obj); + DeleteDC(hdc_src); + ReleaseDC(NULL, hdc_dst); + UnregisterClassW(L"surface", NULL);
#undef BGRA2RGB #undef COLOR1 #undef COLOR2 +#undef COLOR3 +#undef COLOR4 }
START_TEST(win)
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=90718
Your paranoid android.
=== w1064 (32 bit report) ===
user32: clipboard.c:402: Test failed: GlobalGetAtomNameA should fail clipboard.c:403: Test failed: err -559038737
=== w10pro64_ar (64 bit report) ===
user32: clipboard.c:781: Test failed: 0: CF_LOCALE 00000c01/00000409 clipboard.c:781: Test failed: 1: CF_LOCALE 00000c01/00000409 clipboard.c:781: Test failed: 2: CF_LOCALE 00000c01/00000409
=== w10pro64_he (64 bit report) ===
user32: clipboard.c:781: Test failed: 0: CF_LOCALE 0000040d/00000409 clipboard.c:781: Test failed: 1: CF_LOCALE 0000040d/00000409 clipboard.c:781: Test failed: 2: CF_LOCALE 0000040d/00000409
=== w1064v1507 (32 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064v1809 (32 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064 (32 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064v1507 (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064v1809 (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064 (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064_2qxl (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64 (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64_ar (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64_he (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64_ja (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64_zh_CN (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w7u_2qxl (32 bit report) ===
user32: input.c:757: Test failed: 0 (a4/0): 00 from 00 -> 80 unexpected input.c:757: Test failed: 0 (a4/0): 41 from 01 -> 00 unexpected
=== w7u_el (32 bit report) ===
user32: input.c:4451: Test failed: SendInput triggered unexpected message 0xc042
=== wvistau64 (64 bit report) ===
user32: input.c:757: Test failed: 0 (a4/0): 01 from 01 -> 00 unexpected input.c:757: Test failed: 0 (a4/0): 11 from 01 -> 00 unexpected input.c:757: Test failed: 0 (a4/0): a2 from 01 -> 00 unexpected
=== w10pro64 (64 bit report) ===
user32: input.c:1303: Test failed: Wrong set pos: (99,100) input.c:1323: Test failed: GetCursorPos: (99,100)
=== w7u_el (32 bit report) ===
user32: menu.c:2337: Test failed: test 6 menu.c:2337: Test failed: test 8 menu.c:2337: Test failed: test 10 menu.c:2337: Test failed: test 12 menu.c:2337: Test failed: test 14 menu.c:2337: Test failed: test 16
=== w1064 (testbot log) ===
WineRunTask.pl:error: The previous 1 run(s) terminated abnormally
=== w10pro64_ar (64 bit report) ===
user32: menu.c:2337: Test failed: test 6 menu.c:2337: Test failed: test 8 menu.c:2337: Test failed: test 10 menu.c:2337: Test failed: test 12 menu.c:2337: Test failed: test 14 menu.c:2337: Test failed: test 16
=== w10pro64_he (64 bit report) ===
user32: menu.c:2337: Test failed: test 6 menu.c:2337: Test failed: test 8 menu.c:2337: Test failed: test 10 menu.c:2337: Test failed: test 12 menu.c:2337: Test failed: test 14 menu.c:2337: Test failed: test 16
=== w10pro64_ja (64 bit report) ===
user32: menu.c:2337: Test failed: test 0
=== w10pro64_zh_CN (64 bit report) ===
user32: menu.c:2337: Test failed: test 13
=== w8 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w8adm (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w864 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064v1809 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064_tsign (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w10pro64 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064 (32 bit report) ===
user32: win.c:9492: Test failed: Timed out waiting for the child process
=== w10pro64_ar (64 bit report) ===
user32: win.c:9419: Test failed: button under static window didn't get WM_LBUTTONUP win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3359: Test failed: VK_LBUTTON should not be pressed, state ff81
=== debiant2 (32 bit report) ===
user32: win.c:10163: Test failed: Expected foreground window 00470118, got 00EB00D6 win.c:10173: Test failed: Expected foreground window 00470118, got 00000000 win.c:12485: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (36701 bytes)
=== debiant2 (32 bit French report) ===
user32: win.c:12485: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (36188 bytes)
=== debiant2 (32 bit Japanese:Japan report) ===
user32: win.c:10127: Test failed: GetForegroundWindow() = 0035011E win.c:12485: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (36249 bytes)
=== debiant2 (32 bit Chinese:China report) ===
user32: win.c:12485: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (36188 bytes)
=== debiant2 (32 bit WoW report) ===
user32: win.c:12485: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (36188 bytes)
=== debiant2 (64 bit WoW report) ===
user32: win.c:12485: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (37417 bytes)
From: RĂ©mi Bernon rbernon@codeweavers.com
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/user32/tests/Makefile.in | 2 +- dlls/user32/tests/win.c | 144 +++++++++++++++++++++++++++++++++- 2 files changed, 143 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/tests/Makefile.in b/dlls/user32/tests/Makefile.in index 326c44528ec..e7f9883896f 100644 --- a/dlls/user32/tests/Makefile.in +++ b/dlls/user32/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = user32.dll -IMPORTS = user32 gdi32 advapi32 hid dwmapi d3d9 +IMPORTS = user32 gdi32 advapi32 hid dwmapi d3d9 opengl32
C_SRCS = \ broadcast.c \ diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index b0796e4babd..b50c8e1ff00 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -34,6 +34,7 @@ #include "dwmapi.h" #include "d3d9.h"
+#include "wine/wgl.h" #include "wine/test.h"
#ifndef SPI_GETDESKWALLPAPER @@ -12152,6 +12153,7 @@ static SIZE_T capture_client_surface_(int line, HWND hwnd, DWORD *surface, SIZE_ SIZE_T data_size; RECT rect; HDC hdc; + int i;
GetClientRect(hwnd, &rect); OffsetRect(&rect, -rect.left, -rect.top); @@ -12161,6 +12163,9 @@ static SIZE_T capture_client_surface_(int line, HWND hwnd, DWORD *surface, SIZE_ data_size = capture_surface_(line, hdc, 0, 0, rect.right, rect.bottom, surface, surface_size); ReleaseDC(hwnd, hdc);
+ /* clear inconsistent alpha channel (D3D R5G6B5 clear sets it, other paint ops clear it) */ + for (i = 0; i < data_size / 4; i++) surface[i] &= 0xffffff; + return data_size; }
@@ -12214,7 +12219,7 @@ static struct d3d9_context *create_d3d9_context(HWND hwnd) params.Windowed = TRUE; params.SwapEffect = D3DSWAPEFFECT_DISCARD; params.hDeviceWindow = hwnd; - params.BackBufferFormat = D3DFMT_X8R8G8B8; + params.BackBufferFormat = D3DFMT_R5G6B5; /* something incompatible with GL */ params.BackBufferWidth = rect.right; params.BackBufferHeight = rect.bottom;
@@ -12241,6 +12246,67 @@ static void destroy_d3d9_context(struct d3d9_context *ctx) free(ctx); }
+struct gl_context +{ + HWND hwnd; + HDC hdc; + HGLRC hrc; + IDirect3D9 *d3d; + IDirect3DDevice9 *device; +}; + +static struct gl_context *create_gl_context(HWND hwnd) +{ + PIXELFORMATDESCRIPTOR desc; + struct gl_context *ctx; + RECT rect; + BOOL ret; + INT pixel_format; + + if (!(ctx = malloc(sizeof(struct gl_context)))) return NULL; + + GetClientRect(hwnd, &rect); + OffsetRect(&rect, -rect.left, -rect.top); + + memset(&desc, 0, sizeof(desc)); + desc.nSize = sizeof(PIXELFORMATDESCRIPTOR); + desc.nVersion = 1; + desc.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; + desc.iPixelType = PFD_TYPE_RGBA; + desc.cColorBits = 32; + + ctx->hwnd = hwnd; + ctx->hdc = GetDC(hwnd); + pixel_format = ChoosePixelFormat(ctx->hdc, &desc); + ok(pixel_format, "ChoosePixelFormat returned 0, last error %u\n", GetLastError()); + ret = SetPixelFormat(ctx->hdc, pixel_format, &desc); + ok(ret, "SetPixelFormat failed, last error %u\n", GetLastError()); + ctx->hrc = wglCreateContext(ctx->hdc); + wglMakeCurrent(ctx->hdc, ctx->hrc); + glViewport(0, 0, (GLint)rect.right, (GLint)rect.bottom); + + return ctx; +} + +static void paint_gl_client_rect(struct gl_context *ctx, DWORD color) +{ + BOOL ret; + ret = wglMakeCurrent(ctx->hdc, ctx->hrc); + ok(ret, "wglMakeCurrent failed\n"); + glClearColor((color >> 16) & 0xff, (color >> 8) & 0xff, (color >> 0) & 0xff, 0); + glClear(GL_COLOR_BUFFER_BIT); + ret = SwapBuffers(ctx->hdc); + ok(ret, "SwapBuffers failed\n"); +} + +static void destroy_gl_context(struct gl_context *ctx) +{ + wglMakeCurrent(NULL, NULL); + wglDeleteContext(ctx->hrc); + ReleaseDC(ctx->hwnd, ctx->hdc); + free(ctx); +} + static void paint_client_rect(HWND hwnd, COLORREF color) { HDC hdc = GetDC(hwnd); @@ -12344,6 +12410,7 @@ static void test_surface_composition(void) DWORD layered_child_alpha_surface[ARRAY_SIZE(painted_child_surface)];
struct d3d9_context *d3d9_ctx1, *d3d9_ctx2; + struct gl_context *gl_ctx1, *gl_ctx2; BLENDFUNCTION blend_cst_alpha = { AC_SRC_OVER, 0, 0x7f, 0 }; BLENDFUNCTION blend_src_alpha = { AC_SRC_OVER, 0, 0xff, AC_SRC_ALPHA }; WNDCLASSEXW wc; @@ -12792,7 +12859,7 @@ static void test_surface_composition(void) DestroyWindow(hwnd);
- /* D3D / GDI interactions */ + /* D3D / GL / GDI interactions */
hwnd = CreateWindowW(L"surface", L"", WS_POPUP | WS_VISIBLE, 0, 0, 4, 4, 0, NULL, NULL, NULL); ok(hwnd != 0, "CreateWindowW failed, last error %u\n", GetLastError()); @@ -12816,6 +12883,44 @@ static void test_surface_composition(void) check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); check_screen_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE);
+ gl_ctx1 = create_gl_context(hwnd); + gl_ctx2 = create_gl_context(hwnd); + flush_events( TRUE ); + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + + paint_gl_client_rect(gl_ctx1, COLOR2); + check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); + check_screen_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); + + paint_gl_client_rect(gl_ctx2, COLOR3); + check_client_surface(hwnd, painted_surface3, sizeof(painted_surface3), TRUE); + check_screen_surface(hwnd, painted_surface3, sizeof(painted_surface3), TRUE); + + paint_d3d9_client_rect(d3d9_ctx1, COLOR4); + check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); + check_screen_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); + + paint_gl_client_rect(gl_ctx2, COLOR2); + check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); + check_screen_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); + + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + + paint_d3d9_client_rect(d3d9_ctx2, COLOR3); + check_client_surface(hwnd, painted_surface3, sizeof(painted_surface3), TRUE); + check_screen_surface(hwnd, painted_surface3, sizeof(painted_surface3), TRUE); + + paint_gl_client_rect(gl_ctx1, COLOR4); + check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); + check_screen_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); + + destroy_gl_context(gl_ctx1); + destroy_gl_context(gl_ctx2); destroy_d3d9_context(d3d9_ctx1); destroy_d3d9_context(d3d9_ctx2); DestroyWindow(hwnd); @@ -12850,6 +12955,35 @@ static void test_surface_composition(void) check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); check_screen_surface(hwnd, layered_const_surface4, sizeof(layered_const_surface4), TRUE);
+ gl_ctx1 = create_gl_context(hwnd); + gl_ctx2 = create_gl_context(hwnd); + flush_events( TRUE ); + paint_client_rect(hwnd, BGRA2RGB(COLOR1)); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_screen_surface(hwnd, layered_const_surface, sizeof(layered_const_surface), TRUE); + + paint_gl_client_rect(gl_ctx1, COLOR2); + check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); + check_screen_surface(hwnd, layered_const_surface2, sizeof(layered_const_surface2), TRUE); + + paint_d3d9_client_rect(d3d9_ctx1, COLOR3); + check_client_surface(hwnd, painted_surface3, sizeof(painted_surface3), TRUE); + check_screen_surface(hwnd, layered_const_surface3, sizeof(layered_const_surface3), TRUE); + + paint_gl_client_rect(gl_ctx2, COLOR4); + check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); + check_screen_surface(hwnd, layered_const_surface4, sizeof(layered_const_surface4), TRUE); + + paint_client_rect(hwnd, BGRA2RGB(COLOR2)); + check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); + check_screen_surface(hwnd, layered_const_surface2, sizeof(layered_const_surface2), TRUE); + + paint_d3d9_client_rect(d3d9_ctx2, COLOR1); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_screen_surface(hwnd, layered_const_surface, sizeof(layered_const_surface), TRUE); + + destroy_gl_context(gl_ctx1); + destroy_gl_context(gl_ctx2); destroy_d3d9_context(d3d9_ctx1); destroy_d3d9_context(d3d9_ctx2); DestroyWindow(hwnd); @@ -12860,6 +12994,7 @@ static void test_surface_composition(void) hwnd = CreateWindowW(L"surface", L"", WS_POPUP, 0, 0, 4, 4, 0, NULL, NULL, NULL); ok(hwnd != 0, "CreateWindowW failed, last error %u\n", GetLastError()); d3d9_ctx1 = create_d3d9_context(hwnd); + gl_ctx1 = create_gl_context(hwnd);
SetWindowLongW(hwnd, GWL_EXSTYLE, GetWindowLongW(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); ret = UpdateLayeredWindow(hwnd, hdc_dst, NULL, (SIZE *)&rect.right, hdc_src, (POINT *)&rect.left, 0, NULL, ULW_OPAQUE); @@ -12871,6 +13006,10 @@ static void test_surface_composition(void) check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), TRUE);
+ paint_gl_client_rect(gl_ctx1, COLOR1); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), TRUE); + paint_d3d9_client_rect(d3d9_ctx1, COLOR2); check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), TRUE); @@ -12879,6 +13018,7 @@ static void test_surface_composition(void) check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); check_screen_surface(hwnd, painted_child_surface, sizeof(painted_child_surface), TRUE);
+ destroy_gl_context(gl_ctx1); destroy_d3d9_context(d3d9_ctx1); DestroyWindow(hwnd);
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=90719
Your paranoid android.
=== w1064_tsign (32 bit report) ===
user32: clipboard.c:1202: Test failed: OpenClipboard failed: 5 clipboard.c:1204: Test failed: sequence diff 0 clipboard.c:1208: Test failed: CloseClipboard failed: 1418 clipboard.c:1017: Test failed: wait failed clipboard.c:1211: Test failed: WM_DRAWCLIPBOARD not received clipboard.c:1211: Test failed: WM_CLIPBOARDUPDATE not received
=== w1064 (64 bit report) ===
user32: clipboard.c:402: Test failed: GlobalGetAtomNameA should fail clipboard.c:403: Test failed: err -559038737
=== w10pro64_ar (64 bit report) ===
user32: clipboard.c:781: Test failed: 0: CF_LOCALE 00000c01/00000409 clipboard.c:781: Test failed: 1: CF_LOCALE 00000c01/00000409 clipboard.c:781: Test failed: 2: CF_LOCALE 00000c01/00000409
=== w10pro64_he (64 bit report) ===
user32: clipboard.c:781: Test failed: 0: CF_LOCALE 0000040d/00000409 clipboard.c:781: Test failed: 1: CF_LOCALE 0000040d/00000409 clipboard.c:781: Test failed: 2: CF_LOCALE 0000040d/00000409
=== w1064v1507 (32 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064v1809 (32 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064 (32 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064v1507 (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064v1809 (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064 (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064_2qxl (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64 (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64_ar (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64_he (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64_ja (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64_zh_CN (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w7u_2qxl (32 bit report) ===
user32: input.c:757: Test failed: 0 (a4/0): 00 from 00 -> 80 unexpected input.c:757: Test failed: 0 (a4/0): 41 from 01 -> 00 unexpected
=== wvistau64 (64 bit report) ===
user32: input.c:757: Test failed: 0 (a4/0): 01 from 01 -> 00 unexpected input.c:757: Test failed: 0 (a4/0): 11 from 01 -> 00 unexpected input.c:757: Test failed: 0 (a4/0): a2 from 01 -> 00 unexpected
=== w1064v1809 (64 bit report) ===
user32: input.c:2793: Test failed: 0: expected WM_MOUSEMOVE message input.c:2793: Test failed: 1: expected WM_MOUSEMOVE message input.c:2793: Test failed: 2: expected WM_MOUSEMOVE message
=== w1064 (64 bit report) ===
user32: input.c:1303: Test failed: Wrong set pos: (100,100) input.c:1323: Test failed: GetCursorPos: (100,100) input.c:1369: Test failed: Wrong new pos: (100,100) input.c:1293: Test failed: GetCursorPos: (100,98)
=== w7u_el (32 bit report) ===
user32: menu.c:2337: Test failed: test 6 menu.c:2337: Test failed: test 8 menu.c:2337: Test failed: test 10 menu.c:2337: Test failed: test 12 menu.c:2337: Test failed: test 14 menu.c:2337: Test failed: test 16
=== w10pro64_ar (64 bit report) ===
user32: menu.c:2337: Test failed: test 6 menu.c:2337: Test failed: test 8 menu.c:2337: Test failed: test 10 menu.c:2337: Test failed: test 12 menu.c:2337: Test failed: test 14 menu.c:2337: Test failed: test 16
=== w10pro64_he (64 bit report) ===
user32: menu.c:2337: Test failed: test 6 menu.c:2337: Test failed: test 8 menu.c:2337: Test failed: test 10 menu.c:2337: Test failed: test 12 menu.c:2337: Test failed: test 14 menu.c:2337: Test failed: test 16
=== w8 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w8adm (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w864 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064v1809 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064_tsign (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w10pro64 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== wvistau64 (testbot log) ===
WineRunTask.pl:error: The previous 1 run(s) terminated abnormally
=== w10pro64_he (64 bit report) ===
user32: win.c:9420: Test failed: button under static window didn't get WM_LBUTTONUP win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81 win.c:3360: Test failed: VK_LBUTTON should not be pressed, state ff81
=== debiant2 (32 bit report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (42526 bytes)
=== debiant2 (32 bit French report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (42526 bytes)
=== debiant2 (32 bit Japanese:Japan report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (42526 bytes)
=== debiant2 (32 bit Chinese:China report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (42526 bytes)
=== debiant2 (32 bit WoW report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (42526 bytes)
=== debiant2 (64 bit WoW report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (43755 bytes)
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/user32/tests/win.c | 6 ++-- dlls/winex11.drv/bitblt.c | 75 +++++++++++++++++++++++++++++++++++---- 2 files changed, 72 insertions(+), 9 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index b50c8e1ff00..30514a05234 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -12580,7 +12580,7 @@ static void test_surface_composition(void) flush_events( TRUE ); paint_client_rect(hwnd, BGRA2RGB(COLOR1)); check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); - check_screen_surface(hwnd, partial_surface, sizeof(partial_surface), TRUE); + check_screen_surface(hwnd, partial_surface, sizeof(partial_surface), FALSE);
SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE); flush_events( TRUE ); @@ -12682,7 +12682,7 @@ static void test_surface_composition(void)
SetWindowLongW(hwnd, GWL_EXSTYLE, GetWindowLongW(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); paint_client_rect(hwnd, BGRA2RGB(COLOR1)); - check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), FALSE); check_screen_surface(hwnd, screen_surface, sizeof(screen_surface), FALSE);
ShowWindow(hwnd, SW_SHOW); @@ -12807,7 +12807,7 @@ static void test_surface_composition(void)
SetWindowLongW(hwnd, GWL_EXSTYLE, GetWindowLongW(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); paint_client_rect(hwnd, BGRA2RGB(COLOR1)); - check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), TRUE); + check_client_surface(hwnd, hidden_surface, sizeof(hidden_surface), FALSE); check_screen_surface(hwnd, screen_surface, sizeof(screen_surface), FALSE);
ret = UpdateLayeredWindow(hwnd, hdc_dst, NULL, (SIZE *)&rect.right, hdc_src, (POINT *)&rect.left, 0, NULL, ULW_OPAQUE); diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index fad183b0b01..3a083ea415c 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -1297,6 +1297,65 @@ update_format: return ERROR_BAD_FORMAT; }
+static XImage *safe_get_image( Drawable drawable, RECT *dc_rect, XVisualInfo *vis, + int x, int y, int width, int height, BOOL *use_xfree ) +{ + XImage *image; + int dest_x = 0, dest_y = 0; + + if (width < 0 || height < 0) + return NULL; + + if (x >= dc_rect->left && y >= dc_rect->top + && x + width <= dc_rect->right && y + height <= dc_rect->bottom) + { + *use_xfree = TRUE; + return XGetImage( gdi_display, drawable, x, y, width, height, AllPlanes, ZPixmap ); + } + + *use_xfree = FALSE; + image = XCreateImage( gdi_display, vis->visual, vis->depth, ZPixmap, 0, NULL, + width, height, 32, 0 ); + if (!image) + return NULL; + + image->data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, image->bytes_per_line * image->height ); + if (!image->data) + { + XDestroyImage( image ); + return NULL; + } + + if (x >= dc_rect->right || y >= dc_rect->bottom + || x + width <= dc_rect->left || y + height <= dc_rect->top) + return image; + + if (x < dc_rect->left) + { + dest_x = dc_rect->left - x; + width -= dest_x; + x += dest_x; + } + if (y < dc_rect->top) + { + dest_y = dc_rect->top - y; + height -= dest_y; + y += dest_y; + } + if (x + width > dc_rect->right) + width -= dc_rect->right - (x + width); + if (y + height > dc_rect->bottom) + height -= dc_rect->bottom - (y + height); + + if (XGetSubImage( gdi_display, drawable, x, y, width, height, AllPlanes, ZPixmap, image, dest_x, dest_y )) + return image; + + HeapFree( GetProcessHeap(), 0, image->data ); + image->data = NULL; + XDestroyImage( image ); + return NULL; +} + /*********************************************************************** * X11DRV_GetImage */ @@ -1311,6 +1370,7 @@ DWORD CDECL X11DRV_GetImage( PHYSDEV dev, BITMAPINFO *info, struct gdi_image_bits src_bits; const XPixmapFormatValues *format; const int *mapping = NULL; + BOOL use_xfree = FALSE;
vis.depth = physdev->depth; if (physdev->color_shifts) @@ -1356,14 +1416,17 @@ DWORD CDECL X11DRV_GetImage( PHYSDEV dev, BITMAPINFO *info, OffsetRect( &src->visrect, -x, -y );
X11DRV_expect_error( gdi_display, XGetImage_handler, NULL ); - image = XGetImage( gdi_display, physdev->drawable, + image = safe_get_image ( physdev->drawable, &physdev->dc_rect, &vis, physdev->dc_rect.left + x, physdev->dc_rect.top + y, - width, height, AllPlanes, ZPixmap ); + width, height, &use_xfree ); if (X11DRV_check_error()) { /* use a temporary pixmap to avoid the BadMatch error */ Pixmap pixmap = XCreatePixmap( gdi_display, root_window, width, height, vis.depth ); GC gc = XCreateGC( gdi_display, pixmap, 0, NULL ); + int black = BlackPixel( gdi_display, DefaultScreen(gdi_display) ); + XSetForeground( gdi_display, gc, black ); + XFillRectangle( gdi_display, pixmap, gc, 0, 0, width, height );
XSetGraphicsExposures( gdi_display, gc, False ); XCopyArea( gdi_display, physdev->drawable, pixmap, gc, @@ -1385,10 +1448,10 @@ DWORD CDECL X11DRV_GetImage( PHYSDEV dev, BITMAPINFO *info, zeropad_masks[(width * image->bits_per_pixel) & 31] );
if (!ret && bits->ptr == image->data) - { - bits->free = free_ximage_bits; - image->data = NULL; - } + bits->free = use_xfree ? free_ximage_bits : free_heap_bits; + else + use_xfree ? XFree(image->data) : HeapFree( GetProcessHeap(), 0, image->data ); + image->data = NULL; XDestroyImage( image ); return ret; }
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=90720
Your paranoid android.
=== debiant2 (32 bit report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (42034 bytes)
=== debiant2 (32 bit French report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (42034 bytes)
=== debiant2 (32 bit Japanese:Japan report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (42034 bytes)
=== debiant2 (32 bit Chinese:China report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (42034 bytes)
=== debiant2 (32 bit WoW report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (42034 bytes)
=== debiant2 (64 bit WoW report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (43262 bytes)
The X11 protocol does not specify how lines must be drawn when they have zero width. On some implementations (particularly, Xorg), drawing a rectangle with zero width results in the bottom right pixel not being drawn. Setting line width to 1 in this case is properly specified and results in the bottom right pixel being correctly drawn.
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/user32/tests/win.c | 24 ++++++++++++------------ dlls/winex11.drv/graphics.c | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 30514a05234..a61c50b9b5a 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -12868,8 +12868,8 @@ static void test_surface_composition(void) flush_events( TRUE );
paint_client_rect(hwnd, BGRA2RGB(COLOR1)); - check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); - check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE);
paint_d3d9_client_rect(d3d9_ctx1, COLOR2); check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); @@ -12880,16 +12880,16 @@ static void test_surface_composition(void) check_screen_surface(hwnd, painted_surface3, sizeof(painted_surface3), FALSE);
paint_client_rect(hwnd, BGRA2RGB(COLOR4)); - check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); - check_screen_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); + check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), FALSE); + check_screen_surface(hwnd, painted_surface4, sizeof(painted_surface4), FALSE);
gl_ctx1 = create_gl_context(hwnd); gl_ctx2 = create_gl_context(hwnd); flush_events( TRUE );
paint_client_rect(hwnd, BGRA2RGB(COLOR1)); - check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); - check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE);
paint_gl_client_rect(gl_ctx1, COLOR2); check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); @@ -12908,8 +12908,8 @@ static void test_surface_composition(void) check_screen_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE);
paint_client_rect(hwnd, BGRA2RGB(COLOR1)); - check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); - check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); + check_screen_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE);
paint_d3d9_client_rect(d3d9_ctx2, COLOR3); check_client_surface(hwnd, painted_surface3, sizeof(painted_surface3), TRUE); @@ -12940,7 +12940,7 @@ static void test_surface_composition(void) ShowWindow(hwnd, SW_SHOW); flush_events( TRUE ); paint_client_rect(hwnd, BGRA2RGB(COLOR1)); - check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); check_screen_surface(hwnd, layered_const_surface, sizeof(layered_const_surface), TRUE);
paint_d3d9_client_rect(d3d9_ctx1, COLOR2); @@ -12952,14 +12952,14 @@ static void test_surface_composition(void) check_screen_surface(hwnd, layered_const_surface3, sizeof(layered_const_surface3), TRUE);
paint_client_rect(hwnd, BGRA2RGB(COLOR4)); - check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), TRUE); + check_client_surface(hwnd, painted_surface4, sizeof(painted_surface4), FALSE); check_screen_surface(hwnd, layered_const_surface4, sizeof(layered_const_surface4), TRUE);
gl_ctx1 = create_gl_context(hwnd); gl_ctx2 = create_gl_context(hwnd); flush_events( TRUE ); paint_client_rect(hwnd, BGRA2RGB(COLOR1)); - check_client_surface(hwnd, painted_surface, sizeof(painted_surface), TRUE); + check_client_surface(hwnd, painted_surface, sizeof(painted_surface), FALSE); check_screen_surface(hwnd, layered_const_surface, sizeof(layered_const_surface), TRUE);
paint_gl_client_rect(gl_ctx1, COLOR2); @@ -12975,7 +12975,7 @@ static void test_surface_composition(void) check_screen_surface(hwnd, layered_const_surface4, sizeof(layered_const_surface4), TRUE);
paint_client_rect(hwnd, BGRA2RGB(COLOR2)); - check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), TRUE); + check_client_surface(hwnd, painted_surface2, sizeof(painted_surface2), FALSE); check_screen_surface(hwnd, layered_const_surface2, sizeof(layered_const_surface2), TRUE);
paint_d3d9_client_rect(d3d9_ctx2, COLOR1); diff --git a/dlls/winex11.drv/graphics.c b/dlls/winex11.drv/graphics.c index 77ca60ec44d..f16db5d16d6 100644 --- a/dlls/winex11.drv/graphics.c +++ b/dlls/winex11.drv/graphics.c @@ -794,7 +794,7 @@ BOOL CDECL X11DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT botto rc.top += width / 2; rc.bottom -= (width - 1) / 2; } - if(width == 1) width = 0; + if (!width) width = 1; physDev->pen.width = width; oldjoinstyle = physDev->pen.linejoin; if(physDev->pen.type != PS_GEOMETRIC)
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=90721
Your paranoid android.
=== w1064_tsign (32 bit report) ===
user32: win.c:3933: Test failed: hwnd 000D01EA/000D01EA message 0200 win.c:3935: Test failed: wparam 0 win.c:3946: Test failed: hwnd 000D01EA/000D01EA message 0203 win.c:3950: Test failed: message 0202 available
=== debiant2 (32 bit report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (41470 bytes)
=== debiant2 (32 bit French report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (41470 bytes)
=== debiant2 (32 bit Japanese:Japan report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (41470 bytes)
=== debiant2 (32 bit Chinese:China report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (41470 bytes)
=== debiant2 (32 bit WoW report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (41470 bytes)
=== debiant2 (64 bit WoW report) ===
user32: win.c:12552: Test failed: Unexpected client surface data
Report validation errors: user32:win prints too much data (42698 bytes)
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=90715
Your paranoid android.
=== w8adm (32 bit report) ===
user32: clipboard.c:402: Test failed: GlobalGetAtomNameA should fail clipboard.c:403: Test failed: err -559038737
=== w1064 (32 bit report) ===
user32: clipboard.c:402: Test failed: GlobalGetAtomNameA should fail clipboard.c:403: Test failed: err -559038737
=== w1064 (64 bit report) ===
user32: clipboard.c:402: Test failed: GlobalGetAtomNameA should fail clipboard.c:403: Test failed: err -559038737
=== w10pro64_ar (64 bit report) ===
user32: clipboard.c:781: Test failed: 0: CF_LOCALE 00000c01/00000409 clipboard.c:781: Test failed: 1: CF_LOCALE 00000c01/00000409 clipboard.c:781: Test failed: 2: CF_LOCALE 00000c01/00000409
=== w10pro64_he (64 bit report) ===
user32: clipboard.c:781: Test failed: 0: CF_LOCALE 0000040d/00000409 clipboard.c:781: Test failed: 1: CF_LOCALE 0000040d/00000409 clipboard.c:781: Test failed: 2: CF_LOCALE 0000040d/00000409
=== w1064v1507 (32 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064v1809 (32 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064 (32 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064v1507 (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064v1809 (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064 (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064_2qxl (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64 (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64_ar (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64_he (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64_ja (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w10pro64_zh_CN (64 bit report) ===
user32: cursoricon.c:2420: Test failed: cursor not shown in info cursoricon.c:2444: Test failed: cursor not shown in info cursoricon.c:2497: Test failed: cursor not shown in info cursoricon.c:2509: Test failed: cursor not shown in info
=== w1064_tsign (64 bit report) ===
user32: edit.c:3193: Test failed: expected 1, got 0 edit.c:3195: Test failed: expected 1, got 0 edit.c:3197: Test failed: expected 0000000000FB0098, got 0000000000000000 edit.c:3199: Test failed: expected 1, got 0 edit.c:3205: Test failed: got 9
=== w7u_2qxl (32 bit report) ===
user32: input.c:757: Test failed: 0 (a4/0): 00 from 00 -> 80 unexpected input.c:757: Test failed: 0 (a4/0): 41 from 01 -> 00 unexpected
=== w7u_el (32 bit report) ===
user32: input.c:4451: Test failed: SendInput triggered unexpected message 0xc042
=== w1064v1809 (32 bit report) ===
user32: input.c:2793: Test failed: 0: expected WM_MOUSEMOVE message input.c:2793: Test failed: 1: expected WM_MOUSEMOVE message input.c:2793: Test failed: 2: expected WM_MOUSEMOVE message
=== wvistau64 (64 bit report) ===
user32: input.c:757: Test failed: 0 (a4/0): 01 from 01 -> 00 unexpected input.c:757: Test failed: 0 (a4/0): 11 from 01 -> 00 unexpected input.c:757: Test failed: 0 (a4/0): a2 from 01 -> 00 unexpected
=== w7u_el (32 bit report) ===
user32: menu.c:2337: Test failed: test 6 menu.c:2337: Test failed: test 8 menu.c:2337: Test failed: test 10 menu.c:2337: Test failed: test 12 menu.c:2337: Test failed: test 14 menu.c:2337: Test failed: test 16
=== w10pro64_ar (64 bit report) ===
user32: menu.c:2337: Test failed: test 6 menu.c:2337: Test failed: test 8 menu.c:2337: Test failed: test 10 menu.c:2337: Test failed: test 12 menu.c:2337: Test failed: test 14 menu.c:2337: Test failed: test 16
=== w10pro64_he (64 bit report) ===
user32: menu.c:2337: Test failed: test 6 menu.c:2337: Test failed: test 8 menu.c:2337: Test failed: test 10 menu.c:2337: Test failed: test 12 menu.c:2337: Test failed: test 14 menu.c:2337: Test failed: test 16
=== w1064 (32 bit report) ===
user32: msg.c:14930: Test failed: unexpected message 31f msg.c:14931: Test failed: bad wparam 1 msg.c:14937: Test failed: unicode WM_CHAR: 0: the msg sequence is not complete: expected 0102 - actual 0000
=== w1064v1507 (64 bit report) ===
user32: msg.c:16360: Test failed: 4: message c000, got 0, error 5 msg.c:16365: Test failed: 4,0: message c000, got 0, error 5 msg.c:16365: Test failed: 4,1: message c000, got 0, error 5 msg.c:16365: Test failed: 4,2: message c000, got 0, error 5 msg.c:16365: Test failed: 4,3: message c000, got 0, error 5 msg.c:16365: Test failed: 4,8: message c000, got 0, error 5 msg.c:16365: Test failed: 4,9: message c000, got 0, error 5 msg.c:16365: Test failed: 4,10: message c000, got 0, error 5 msg.c:16365: Test failed: 4,11: message c000, got 0, error 5 msg.c:16365: Test failed: 4,12: message c000, got 0, error 5
=== w8 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w8adm (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w864 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064v1809 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064_tsign (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w10pro64 (32 bit report) ===
user32: sysparams.c:2494: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2505: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w10pro64_ar (64 bit report) ===
user32: sysparams.c:351: Test failed: Wrong value in registry: Software\Microsoft\Windows NT\CurrentVersion\Windows MenuDropAlignment '1' instead of '0' sysparams.c:1189: Test failed: SPI_{GET,SET}MENUDROPALIGNMENT: got 1 instead of 0 sysparams.c:1191: Test failed: SM_MENUDROPALIGNMENT: got 1 instead of 0
=== debiant2 (32 bit report) ===
user32: win.c:12370: Test failed: Unexpected client surface data
=== debiant2 (32 bit French report) ===
user32: menu.c:2337: Test failed: test 25 win.c:12370: Test failed: Unexpected client surface data
=== debiant2 (32 bit Japanese:Japan report) ===
user32: win.c:12370: Test failed: Unexpected client surface data
=== debiant2 (32 bit Chinese:China report) ===
user32: win.c:12370: Test failed: Unexpected client surface data
=== debiant2 (32 bit WoW report) ===
user32: win.c:12370: Test failed: Unexpected client surface data
=== debiant2 (64 bit WoW report) ===
user32: win.c:10156: Test failed: Expected foreground window 0, got 0000000000F60050 win.c:10162: Test failed: Expected foreground window 00000000000E0120, got 0000000000F60050 win.c:12370: Test failed: Unexpected client surface data