Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
abfda01f
Commit
abfda01f
authored
Mar 15, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Mar 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Enable compilation with long types.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
30d19d95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
36 deletions
+37
-36
text.c
dlls/user32/tests/text.c
+37
-36
No files found.
dlls/user32/tests/text.c
View file @
abfda01f
...
...
@@ -18,6 +18,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#undef WINE_NO_LONG_TYPES
/* temporary for migration */
#include <assert.h>
...
...
@@ -55,9 +56,9 @@ static void test_DrawTextCalcRect(void)
/* Initialization */
hwnd
=
CreateWindowExA
(
0
,
"static"
,
NULL
,
WS_POPUP
,
0
,
0
,
200
,
200
,
0
,
0
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"CreateWindowExA error %u
\n
"
,
GetLastError
());
ok
(
hwnd
!=
0
,
"CreateWindowExA error %
l
u
\n
"
,
GetLastError
());
hdc
=
GetDC
(
hwnd
);
ok
(
hdc
!=
0
,
"GetDC error %u
\n
"
,
GetLastError
());
ok
(
hdc
!=
0
,
"GetDC error %
l
u
\n
"
,
GetLastError
());
trace
(
"hdc %p
\n
"
,
hdc
);
textlen
=
lstrlenA
(
text
);
...
...
@@ -74,23 +75,23 @@ static void test_DrawTextCalcRect(void)
SetMapMode
(
hdc
,
MM_HIENGLISH
);
lf
.
lfHeight
=
100
*
9
/
72
;
/* 9 point */
hFont
=
CreateFontIndirectA
(
&
lf
);
ok
(
hFont
!=
0
,
"CreateFontIndirectA error %u
\n
"
,
ok
(
hFont
!=
0
,
"CreateFontIndirectA error %
l
u
\n
"
,
GetLastError
());
hOldFont
=
SelectObject
(
hdc
,
hFont
);
textheight
=
DrawTextA
(
hdc
,
text
,
textlen
,
&
rect
,
DT_CALCRECT
|
DT_EXTERNALLEADING
|
DT_WORDBREAK
|
DT_NOCLIP
|
DT_LEFT
|
DT_NOPREFIX
);
ok
(
textheight
,
"DrawTextA error %u
\n
"
,
GetLastError
());
ok
(
textheight
,
"DrawTextA error %
l
u
\n
"
,
GetLastError
());
trace
(
"MM_HIENGLISH rect.bottom %d
\n
"
,
rect
.
bottom
);
trace
(
"MM_HIENGLISH rect.bottom %
l
d
\n
"
,
rect
.
bottom
);
ok
(
rect
.
bottom
<
0
,
"In MM_HIENGLISH, DrawText with "
"DT_CALCRECT should return a negative rectangle bottom. "
"(bot=%d)
\n
"
,
rect
.
bottom
);
"(bot=%
l
d)
\n
"
,
rect
.
bottom
);
SelectObject
(
hdc
,
hOldFont
);
ret
=
DeleteObject
(
hFont
);
ok
(
ret
,
"DeleteObject error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"DeleteObject error %
l
u
\n
"
,
GetLastError
());
/* DrawText in MM_TEXT with DT_CALCRECT */
...
...
@@ -98,18 +99,18 @@ static void test_DrawTextCalcRect(void)
lf
.
lfHeight
=
-
MulDiv
(
9
,
GetDeviceCaps
(
hdc
,
LOGPIXELSY
),
72
);
/* 9 point */
hFont
=
CreateFontIndirectA
(
&
lf
);
ok
(
hFont
!=
0
,
"CreateFontIndirectA error %u
\n
"
,
ok
(
hFont
!=
0
,
"CreateFontIndirectA error %
l
u
\n
"
,
GetLastError
());
hOldFont
=
SelectObject
(
hdc
,
hFont
);
textheight
=
DrawTextA
(
hdc
,
text
,
textlen
,
&
rect
,
DT_CALCRECT
|
DT_EXTERNALLEADING
|
DT_WORDBREAK
|
DT_NOCLIP
|
DT_LEFT
|
DT_NOPREFIX
);
ok
(
textheight
,
"DrawTextA error %u
\n
"
,
GetLastError
());
ok
(
textheight
,
"DrawTextA error %
l
u
\n
"
,
GetLastError
());
trace
(
"MM_TEXT rect.bottom %d
\n
"
,
rect
.
bottom
);
trace
(
"MM_TEXT rect.bottom %
l
d
\n
"
,
rect
.
bottom
);
ok
(
rect
.
bottom
>
0
,
"In MM_TEXT, DrawText with DT_CALCRECT "
"should return a positive rectangle bottom. (bot=%d)
\n
"
,
"should return a positive rectangle bottom. (bot=%
l
d)
\n
"
,
rect
.
bottom
);
/* empty or null text should in some cases calc an empty rectangle */
...
...
@@ -326,12 +327,12 @@ static void test_DrawTextCalcRect(void)
dtp
.
iLeftMargin
=
8
;
SetRectEmpty
(
&
rect
);
DrawTextExA
(
hdc
,
text
,
-
1
,
&
rect
,
DT_CALCRECT
,
&
dtp
);
ok
(
rect
.
right
==
dtp
.
iLeftMargin
+
textlen
,
"Incorrect left margin calculated rc(%
d,%
d)
\n
"
,
rect
.
left
,
rect
.
right
);
ok
(
rect
.
right
==
dtp
.
iLeftMargin
+
textlen
,
"Incorrect left margin calculated rc(%
ld,%l
d)
\n
"
,
rect
.
left
,
rect
.
right
);
dtp
.
iLeftMargin
=
0
;
dtp
.
iRightMargin
=
8
;
SetRectEmpty
(
&
rect
);
DrawTextExA
(
hdc
,
text
,
-
1
,
&
rect
,
DT_CALCRECT
,
&
dtp
);
ok
(
rect
.
right
==
dtp
.
iRightMargin
+
textlen
,
"Incorrect right margin calculated rc(%
d,%
d)
\n
"
,
rect
.
left
,
rect
.
right
);
ok
(
rect
.
right
==
dtp
.
iRightMargin
+
textlen
,
"Incorrect right margin calculated rc(%
ld,%l
d)
\n
"
,
rect
.
left
,
rect
.
right
);
/* Wide char versions */
SetRect
(
&
rect
,
10
,
10
,
100
,
100
);
...
...
@@ -524,10 +525,10 @@ static void test_DrawTextCalcRect(void)
/* More test cases from bug 12226 */
SetRectEmpty
(
&
rect
);
textheight
=
DrawTextA
(
hdc
,
emptystring
,
-
1
,
&
rect
,
DT_CALCRECT
|
DT_LEFT
|
DT_SINGLELINE
);
ok
(
textheight
,
"DrawTextA error %u
\n
"
,
GetLastError
());
ok
(
0
==
rect
.
left
,
"expected 0, got %d
\n
"
,
rect
.
left
);
ok
(
0
==
rect
.
right
,
"expected 0, got %d
\n
"
,
rect
.
right
);
ok
(
0
==
rect
.
top
,
"expected 0, got %d
\n
"
,
rect
.
top
);
ok
(
textheight
,
"DrawTextA error %
l
u
\n
"
,
GetLastError
());
ok
(
0
==
rect
.
left
,
"expected 0, got %
l
d
\n
"
,
rect
.
left
);
ok
(
0
==
rect
.
right
,
"expected 0, got %
l
d
\n
"
,
rect
.
right
);
ok
(
0
==
rect
.
top
,
"expected 0, got %
l
d
\n
"
,
rect
.
top
);
ok
(
rect
.
bottom
,
"rect.bottom should not be 0
\n
"
);
SetRectEmpty
(
&
rect
);
...
...
@@ -538,10 +539,10 @@ static void test_DrawTextCalcRect(void)
}
else
{
ok
(
textheight
,
"DrawTextW error %u
\n
"
,
GetLastError
());
ok
(
0
==
rect
.
left
,
"expected 0, got %d
\n
"
,
rect
.
left
);
ok
(
0
==
rect
.
right
,
"expected 0, got %d
\n
"
,
rect
.
right
);
ok
(
0
==
rect
.
top
,
"expected 0, got %d
\n
"
,
rect
.
top
);
ok
(
textheight
,
"DrawTextW error %
l
u
\n
"
,
GetLastError
());
ok
(
0
==
rect
.
left
,
"expected 0, got %
l
d
\n
"
,
rect
.
left
);
ok
(
0
==
rect
.
right
,
"expected 0, got %
l
d
\n
"
,
rect
.
right
);
ok
(
0
==
rect
.
top
,
"expected 0, got %
l
d
\n
"
,
rect
.
top
);
ok
(
rect
.
bottom
,
"rect.bottom should not be 0
\n
"
);
}
...
...
@@ -595,22 +596,22 @@ static void test_DrawTextCalcRect(void)
textheight
=
DrawTextExA
(
hdc
,
tabstring
,
-
1
,
&
rect
,
DT_CALCRECT
|
DT_TABSTOP
|
DT_EXPANDTABS
,
&
dtp
);
ok
(
textheight
>=
heightcheck
,
"Got unexpected textheight %d
\n
"
,
textheight
);
ok
(
dtp
.
iTabLength
==
8
,
"invalid dtp.iTabLength = %i
\n
"
,
dtp
.
iTabLength
);
ok
(
rect
.
left
==
rect2
.
left
,
"unexpected value %
d, got %
d
\n
"
,
rect
.
left
,
rect2
.
left
);
ok
(
rect
.
left
==
rect2
.
left
,
"unexpected value %
ld, got %l
d
\n
"
,
rect
.
left
,
rect2
.
left
);
/* XP, 2003 appear to not give the same values. */
ok
(
rect
.
right
==
rect2
.
right
||
broken
(
rect
.
right
>
rect2
.
right
),
"unexpected value %
d, got %
d
\n
"
,
rect
.
right
,
rect2
.
right
);
ok
(
rect
.
top
==
rect2
.
top
,
"unexpected value %
d, got %
d
\n
"
,
rect
.
top
,
rect2
.
top
);
ok
(
rect
.
bottom
==
rect2
.
bottom
,
"unexpected value %
d, got %
d
\n
"
,
rect
.
bottom
,
rect2
.
bottom
);
ok
(
rect
.
right
==
rect2
.
right
||
broken
(
rect
.
right
>
rect2
.
right
),
"unexpected value %
ld, got %l
d
\n
"
,
rect
.
right
,
rect2
.
right
);
ok
(
rect
.
top
==
rect2
.
top
,
"unexpected value %
ld, got %l
d
\n
"
,
rect
.
top
,
rect2
.
top
);
ok
(
rect
.
bottom
==
rect2
.
bottom
,
"unexpected value %
ld, got %l
d
\n
"
,
rect
.
bottom
,
rect2
.
bottom
);
SelectObject
(
hdc
,
hOldFont
);
ret
=
DeleteObject
(
hFont
);
ok
(
ret
,
"DeleteObject error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"DeleteObject error %
l
u
\n
"
,
GetLastError
());
/* Clean up */
ret
=
ReleaseDC
(
hwnd
,
hdc
);
ok
(
ret
,
"ReleaseDC error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"ReleaseDC error %
l
u
\n
"
,
GetLastError
());
ret
=
DestroyWindow
(
hwnd
);
ok
(
ret
,
"DestroyWindow error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"DestroyWindow error %
l
u
\n
"
,
GetLastError
());
}
/* replace tabs by \t */
...
...
@@ -631,7 +632,7 @@ static void strfmt( const char *str, char *strout)
extent = GetTabbedTextExtentA( hdc, string, strlen( string), (tabcount), tabs); \
strfmt( string, strdisp); \
/* trace( "Extent is %08lx\n", extent); */
\
ok( extent == _exp, "Test case \"%s\". Text extent is 0x%
x, expected 0x%
x tab %d tabcount %d\n", \
ok( extent == _exp, "Test case \"%s\". Text extent is 0x%
lx, expected 0x%l
x tab %d tabcount %d\n", \
strdisp, extent, _exp, tabval, tabcount); \
} \
...
...
@@ -648,12 +649,12 @@ static void test_TabbedText(void)
/* Initialization */
hwnd
=
CreateWindowExA
(
0
,
"static"
,
NULL
,
WS_POPUP
,
0
,
0
,
200
,
200
,
0
,
0
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"CreateWindowExA error %u
\n
"
,
GetLastError
());
ok
(
hwnd
!=
0
,
"CreateWindowExA error %
l
u
\n
"
,
GetLastError
());
hdc
=
GetDC
(
hwnd
);
ok
(
hdc
!=
0
,
"GetDC error %u
\n
"
,
GetLastError
());
ok
(
hdc
!=
0
,
"GetDC error %
l
u
\n
"
,
GetLastError
());
ret
=
GetTextMetricsA
(
hdc
,
&
tm
);
ok
(
ret
,
"GetTextMetrics error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"GetTextMetrics error %
l
u
\n
"
,
GetLastError
());
extent
=
GetTabbedTextExtentA
(
hdc
,
"x"
,
0
,
1
,
tabs
);
ok
(
extent
==
0
,
"GetTabbedTextExtentA returned non-zero on nCount == 0
\n
"
);
...
...
@@ -721,24 +722,24 @@ static void test_DrawState(void)
SetLastError
(
0xdeadbeef
);
ret
=
DrawStateA
(
hdc
,
GetStockObject
(
DKGRAY_BRUSH
),
NULL
,
(
LPARAM
)
text
,
strlen
(
text
),
0
,
0
,
10
,
10
,
DST_TEXT
);
ok
(
ret
,
"DrawState error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"DrawState error %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
DrawStateA
(
hdc
,
GetStockObject
(
DKGRAY_BRUSH
),
NULL
,
(
LPARAM
)
text
,
0
,
0
,
0
,
10
,
10
,
DST_TEXT
);
ok
(
ret
,
"DrawState error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"DrawState error %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
DrawStateA
(
hdc
,
GetStockObject
(
DKGRAY_BRUSH
),
NULL
,
0
,
strlen
(
text
),
0
,
0
,
10
,
10
,
DST_TEXT
);
ok
(
!
ret
||
broken
(
ret
)
/* win98 */
,
"DrawState succeeded
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"not expected error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
0xdeadbeef
,
"not expected error %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
DrawStateA
(
hdc
,
GetStockObject
(
DKGRAY_BRUSH
),
NULL
,
0
,
0
,
0
,
0
,
10
,
10
,
DST_TEXT
);
ok
(
!
ret
||
broken
(
ret
)
/* win98 */
,
"DrawState succeeded
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"not expected error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
0xdeadbeef
,
"not expected error %
l
u
\n
"
,
GetLastError
());
ReleaseDC
(
hwnd
,
hdc
);
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