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
87418f0a
Commit
87418f0a
authored
Jul 02, 2009
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jul 02, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Add a test for BM_SETSTYLE, make it pass under Wine.
parent
84fd1c84
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
17 deletions
+83
-17
button.c
dlls/user32/button.c
+12
-2
msg.c
dlls/user32/tests/msg.c
+71
-15
No files found.
dlls/user32/button.c
View file @
87418f0a
...
...
@@ -75,6 +75,7 @@
#include "wingdi.h"
#include "wine/winuser16.h"
#include "controls.h"
#include "win.h"
#include "user_private.h"
#include "wine/debug.h"
...
...
@@ -271,6 +272,13 @@ static LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg,
}
if
(
btn_type
>=
MAX_BTN_TYPE
)
return
-
1
;
/* abort */
/* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */
if
(
btn_type
==
BS_USERBUTTON
)
{
style
=
(
style
&
~
0x0f
)
|
BS_PUSHBUTTON
;
WIN_SetStyle
(
hWnd
,
style
,
0x0f
&
~
style
);
}
set_button_state
(
hWnd
,
BUTTON_UNCHECKED
);
return
0
;
...
...
@@ -458,11 +466,11 @@ static LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg,
if
((
wParam
&
0x0f
)
>=
MAX_BTN_TYPE
)
break
;
btn_type
=
wParam
&
0x0f
;
style
=
(
style
&
~
0x0f
)
|
btn_type
;
SetWindowLongW
(
hWnd
,
GWL_STYLE
,
style
);
WIN_SetStyle
(
hWnd
,
style
,
0x0f
&
~
style
);
/* Only redraw if lParam flag is set.*/
if
(
lParam
)
paint_button
(
hWnd
,
btn_type
,
ODA_DRAWENTIR
E
);
InvalidateRect
(
hWnd
,
NULL
,
TRU
E
);
break
;
...
...
@@ -1105,6 +1113,8 @@ static void UB_Paint( HWND hwnd, HDC hDC, UINT action )
if
((
action
==
ODA_FOCUS
)
||
((
action
==
ODA_DRAWENTIRE
)
&&
(
state
&
BUTTON_HASFOCUS
)))
DrawFocusRect
(
hDC
,
&
rc
);
BUTTON_NOTIFY_PARENT
(
hwnd
,
BN_PAINT
);
}
...
...
dlls/user32/tests/msg.c
View file @
87418f0a
...
...
@@ -5209,6 +5209,49 @@ static const struct message WmSetFontButtonSeq[] =
{
WM_CTLCOLORBTN
,
sent
|
defwinproc
},
{
0
}
};
static
const
struct
message
WmSetStyleButtonSeq
[]
=
{
{
BM_SETSTYLE
,
sent
},
{
WM_APP
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
WM_PAINT
,
sent
},
{
WM_NCPAINT
,
sent
|
defwinproc
|
optional
},
/* FIXME: Wine sends it */
{
WM_ERASEBKGND
,
sent
|
defwinproc
},
{
WM_CTLCOLORBTN
,
sent
|
parent
},
{
0
}
};
static
const
struct
message
WmSetStyleStaticSeq
[]
=
{
{
BM_SETSTYLE
,
sent
},
{
WM_APP
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
WM_PAINT
,
sent
},
{
WM_NCPAINT
,
sent
|
defwinproc
|
optional
},
/* FIXME: Wine sends it */
{
WM_ERASEBKGND
,
sent
|
defwinproc
},
{
WM_CTLCOLORSTATIC
,
sent
|
parent
},
{
0
}
};
static
const
struct
message
WmSetStyleUserSeq
[]
=
{
{
BM_SETSTYLE
,
sent
},
{
WM_APP
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
WM_PAINT
,
sent
},
{
WM_NCPAINT
,
sent
|
defwinproc
|
optional
},
/* FIXME: Wine sends it */
{
WM_ERASEBKGND
,
sent
|
defwinproc
},
{
WM_CTLCOLORBTN
,
sent
|
parent
},
{
WM_COMMAND
,
sent
|
wparam
|
parent
,
MAKEWPARAM
(
ID_BUTTON
,
BN_PAINT
)
},
{
0
}
};
static
const
struct
message
WmSetStyleOwnerdrawSeq
[]
=
{
{
BM_SETSTYLE
,
sent
},
{
WM_APP
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
WM_PAINT
,
sent
},
{
WM_NCPAINT
,
sent
|
optional
},
/* FIXME: Wine sends it */
{
WM_ERASEBKGND
,
sent
|
defwinproc
},
{
WM_CTLCOLORBTN
,
sent
|
parent
},
{
WM_CTLCOLORBTN
,
sent
|
parent
},
{
WM_DRAWITEM
,
sent
|
wparam
|
lparam
|
parent
,
ID_BUTTON
,
0x000010e4
},
{
0
}
};
static
WNDPROC
old_button_proc
;
...
...
@@ -5268,29 +5311,30 @@ static void test_button_messages(void)
DWORD
dlg_code
;
const
struct
message
*
setfocus
;
const
struct
message
*
killfocus
;
const
struct
message
*
setstyle
;
}
button
[]
=
{
{
BS_PUSHBUTTON
,
DLGC_BUTTON
|
DLGC_UNDEFPUSHBUTTON
,
WmSetFocusButtonSeq
,
WmKillFocusButtonSeq
},
WmSetFocusButtonSeq
,
WmKillFocusButtonSeq
,
WmSetStyleButtonSeq
},
{
BS_DEFPUSHBUTTON
,
DLGC_BUTTON
|
DLGC_DEFPUSHBUTTON
,
WmSetFocusButtonSeq
,
WmKillFocusButtonSeq
},
WmSetFocusButtonSeq
,
WmKillFocusButtonSeq
,
WmSetStyleButtonSeq
},
{
BS_CHECKBOX
,
DLGC_BUTTON
,
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
},
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
,
WmSetStyleStaticSeq
},
{
BS_AUTOCHECKBOX
,
DLGC_BUTTON
,
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
},
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
,
WmSetStyleStaticSeq
},
{
BS_RADIOBUTTON
,
DLGC_BUTTON
|
DLGC_RADIOBUTTON
,
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
},
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
,
WmSetStyleStaticSeq
},
{
BS_3STATE
,
DLGC_BUTTON
,
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
},
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
,
WmSetStyleStaticSeq
},
{
BS_AUTO3STATE
,
DLGC_BUTTON
,
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
},
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
,
WmSetStyleStaticSeq
},
{
BS_GROUPBOX
,
DLGC_STATIC
,
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
},
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
,
WmSetStyleStaticSeq
},
{
BS_USERBUTTON
,
DLGC_BUTTON
|
DLGC_UNDEFPUSHBUTTON
,
WmSetFocusButtonSeq
,
WmKillFocusButtonSeq
},
WmSetFocusButtonSeq
,
WmKillFocusButtonSeq
,
WmSetStyleUserSeq
},
{
BS_AUTORADIOBUTTON
,
DLGC_BUTTON
|
DLGC_RADIOBUTTON
,
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
},
WmSetFocusStaticSeq
,
WmKillFocusStaticSeq
,
WmSetStyleStaticSeq
},
{
BS_OWNERDRAW
,
DLGC_BUTTON
,
WmSetFocusOwnerdrawSeq
,
WmKillFocusOwnerdrawSeq
}
WmSetFocusOwnerdrawSeq
,
WmKillFocusOwnerdrawSeq
,
WmSetStyleOwnerdrawSeq
}
};
unsigned
int
i
;
HWND
hwnd
,
parent
;
...
...
@@ -5319,6 +5363,8 @@ static void test_button_messages(void)
MSG
msg
;
DWORD
style
;
trace
(
"button style %08x
\n
"
,
button
[
i
].
style
);
hwnd
=
CreateWindowExA
(
0
,
"my_button_class"
,
"test"
,
button
[
i
].
style
|
WS_CHILD
|
BS_NOTIFY
,
0
,
0
,
50
,
14
,
parent
,
(
HMENU
)
ID_BUTTON
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"Failed to create button window
\n
"
);
...
...
@@ -5327,9 +5373,9 @@ static void test_button_messages(void)
style
&=
~
(
WS_CHILD
|
BS_NOTIFY
);
/* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */
if
(
button
[
i
].
style
==
BS_USERBUTTON
)
todo_wine
ok
(
style
==
BS_PUSHBUTTON
,
"expected style BS_PUSHBUTTON got %x
\n
"
,
style
);
ok
(
style
==
BS_PUSHBUTTON
,
"expected style BS_PUSHBUTTON got %x
\n
"
,
style
);
else
ok
(
style
==
button
[
i
].
style
,
"expected style %x got %x
\n
"
,
button
[
i
].
style
,
style
);
ok
(
style
==
button
[
i
].
style
,
"expected style %x got %x
\n
"
,
button
[
i
].
style
,
style
);
dlg_code
=
SendMessageA
(
hwnd
,
WM_GETDLGCODE
,
0
,
0
);
ok
(
dlg_code
==
button
[
i
].
dlg_code
,
"%u: wrong dlg_code %08x
\n
"
,
i
,
dlg_code
);
...
...
@@ -5342,7 +5388,6 @@ static void test_button_messages(void)
log_all_parent_messages
++
;
trace
(
"button style %08x
\n
"
,
button
[
i
].
style
);
ok
(
GetFocus
()
==
0
,
"expected focus 0, got %p
\n
"
,
GetFocus
());
SetFocus
(
hwnd
);
SendMessage
(
hwnd
,
WM_APP
,
0
,
0
);
/* place a separator mark here */
...
...
@@ -5354,9 +5399,20 @@ static void test_button_messages(void)
while
(
PeekMessage
(
&
msg
,
0
,
0
,
0
,
PM_REMOVE
))
DispatchMessage
(
&
msg
);
ok_sequence
(
button
[
i
].
killfocus
,
"SetFocus(0) on a button"
,
FALSE
);
ok
(
GetFocus
()
==
0
,
"expected focus 0, got %p
\n
"
,
GetFocus
());
SendMessage
(
hwnd
,
BM_SETSTYLE
,
button
[
i
].
style
|
BS_BOTTOM
,
TRUE
);
SendMessage
(
hwnd
,
WM_APP
,
0
,
0
);
/* place a separator mark here */
while
(
PeekMessage
(
&
msg
,
0
,
0
,
0
,
PM_REMOVE
))
DispatchMessage
(
&
msg
);
ok_sequence
(
button
[
i
].
setstyle
,
"BM_SETSTYLE on a button"
,
FALSE
);
style
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
style
&=
~
(
WS_VISIBLE
|
WS_CHILD
|
BS_NOTIFY
);
/* XP doesn't turn a BS_USERBUTTON into BS_PUSHBUTTON here! */
ok
(
style
==
button
[
i
].
style
,
"expected style %x got %x
\n
"
,
button
[
i
].
style
,
style
);
log_all_parent_messages
--
;
ok
(
GetFocus
()
==
0
,
"expected focus 0, got %p
\n
"
,
GetFocus
());
DestroyWindow
(
hwnd
);
}
...
...
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