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
de6c150d
Commit
de6c150d
authored
Aug 20, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Aug 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Add a test for extra space added by GdipMeasureString.
parent
6f630a40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
0 deletions
+72
-0
graphics.c
dlls/gdiplus/tests/graphics.c
+72
-0
No files found.
dlls/gdiplus/tests/graphics.c
View file @
de6c150d
...
...
@@ -3892,6 +3892,77 @@ todo_wine
GdipDeleteStringFormat
(
format
);
}
static
void
test_measured_extra_space
(
void
)
{
static
const
WCHAR
tahomaW
[]
=
{
'T'
,
'a'
,
'h'
,
'o'
,
'm'
,
'a'
,
0
};
static
const
WCHAR
string
[
2
]
=
{
'W'
,
'W'
};
GpStringFormat
*
format
;
HDC
hdc
;
GpGraphics
*
graphics
;
GpFontFamily
*
family
;
GpFont
*
font
;
GpStatus
status
;
GpUnit
gfx_unit
,
font_unit
;
RectF
bounds_1
,
bounds_2
,
rect
;
REAL
margin
,
font_size
,
dpi
;
status
=
GdipCreateStringFormat
(
0
,
LANG_NEUTRAL
,
&
format
);
expect
(
Ok
,
status
);
status
=
GdipCreateFontFamilyFromName
(
tahomaW
,
NULL
,
&
family
);
expect
(
Ok
,
status
);
hdc
=
CreateCompatibleDC
(
0
);
status
=
GdipCreateFromHDC
(
hdc
,
&
graphics
);
expect
(
Ok
,
status
);
status
=
GdipGetDpiX
(
graphics
,
&
dpi
);
expect
(
Ok
,
status
);
/* UnitPixel = 2, UnitPoint = 3, UnitInch = 4, UnitDocument = 5, UnitMillimeter = 6 */
/* UnitPixel as a font base unit is not tested because it differs in behaviour */
for
(
font_unit
=
3
;
font_unit
<=
6
;
font_unit
++
)
{
status
=
GdipCreateFont
(
family
,
1234
.
0
,
FontStyleRegular
,
font_unit
,
&
font
);
expect
(
Ok
,
status
);
status
=
GdipGetFontSize
(
font
,
&
font_size
);
expect
(
Ok
,
status
);
font_size
=
units_to_pixels
(
font_size
,
font_unit
,
dpi
);
/*trace("font size/6 = %f pixels\n", font_size / 6.0);*/
/* UnitPixel = 2, UnitPoint = 3, UnitInch = 4, UnitDocument = 5, UnitMillimeter = 6 */
for
(
gfx_unit
=
2
;
gfx_unit
<=
6
;
gfx_unit
++
)
{
status
=
GdipSetPageUnit
(
graphics
,
gfx_unit
);
expect
(
Ok
,
status
);
/* bounds.width of 1 glyph: [margin]+[width]+[margin] */
set_rect_empty
(
&
rect
);
set_rect_empty
(
&
bounds_1
);
status
=
GdipMeasureString
(
graphics
,
string
,
1
,
font
,
&
rect
,
format
,
&
bounds_1
,
NULL
,
NULL
);
expect
(
Ok
,
status
);
/* bounds.width of 2 identical glyphs: [margin]+[width]+[width]+[margin] */
set_rect_empty
(
&
rect
);
set_rect_empty
(
&
bounds_2
);
status
=
GdipMeasureString
(
graphics
,
string
,
2
,
font
,
&
rect
,
format
,
&
bounds_2
,
NULL
,
NULL
);
expect
(
Ok
,
status
);
/* margin = [bounds.width of 1] - [bounds.width of 2] / 2*/
margin
=
units_to_pixels
(
bounds_1
.
Width
-
bounds_2
.
Width
/
2
.
0
,
gfx_unit
,
dpi
);
/*trace("margin %f pixels\n", margin);*/
todo_wine
expectf_
(
font_size
/
6
.
0
,
margin
,
font_size
/
100
.
0
);
}
GdipDeleteFont
(
font
);
}
GdipDeleteGraphics
(
graphics
);
DeleteDC
(
hdc
);
GdipDeleteFontFamily
(
family
);
GdipDeleteStringFormat
(
format
);
}
START_TEST
(
graphics
)
{
struct
GdiplusStartupInput
gdiplusStartupInput
;
...
...
@@ -3918,6 +3989,7 @@ START_TEST(graphics)
GdiplusStartup
(
&
gdiplusToken
,
&
gdiplusStartupInput
,
NULL
);
test_measured_extra_space
();
test_measure_string
();
test_font_height_scaling
();
test_transform
();
...
...
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