comctl32/tests: Remove WM_CTLCOLORSTATIC tests for static controls.

These tests are covered by test_EnableThemeDialogTexture() in uxtheme/tests/system.c. These tests
are also misleading because a WM_ERASEBKGND message is needed to actually activate dialog theming.
Without the message, they give the impression that EnableThemeDialogTexture() does nothing and
DefDlgProcA/W() are not hooked.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2022-01-21 15:47:38 +08:00 committed by Alexandre Julliard
parent 6f139defee
commit 2390371f0f
1 changed files with 0 additions and 120 deletions

View File

@ -27,7 +27,6 @@
#include "winuser.h"
#include "commctrl.h"
#include "resources.h"
#include "uxtheme.h"
#include "wine/test.h"
@ -40,10 +39,6 @@
static HWND hMainWnd;
static int g_nReceivedColorStatic;
static HRESULT (WINAPI *pEnableThemeDialogTexture)(HWND, DWORD);
static HTHEME (WINAPI *pGetWindowTheme)(HWND);
static BOOL (WINAPI *pIsThemeDialogTextureEnabled)(HWND);
/* try to make sure pending X events have been processed before continuing */
static void flush_events(void)
{
@ -382,118 +377,6 @@ static void test_STM_SETIMAGE(void)
DeleteEnhMetaFile(emf);
}
static INT_PTR CALLBACK test_WM_CTLCOLORSTATIC_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
static HWND child;
switch (msg)
{
case WM_INITDIALOG:
child = CreateWindowA(WC_STATICA, "child", WS_CHILD | WS_VISIBLE, 1, 2, 50, 50, hwnd,
(HMENU)100, 0, NULL);
ok(child != NULL, "CreateWindowA failed, error %d.\n", GetLastError());
return FALSE;
case WM_CLOSE:
DestroyWindow(child);
return TRUE;
default:
return FALSE;
}
}
static void test_WM_CTLCOLORSTATIC(void)
{
HWND parent, dialog, child;
COLORREF color, old_color;
HDC child_hdc, dialog_hdc;
int mode, old_mode;
HBRUSH brush;
HRESULT hr;
POINT org;
BOOL ret;
struct
{
DLGTEMPLATE tmplate;
WORD menu;
WORD class;
WORD title;
} temp = {{0}};
parent = CreateWindowA(WC_STATICA, "parent", WS_POPUP | WS_VISIBLE, 100, 100, 200, 200, 0, 0, 0,
NULL);
ok(parent != NULL, "CreateWindowA failed, error %d.\n", GetLastError());
temp.tmplate.style = WS_CHILD | WS_VISIBLE;
temp.tmplate.cx = 80;
temp.tmplate.cy = 80;
dialog = CreateDialogIndirectParamA(NULL, &temp.tmplate, parent, test_WM_CTLCOLORSTATIC_proc, 0);
ok(dialog != NULL, "CreateDialogIndirectParamA failed, error %d.\n", GetLastError());
child = GetDlgItem(dialog, 100);
ok(child != NULL, "Failed to get child static control, error %d.\n", GetLastError());
dialog_hdc = GetDC(dialog);
child_hdc = GetDC(child);
PatBlt(dialog_hdc, 0, 0, 80, 80, BLACKNESS);
old_mode = SetBkMode(child_hdc, OPAQUE);
ok(old_mode != 0, "SetBkMode failed.\n");
old_color = SetBkColor(child_hdc, 0xaa5511);
ok(old_color != CLR_INVALID, "SetBkColor failed.\n");
ret = pIsThemeDialogTextureEnabled(dialog);
ok(ret, "Expected theme dialog texture supported.\n");
ok(pGetWindowTheme(dialog) == NULL, "Expected NULL theme handle.\n");
brush = (HBRUSH)SendMessageW(dialog, WM_CTLCOLORSTATIC, (WPARAM)child_hdc, (LPARAM)child);
ok(brush == GetSysColorBrush(COLOR_BTNFACE), "Expected brush %p, got %p.\n",
GetSysColorBrush(COLOR_BTNFACE), brush);
color = SetBkColor(child_hdc, old_color);
ok(color == GetSysColor(COLOR_BTNFACE), "Expected background color %#x, got %#x.\n",
GetSysColor(COLOR_BTNFACE), color);
mode = SetBkMode(child_hdc, old_mode);
ok(mode == OPAQUE, "Expected mode %#x, got %#x.\n", OPAQUE, mode);
color = GetPixel(dialog_hdc, 40, 40);
ok(color == 0, "Expected pixel %#x, got %#x.\n", 0, color);
/* Test that EnableThemeDialogTexture() doesn't make WM_CTLCOLORSTATIC return a different brush */
hr = pEnableThemeDialogTexture(dialog, ETDT_DISABLE);
ok(hr == S_OK, "EnableThemeDialogTexture failed, hr %#x.\n", hr);
ret = pIsThemeDialogTextureEnabled(dialog);
ok(!ret, "Expected theme dialog texture disabled.\n");
hr = pEnableThemeDialogTexture(dialog, ETDT_ENABLETAB);
ok(hr == S_OK, "EnableThemeDialogTexture failed, hr %#x.\n", hr);
ret = pIsThemeDialogTextureEnabled(dialog);
ok(ret, "Expected theme dialog texture enabled.\n");
brush = (HBRUSH)SendMessageW(dialog, WM_CTLCOLORSTATIC, (WPARAM)child_hdc, (LPARAM)child);
ok(brush == GetSysColorBrush(COLOR_BTNFACE), "Expected brush %p, got %p.\n",
GetSysColorBrush(COLOR_BTNFACE), brush);
/* Test that WM_CTLCOLORSTATIC doesn't change brush origin */
ret = GetBrushOrgEx(child_hdc, &org);
ok(ret, "GetBrushOrgEx failed, error %u.\n", GetLastError());
ok(org.x == 0 && org.y == 0, "Expected (0,0), got %s.\n", wine_dbgstr_point(&org));
ReleaseDC(child, child_hdc);
ReleaseDC(dialog, dialog_hdc);
EndDialog(dialog, 0);
DestroyWindow(parent);
}
static void init_functions(void)
{
HMODULE uxtheme = LoadLibraryA("uxtheme.dll");
#define X(f) p##f = (void *)GetProcAddress(uxtheme, #f);
X(EnableThemeDialogTexture)
X(GetWindowTheme)
X(IsThemeDialogTextureEnabled)
#undef X
}
START_TEST(static)
{
static const char classname[] = "testclass";
@ -504,8 +387,6 @@ START_TEST(static)
if (!load_v6_module(&ctx_cookie, &hCtx))
return;
init_functions();
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
@ -536,7 +417,6 @@ START_TEST(static)
test_set_text();
test_set_image();
test_STM_SETIMAGE();
test_WM_CTLCOLORSTATIC();
DestroyWindow(hMainWnd);