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
1c1b1c00
Commit
1c1b1c00
authored
Feb 01, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 01, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: More tests for Toolbar window style handling.
parent
53bd6273
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
148 additions
and
1 deletion
+148
-1
toolbar.c
dlls/comctl32/tests/toolbar.c
+147
-0
toolbar.c
dlls/comctl32/toolbar.c
+1
-1
No files found.
dlls/comctl32/tests/toolbar.c
View file @
1c1b1c00
...
...
@@ -54,6 +54,24 @@ static const struct message ttgetdispinfo_parent_seq[] = {
{
0
}
};
#define DEFINE_EXPECT(func) \
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
#define CHECK_EXPECT2(func) \
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
#define CHECK_CALLED(func) \
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
#define SET_EXPECT(func) \
expect_ ## func = TRUE
#define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
#define check_rect(name, val, exp, ...) ok(val.top == exp.top && val.bottom == exp.bottom && \
...
...
@@ -1610,6 +1628,7 @@ static void test_tooltip(void)
{
0
,
21
,
TBSTATE_ENABLED
,
0
,
{
0
,
},
0
,
-
1
},
};
NMTTDISPINFOW
nmtti
;
HWND
tooltip
;
rebuild_toolbar
(
&
hToolbar
);
...
...
@@ -1632,6 +1651,13 @@ static void test_tooltip(void)
g_ResetDispTextPtr
=
FALSE
;
DestroyWindow
(
hToolbar
);
/* TBSTYLE_TOOLTIPS */
hToolbar
=
CreateWindowExA
(
0
,
TOOLBARCLASSNAME
,
NULL
,
WS_CHILD
|
WS_VISIBLE
,
0
,
0
,
0
,
0
,
hMainWnd
,
(
HMENU
)
5
,
GetModuleHandle
(
NULL
),
NULL
);
tooltip
=
(
HWND
)
SendMessageA
(
hToolbar
,
TB_GETTOOLTIPS
,
0
,
0
);
ok
(
tooltip
==
NULL
,
"got %p
\n
"
,
tooltip
);
DestroyWindow
(
hToolbar
);
}
static
void
test_get_set_style
(
void
)
...
...
@@ -1658,6 +1684,7 @@ static void test_get_set_style(void)
style
=
SendMessageA
(
hToolbar
,
TB_GETSTYLE
,
0
,
0
);
style2
=
GetWindowLongA
(
hToolbar
,
GWL_STYLE
);
todo_wine
ok
(
style
==
style2
,
"got 0x%08x, expected 0x%08x
\n
"
,
style
,
style2
);
/* try to alter common window bits */
...
...
@@ -1681,6 +1708,125 @@ static void test_get_set_style(void)
DestroyWindow
(
hToolbar
);
}
static
HHOOK
g_tbhook
;
static
HWND
g_toolbar
;
DEFINE_EXPECT
(
g_hook_create
);
DEFINE_EXPECT
(
g_hook_WM_NCCREATE
);
DEFINE_EXPECT
(
g_hook_WM_CREATE
);
static
LRESULT
WINAPI
toolbar_subclass_proc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
WNDPROC
oldproc
=
(
WNDPROC
)
GetWindowLongPtrA
(
hwnd
,
GWLP_USERDATA
);
LRESULT
ret
;
DWORD
style
;
if
(
msg
==
WM_NCCREATE
)
{
if
(
g_toolbar
==
hwnd
)
{
CHECK_EXPECT2
(
g_hook_WM_NCCREATE
);
g_toolbar
=
hwnd
;
ret
=
CallWindowProcA
(
oldproc
,
hwnd
,
msg
,
wParam
,
lParam
);
/* control is already set up */
style
=
SendMessageA
(
hwnd
,
TB_GETSTYLE
,
0
,
0
);
ok
(
style
!=
0
,
"got %x
\n
"
,
style
);
style
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
ok
((
style
&
TBSTYLE_TOOLTIPS
)
==
0
,
"got 0x%08x
\n
"
,
style
);
SetWindowLongA
(
hwnd
,
GWL_STYLE
,
style
|
TBSTYLE_TOOLTIPS
);
style
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
ok
((
style
&
TBSTYLE_TOOLTIPS
)
==
TBSTYLE_TOOLTIPS
,
"got 0x%08x
\n
"
,
style
);
return
ret
;
}
}
else
if
(
msg
==
WM_CREATE
)
{
CREATESTRUCTA
*
cs
=
(
CREATESTRUCTA
*
)
lParam
;
if
(
g_toolbar
==
hwnd
)
{
CHECK_EXPECT2
(
g_hook_WM_CREATE
);
style
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
ok
((
style
&
TBSTYLE_TOOLTIPS
)
==
TBSTYLE_TOOLTIPS
,
"got 0x%08x
\n
"
,
style
);
/* test if toolbar-specific messages are already working before WM_CREATE */
style
=
SendMessageA
(
hwnd
,
TB_GETSTYLE
,
0
,
0
);
ok
(
style
!=
0
,
"got %x
\n
"
,
style
);
ok
((
style
&
TBSTYLE_TOOLTIPS
)
==
TBSTYLE_TOOLTIPS
,
"got 0x%x
\n
"
,
style
);
ok
((
cs
->
style
&
TBSTYLE_TOOLTIPS
)
==
0
,
"0x%08x
\n
"
,
cs
->
style
);
ret
=
CallWindowProcA
(
oldproc
,
hwnd
,
msg
,
wParam
,
lParam
);
style
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
ok
((
style
&
TBSTYLE_TOOLTIPS
)
==
TBSTYLE_TOOLTIPS
,
"got 0x%08x
\n
"
,
style
);
/* test if toolbar-specific messages are already working before WM_CREATE */
style
=
SendMessageA
(
hwnd
,
TB_GETSTYLE
,
0
,
0
);
ok
(
style
!=
0
,
"got %x
\n
"
,
style
);
ok
((
style
&
TBSTYLE_TOOLTIPS
)
==
TBSTYLE_TOOLTIPS
,
"got 0x%x
\n
"
,
style
);
return
ret
;
}
}
return
CallWindowProcA
(
oldproc
,
hwnd
,
msg
,
wParam
,
lParam
);
}
LRESULT
CALLBACK
cbt_hook_proc
(
int
code
,
WPARAM
wParam
,
LPARAM
lParam
)
{
if
(
code
==
HCBT_CREATEWND
)
{
HWND
hwnd
=
(
HWND
)
wParam
;
if
(
!
g_toolbar
)
{
WNDPROC
oldproc
;
CHECK_EXPECT2
(
g_hook_create
);
g_toolbar
=
hwnd
;
/* subclass */
oldproc
=
(
WNDPROC
)
SetWindowLongPtrA
(
hwnd
,
GWLP_WNDPROC
,
(
LONG_PTR
)
toolbar_subclass_proc
);
SetWindowLongPtrA
(
hwnd
,
GWLP_USERDATA
,
(
LONG_PTR
)
oldproc
);
}
return
0
;
}
return
CallNextHookEx
(
g_tbhook
,
code
,
wParam
,
lParam
);
}
static
void
test_create
(
void
)
{
HWND
hwnd
,
tooltip
;
DWORD
style
;
g_tbhook
=
SetWindowsHookA
(
WH_CBT
,
cbt_hook_proc
);
SET_EXPECT
(
g_hook_create
);
SET_EXPECT
(
g_hook_WM_NCCREATE
);
SET_EXPECT
(
g_hook_WM_CREATE
);
hwnd
=
CreateWindowExA
(
0
,
TOOLBARCLASSNAME
,
NULL
,
WS_CHILD
|
WS_VISIBLE
,
0
,
0
,
0
,
0
,
hMainWnd
,
(
HMENU
)
5
,
GetModuleHandle
(
NULL
),
NULL
);
CHECK_CALLED
(
g_hook_create
);
CHECK_CALLED
(
g_hook_WM_NCCREATE
);
CHECK_CALLED
(
g_hook_WM_CREATE
);
style
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
ok
((
style
&
TBSTYLE_TOOLTIPS
)
==
TBSTYLE_TOOLTIPS
,
"got 0x%08x
\n
"
,
style
);
tooltip
=
(
HWND
)
SendMessageA
(
hwnd
,
TB_GETTOOLTIPS
,
0
,
0
);
ok
(
tooltip
!=
NULL
,
"got %p
\n
"
,
tooltip
);
ok
(
GetParent
(
tooltip
)
==
hMainWnd
,
"got %p, %p
\n
"
,
hMainWnd
,
hwnd
);
DestroyWindow
(
hwnd
);
UnhookWindowsHook
(
WH_CBT
,
cbt_hook_proc
);
}
START_TEST
(
toolbar
)
{
WNDCLASSA
wc
;
...
...
@@ -1721,6 +1867,7 @@ START_TEST(toolbar)
test_getstring
();
test_tooltip
();
test_get_set_style
();
test_create
();
PostQuitMessage
(
0
);
while
(
GetMessageA
(
&
msg
,
0
,
0
,
0
))
{
...
...
dlls/comctl32/toolbar.c
View file @
1c1b1c00
...
...
@@ -5155,7 +5155,7 @@ TOOLBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
TRACE
(
"hwnd = %p, style=0x%08x
\n
"
,
hwnd
,
lpcs
->
style
);
infoPtr
->
dwStyle
=
lpcs
->
style
;
infoPtr
->
dwStyle
=
GetWindowLongW
(
hwnd
,
GWL_STYLE
)
;
GetClientRect
(
hwnd
,
&
infoPtr
->
client_rect
);
infoPtr
->
bUnicode
=
infoPtr
->
hwndNotify
&&
(
NFR_UNICODE
==
SendMessageW
(
hwnd
,
WM_NOTIFYFORMAT
,
(
WPARAM
)
hwnd
,
NF_REQUERY
));
...
...
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