Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
e17aedb2
Commit
e17aedb2
authored
Nov 04, 2021
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Nov 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/tests: Test WM_CTLCOLORSTATIC for static controls in a themed dialog.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
854895f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
0 deletions
+92
-0
static.c
dlls/comctl32/tests/static.c
+92
-0
No files found.
dlls/comctl32/tests/static.c
View file @
e17aedb2
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "winuser.h"
#include "winuser.h"
#include "commctrl.h"
#include "commctrl.h"
#include "resources.h"
#include "resources.h"
#include "uxtheme.h"
#include "wine/test.h"
#include "wine/test.h"
...
@@ -377,6 +378,96 @@ static void test_STM_SETIMAGE(void)
...
@@ -377,6 +378,96 @@ static void test_STM_SETIMAGE(void)
DeleteEnhMetaFile
(
emf
);
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
,
0
,
0
,
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
)
{
HTHEME
(
WINAPI
*
pGetWindowTheme
)(
HTHEME
)
=
NULL
;
HWND
parent
,
dialog
,
child
;
COLORREF
color
,
old_color
;
HDC
child_hdc
,
dialog_hdc
;
int
mode
,
old_mode
;
BOOL
todo
=
FALSE
;
HMODULE
uxtheme
;
HBRUSH
brush
;
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
());
uxtheme
=
LoadLibraryA
(
"uxtheme.dll"
);
if
(
uxtheme
)
{
pGetWindowTheme
=
(
void
*
)
GetProcAddress
(
uxtheme
,
"GetWindowTheme"
);
if
(
pGetWindowTheme
)
todo
=
!!
pGetWindowTheme
(
dialog
);
}
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
"
);
brush
=
(
HBRUSH
)
SendMessageW
(
dialog
,
WM_CTLCOLORSTATIC
,
(
WPARAM
)
child_hdc
,
(
LPARAM
)
child
);
todo_wine_if
(
todo
)
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
);
todo_wine_if
(
todo
)
ok
(
mode
==
OPAQUE
,
"Expected mode %#x, got %#x.
\n
"
,
OPAQUE
,
mode
);
color
=
GetPixel
(
dialog_hdc
,
40
,
40
);
todo_wine_if
(
todo
)
ok
(
color
==
0
,
"Expected pixel %#x, got %#x.
\n
"
,
0
,
color
);
ReleaseDC
(
child
,
child_hdc
);
ReleaseDC
(
dialog
,
dialog_hdc
);
EndDialog
(
dialog
,
0
);
DestroyWindow
(
parent
);
FreeLibrary
(
uxtheme
);
}
START_TEST
(
static
)
START_TEST
(
static
)
{
{
static
const
char
classname
[]
=
"testclass"
;
static
const
char
classname
[]
=
"testclass"
;
...
@@ -417,6 +508,7 @@ START_TEST(static)
...
@@ -417,6 +508,7 @@ START_TEST(static)
test_set_text
();
test_set_text
();
test_set_image
();
test_set_image
();
test_STM_SETIMAGE
();
test_STM_SETIMAGE
();
test_WM_CTLCOLORSTATIC
();
DestroyWindow
(
hMainWnd
);
DestroyWindow
(
hMainWnd
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment