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
4bb95f39
Commit
4bb95f39
authored
Jul 20, 2004
by
Zach Gorman
Committed by
Alexandre Julliard
Jul 20, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test to demonstrate DrawText() with DT_CALCRECT incorrect behavior
in MM_HIENGLISH mapping mode.
parent
4d6dd9f6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
0 deletions
+116
-0
.cvsignore
dlls/user/tests/.cvsignore
+1
-0
Makefile.in
dlls/user/tests/Makefile.in
+1
-0
text.c
dlls/user/tests/text.c
+114
-0
No files found.
dlls/user/tests/.cvsignore
View file @
4bb95f39
...
...
@@ -11,5 +11,6 @@ resource.ok
resource.res
sysparams.ok
testlist.c
text.ok
win.ok
wsprintf.ok
dlls/user/tests/Makefile.in
View file @
4bb95f39
...
...
@@ -16,6 +16,7 @@ CTESTS = \
msg.c
\
resource.c
\
sysparams.c
\
text.c
\
win.c
\
wsprintf.c
...
...
dlls/user/tests/text.c
0 → 100644
View file @
4bb95f39
/*
* DrawText tests
*
* Copyright (c) 2004 Zach Gorman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
#include <assert.h>
#include "wine/test.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
static
void
test_DrawTextCalcRect
(
void
)
{
HWND
hwnd
;
HDC
hdc
;
HFONT
hFont
,
hOldFont
;
LOGFONTA
lf
;
const
char
text
[]
=
"Example text for testing DrawText in "
"MM_HIENGLISH mode"
;
INT
len
;
RECT
rect
=
{
0
,
0
,
100
,
0
};
/* Initialization */
hwnd
=
CreateWindowExA
(
0
,
"static"
,
NULL
,
WS_POPUP
,
0
,
0
,
200
,
200
,
0
,
0
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"CreateWindowExA error %lu
\n
"
,
GetLastError
());
hdc
=
GetDC
(
hwnd
);
ok
(
hdc
!=
0
,
"GetDC error %lu
\n
"
,
GetLastError
());
trace
(
"hdc %p
\n
"
,
hdc
);
len
=
lstrlenA
(
text
);
/* LOGFONT initialization */
memset
(
&
lf
,
0
,
sizeof
(
lf
));
lf
.
lfCharSet
=
ANSI_CHARSET
;
lf
.
lfClipPrecision
=
CLIP_DEFAULT_PRECIS
;
lf
.
lfWeight
=
FW_DONTCARE
;
lf
.
lfHeight
=
0
;
/* mapping mode dependent */
lf
.
lfQuality
=
DEFAULT_QUALITY
;
lstrcpyA
(
lf
.
lfFaceName
,
"Arial"
);
/* DrawText in MM_HIENGLISH with DT_CALCRECT */
SetMapMode
(
hdc
,
MM_HIENGLISH
);
lf
.
lfHeight
=
100
*
9
/
72
;
/* 9 point */
hFont
=
CreateFontIndirectA
(
&
lf
);
ok
(
hFont
!=
0
,
"CreateFontIndirectA error %lu
\n
"
,
GetLastError
());
hOldFont
=
SelectObject
(
hdc
,
hFont
);
ok
(
DrawTextA
(
hdc
,
text
,
len
,
&
rect
,
DT_CALCRECT
|
DT_EXTERNALLEADING
|
DT_WORDBREAK
|
DT_NOCLIP
|
DT_LEFT
|
DT_NOPREFIX
),
"DrawTextA error %lu
\n
"
,
GetLastError
());
trace
(
"MM_HIENGLISH rect.bottom %ld
\n
"
,
rect
.
bottom
);
todo_wine
ok
(
rect
.
bottom
<
0
,
"In MM_HIENGLISH, DrawText with "
"DT_CALCRECT should return a negative rectangle bottom. "
"(bot=%ld)
\n
"
,
rect
.
bottom
);
SelectObject
(
hdc
,
hOldFont
);
ok
(
DeleteObject
(
hFont
),
"DeleteObject error %lu
\n
"
,
GetLastError
());
/* DrawText in MM_TEXT with DT_CALCRECT */
SetMapMode
(
hdc
,
MM_TEXT
);
lf
.
lfHeight
=
-
MulDiv
(
9
,
GetDeviceCaps
(
hdc
,
LOGPIXELSY
),
72
);
/* 9 point */
hFont
=
CreateFontIndirectA
(
&
lf
);
ok
(
hFont
!=
0
,
"CreateFontIndirectA error %lu
\n
"
,
GetLastError
());
hOldFont
=
SelectObject
(
hdc
,
hFont
);
ok
(
DrawTextA
(
hdc
,
text
,
len
,
&
rect
,
DT_CALCRECT
|
DT_EXTERNALLEADING
|
DT_WORDBREAK
|
DT_NOCLIP
|
DT_LEFT
|
DT_NOPREFIX
),
"DrawTextA error %lu
\n
"
,
GetLastError
());
trace
(
"MM_TEXT rect.bottom %ld
\n
"
,
rect
.
bottom
);
ok
(
rect
.
bottom
>
0
,
"In MM_TEXT, DrawText with DT_CALCRECT "
"should return a positive rectangle bottom. (bot=%ld)
\n
"
,
rect
.
bottom
);
SelectObject
(
hdc
,
hOldFont
);
ok
(
DeleteObject
(
hFont
),
"DeleteObject error %lu
\n
"
,
GetLastError
());
/* Clean up */
ok
(
ReleaseDC
(
hwnd
,
hdc
),
"ReleaseDC error %lu
\n
"
,
GetLastError
());
ok
(
DestroyWindow
(
hwnd
),
"DestroyWindow error %lu
\n
"
,
GetLastError
());
}
START_TEST
(
text
)
{
test_DrawTextCalcRect
();
}
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