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
08ca2fa6
Commit
08ca2fa6
authored
Jun 25, 2009
by
Rein Klazes
Committed by
Alexandre Julliard
Jun 25, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32/tests: Show that there is an upper limit to the width of a font that can be specified.
parent
69bb29ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
1 deletion
+75
-1
font.c
dlls/gdi32/tests/font.c
+75
-1
No files found.
dlls/gdi32/tests/font.c
View file @
08ca2fa6
...
...
@@ -2911,10 +2911,82 @@ static void test_GetGlyphOutline(void)
DeleteDC
(
hdc
);
}
/* bug #9995: there is a limit to the character width that can be specified */
void
test_GetTextMetrics2
(
const
char
*
fontname
)
{
HFONT
of
,
hf
;
HDC
hdc
;
TEXTMETRICA
tm
;
LOGFONTA
lf
;
BOOL
ret
;
int
avecharw
[
3
],
maxcharw
[
3
];
if
(
!
is_truetype_font_installed
(
fontname
))
{
skip
(
"%s is not installed
\n
"
,
fontname
);
return
;
}
hdc
=
CreateCompatibleDC
(
0
);
ok
(
hdc
!=
NULL
,
"CreateCompatibleDC failed
\n
"
);
/* select width = 0 */
hf
=
CreateFontA
(
-
11
,
0
,
0
,
0
,
FW_REGULAR
,
FALSE
,
FALSE
,
FALSE
,
DEFAULT_CHARSET
,
OUT_TT_PRECIS
,
CLIP_LH_ANGLES
,
DEFAULT_QUALITY
,
VARIABLE_PITCH
,
fontname
);
ok
(
hf
!=
NULL
,
"CreateFontA failed
\n
"
);
of
=
SelectObject
(
hdc
,
hf
);
ret
=
GetObjectA
(
hf
,
sizeof
(
lf
),
&
lf
);
ret
=
GetTextMetricsA
(
hdc
,
&
tm
);
ok
(
ret
,
"GetTextMetricsA error %u, "
,
GetLastError
());
avecharw
[
0
]
=
tm
.
tmAveCharWidth
;
maxcharw
[
0
]
=
tm
.
tmMaxCharWidth
;
SelectObject
(
hdc
,
of
);
DeleteObject
(
hf
);
/* select LARGE width = 1023 */
hf
=
CreateFontA
(
-
11
,
1023
,
0
,
0
,
FW_REGULAR
,
FALSE
,
FALSE
,
FALSE
,
DEFAULT_CHARSET
,
OUT_TT_PRECIS
,
CLIP_LH_ANGLES
,
DEFAULT_QUALITY
,
VARIABLE_PITCH
,
fontname
);
ok
(
hf
!=
NULL
,
"CreateFontA failed
\n
"
);
of
=
SelectObject
(
hdc
,
hf
);
ret
=
GetObjectA
(
hf
,
sizeof
(
lf
),
&
lf
);
ret
=
GetTextMetricsA
(
hdc
,
&
tm
);
ok
(
ret
,
"GetTextMetricsA error %u, "
,
GetLastError
());
avecharw
[
1
]
=
tm
.
tmAveCharWidth
;
maxcharw
[
1
]
=
tm
.
tmMaxCharWidth
;
SelectObject
(
hdc
,
of
);
DeleteObject
(
hf
);
/* select TOOLARGE width = 1536 */
hf
=
CreateFontA
(
-
11
,
1536
,
0
,
0
,
FW_REGULAR
,
FALSE
,
FALSE
,
FALSE
,
DEFAULT_CHARSET
,
OUT_TT_PRECIS
,
CLIP_LH_ANGLES
,
DEFAULT_QUALITY
,
VARIABLE_PITCH
,
fontname
);
ok
(
hf
!=
NULL
,
"CreateFontA failed
\n
"
);
of
=
SelectObject
(
hdc
,
hf
);
ret
=
GetObjectA
(
hf
,
sizeof
(
lf
),
&
lf
);
ret
=
GetTextMetricsA
(
hdc
,
&
tm
);
ok
(
ret
,
"GetTextMetricsA error %u, "
,
GetLastError
());
avecharw
[
2
]
=
tm
.
tmAveCharWidth
;
maxcharw
[
2
]
=
tm
.
tmMaxCharWidth
;
SelectObject
(
hdc
,
of
);
DeleteObject
(
hf
);
/* tests */
ok
(
avecharw
[
1
]
>
10
*
avecharw
[
0
],
"Av. charwidth not large ( %d cmp.to %d)
\n
"
,
avecharw
[
1
],
avecharw
[
0
]);
ok
(
maxcharw
[
1
]
>
10
*
maxcharw
[
0
],
"Max charwidth not large ( %d cmp.to %d)
\n
"
,
maxcharw
[
1
],
maxcharw
[
0
]);
todo_wine
{
ok
(
avecharw
[
2
]
==
avecharw
[
0
],
"Unexpected Av. charwidth ( %d cmp.to %d)
\n
"
,
avecharw
[
2
],
avecharw
[
0
]);
ok
(
maxcharw
[
2
]
==
maxcharw
[
0
],
"Unexpected Max charwidth ( %d cmp.to %d)
\n
"
,
maxcharw
[
2
],
maxcharw
[
0
]);
}
/* clean up */
DeleteDC
(
hdc
);
}
START_TEST
(
font
)
{
init
();
test_logfont
();
test_bitmap_font
();
test_outline_font
();
...
...
@@ -2949,4 +3021,6 @@ START_TEST(font)
test_GdiRealizationInfo
();
test_GetTextFace
();
test_GetGlyphOutline
();
test_GetTextMetrics2
(
"Tahoma"
);
test_GetTextMetrics2
(
"Arial"
);
}
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