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
28f26c97
Commit
28f26c97
authored
Apr 13, 2012
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Apr 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/tests: Add tests for long info tip texts.
parent
1a5851f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
124 additions
and
0 deletions
+124
-0
tooltips.c
dlls/comctl32/tests/tooltips.c
+124
-0
No files found.
dlls/comctl32/tests/tooltips.c
View file @
28f26c97
...
...
@@ -636,6 +636,128 @@ static void test_ttm_gettoolinfo(void)
DestroyWindow
(
hwnd
);
}
static
void
test_longtextA
(
void
)
{
static
const
char
longtextA
[]
=
"According to MSDN, TTM_ENUMTOOLS claims that TOOLINFO's lpszText is maximum "
"80 chars including null. In fact, the buffer is not null-terminated."
;
HWND
hwnd
;
TTTOOLINFOA
toolinfoA
=
{
0
};
CHAR
bufA
[
256
];
LRESULT
r
;
hwnd
=
CreateWindowExA
(
0
,
TOOLTIPS_CLASSA
,
NULL
,
0
,
10
,
10
,
300
,
100
,
NULL
,
NULL
,
NULL
,
0
);
toolinfoA
.
cbSize
=
sizeof
(
TTTOOLINFOA
);
toolinfoA
.
hwnd
=
NULL
;
toolinfoA
.
hinst
=
GetModuleHandleA
(
NULL
);
toolinfoA
.
uFlags
=
0
;
toolinfoA
.
uId
=
0x1234ABCD
;
strcpy
(
bufA
,
longtextA
);
toolinfoA
.
lpszText
=
bufA
;
toolinfoA
.
lParam
=
0xdeadbeef
;
GetClientRect
(
hwnd
,
&
toolinfoA
.
rect
);
r
=
SendMessageA
(
hwnd
,
TTM_ADDTOOLA
,
0
,
(
LPARAM
)
&
toolinfoA
);
if
(
r
)
{
int
textlen
;
memset
(
bufA
,
0
,
sizeof
(
bufA
));
toolinfoA
.
hwnd
=
NULL
;
toolinfoA
.
uId
=
0xABCD1234
;
toolinfoA
.
lpszText
=
bufA
;
SendMessageA
(
hwnd
,
TTM_ENUMTOOLSA
,
0
,
(
LPARAM
)
&
toolinfoA
);
textlen
=
lstrlenA
(
toolinfoA
.
lpszText
);
todo_wine
ok
(
textlen
==
80
,
"lpszText has %d chars
\n
"
,
textlen
);
ok
(
toolinfoA
.
uId
==
0x1234ABCD
,
"uId should be retrieved, got %p
\n
"
,
(
void
*
)
toolinfoA
.
uId
);
memset
(
bufA
,
0
,
sizeof
(
bufA
));
toolinfoA
.
hwnd
=
NULL
;
toolinfoA
.
uId
=
0x1234ABCD
;
toolinfoA
.
lpszText
=
bufA
;
SendMessageA
(
hwnd
,
TTM_GETTOOLINFOA
,
0
,
(
LPARAM
)
&
toolinfoA
);
textlen
=
lstrlenA
(
toolinfoA
.
lpszText
);
todo_wine
ok
(
textlen
==
80
,
"lpszText has %d chars
\n
"
,
textlen
);
memset
(
bufA
,
0
,
sizeof
(
bufA
));
toolinfoA
.
hwnd
=
NULL
;
toolinfoA
.
uId
=
0x1234ABCD
;
toolinfoA
.
lpszText
=
bufA
;
SendMessageA
(
hwnd
,
TTM_GETTEXTA
,
0
,
(
LPARAM
)
&
toolinfoA
);
textlen
=
lstrlenA
(
toolinfoA
.
lpszText
);
todo_wine
ok
(
textlen
==
80
,
"lpszText has %d chars
\n
"
,
textlen
);
}
DestroyWindow
(
hwnd
);
}
static
void
test_longtextW
(
void
)
{
static
const
char
longtextA
[]
=
"According to MSDN, TTM_ENUMTOOLS claims that TOOLINFO's lpszText is maximum "
"80 chars including null. Actually, this is not applied for wide version."
;
HWND
hwnd
;
TTTOOLINFOW
toolinfoW
=
{
0
};
WCHAR
bufW
[
256
];
LRESULT
r
;
int
lenW
;
hwnd
=
CreateWindowExW
(
0
,
TOOLTIPS_CLASSW
,
NULL
,
0
,
10
,
10
,
300
,
100
,
NULL
,
NULL
,
NULL
,
0
);
if
(
!
hwnd
)
{
win_skip
(
"CreateWindowExW() not supported. Skipping.
\n
"
);
return
;
}
toolinfoW
.
cbSize
=
TTTOOLINFOW_V2_SIZE
;
toolinfoW
.
hwnd
=
NULL
;
toolinfoW
.
hinst
=
GetModuleHandleW
(
NULL
);
toolinfoW
.
uFlags
=
0
;
toolinfoW
.
uId
=
0x1234ABCD
;
MultiByteToWideChar
(
CP_ACP
,
0
,
longtextA
,
-
1
,
bufW
,
sizeof
(
bufW
)
/
sizeof
(
bufW
[
0
]));
lenW
=
lstrlenW
(
bufW
);
toolinfoW
.
lpszText
=
bufW
;
toolinfoW
.
lParam
=
0xdeadbeef
;
GetClientRect
(
hwnd
,
&
toolinfoW
.
rect
);
r
=
SendMessageW
(
hwnd
,
TTM_ADDTOOLW
,
0
,
(
LPARAM
)
&
toolinfoW
);
if
(
r
)
{
int
textlen
;
memset
(
bufW
,
0
,
sizeof
(
bufW
));
toolinfoW
.
hwnd
=
NULL
;
toolinfoW
.
uId
=
0xABCD1234
;
toolinfoW
.
lpszText
=
bufW
;
SendMessageW
(
hwnd
,
TTM_ENUMTOOLSW
,
0
,
(
LPARAM
)
&
toolinfoW
);
textlen
=
lstrlenW
(
toolinfoW
.
lpszText
);
ok
(
textlen
==
lenW
,
"lpszText has %d chars
\n
"
,
textlen
);
ok
(
toolinfoW
.
uId
==
0x1234ABCD
,
"uId should be retrieved, got %p
\n
"
,
(
void
*
)
toolinfoW
.
uId
);
memset
(
bufW
,
0
,
sizeof
(
bufW
));
toolinfoW
.
hwnd
=
NULL
;
toolinfoW
.
uId
=
0x1234ABCD
;
toolinfoW
.
lpszText
=
bufW
;
SendMessageW
(
hwnd
,
TTM_GETTOOLINFOW
,
0
,
(
LPARAM
)
&
toolinfoW
);
textlen
=
lstrlenW
(
toolinfoW
.
lpszText
);
ok
(
textlen
==
lenW
,
"lpszText has %d chars
\n
"
,
textlen
);
memset
(
bufW
,
0
,
sizeof
(
bufW
));
toolinfoW
.
hwnd
=
NULL
;
toolinfoW
.
uId
=
0x1234ABCD
;
toolinfoW
.
lpszText
=
bufW
;
SendMessageW
(
hwnd
,
TTM_GETTEXTW
,
0
,
(
LPARAM
)
&
toolinfoW
);
textlen
=
lstrlenW
(
toolinfoW
.
lpszText
);
ok
(
textlen
==
lenW
||
broken
(
textlen
==
0
&&
toolinfoW
.
lpszText
==
NULL
),
/* nt4, kb186177 */
"lpszText has %d chars
\n
"
,
textlen
);
}
DestroyWindow
(
hwnd
);
}
START_TEST
(
tooltips
)
{
InitCommonControls
();
...
...
@@ -644,4 +766,6 @@ START_TEST(tooltips)
test_customdraw
();
test_gettext
();
test_ttm_gettoolinfo
();
test_longtextA
();
test_longtextW
();
}
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