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
003333e6
Commit
003333e6
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 measuring string that doesn't fit into layout rectangle.
parent
466dfee1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
126 additions
and
0 deletions
+126
-0
graphics.c
dlls/gdiplus/tests/graphics.c
+126
-0
No files found.
dlls/gdiplus/tests/graphics.c
View file @
003333e6
...
...
@@ -36,6 +36,14 @@ static const REAL mm_per_inch = 25.4;
static
const
REAL
point_per_inch
=
72
.
0
;
static
HWND
hwnd
;
static
void
set_rect_empty
(
RectF
*
rc
)
{
rc
->
X
=
0
.
0
;
rc
->
Y
=
0
.
0
;
rc
->
Width
=
0
.
0
;
rc
->
Height
=
0
.
0
;
}
/* converts a given unit to its value in pixels */
static
REAL
units_to_pixels
(
REAL
units
,
GpUnit
unit
,
REAL
dpi
)
{
...
...
@@ -3769,6 +3777,123 @@ static void test_font_height_scaling(void)
status
=
GdipDeleteGraphics
(
graphics
);
expect
(
Ok
,
status
);
DeleteDC
(
hdc
);
GdipDeleteFontFamily
(
family
);
GdipDeleteStringFormat
(
format
);
}
static
void
test_measure_string
(
void
)
{
static
const
WCHAR
tahomaW
[]
=
{
'T'
,
'a'
,
'h'
,
'o'
,
'm'
,
'a'
,
0
};
static
const
WCHAR
string
[]
=
{
'A'
,
'0'
,
'1'
,
0
};
HDC
hdc
;
GpStringFormat
*
format
;
GpGraphics
*
graphics
;
GpFontFamily
*
family
;
GpFont
*
font
;
GpStatus
status
;
RectF
bounds
,
rect
;
REAL
width
,
height
,
width_1
,
width_2
;
int
lines
,
glyphs
;
status
=
GdipCreateStringFormat
(
StringFormatFlagsNoWrap
,
LANG_NEUTRAL
,
&
format
);
expect
(
Ok
,
status
);
status
=
GdipCreateFontFamilyFromName
(
tahomaW
,
NULL
,
&
family
);
expect
(
Ok
,
status
);
hdc
=
CreateCompatibleDC
(
0
);
status
=
GdipCreateFromHDC
(
hdc
,
&
graphics
);
status
=
GdipCreateFont
(
family
,
20
,
FontStyleRegular
,
UnitPixel
,
&
font
);
expect
(
Ok
,
status
);
set_rect_empty
(
&
rect
);
set_rect_empty
(
&
bounds
);
status
=
GdipMeasureString
(
graphics
,
string
,
-
1
,
font
,
&
rect
,
format
,
&
bounds
,
&
glyphs
,
&
lines
);
expect
(
Ok
,
status
);
expect
(
3
,
glyphs
);
expect
(
1
,
lines
);
width
=
bounds
.
Width
;
height
=
bounds
.
Height
;
set_rect_empty
(
&
rect
);
rect
.
Height
=
height
/
2
.
0
;
set_rect_empty
(
&
bounds
);
status
=
GdipMeasureString
(
graphics
,
string
,
-
1
,
font
,
&
rect
,
format
,
&
bounds
,
&
glyphs
,
&
lines
);
expect
(
Ok
,
status
);
expect
(
3
,
glyphs
);
expect
(
1
,
lines
);
expectf
(
width
,
bounds
.
Width
);
todo_wine
expectf
(
height
/
2
.
0
,
bounds
.
Height
);
set_rect_empty
(
&
rect
);
set_rect_empty
(
&
bounds
);
status
=
GdipMeasureString
(
graphics
,
string
,
1
,
font
,
&
rect
,
format
,
&
bounds
,
&
glyphs
,
&
lines
);
expect
(
Ok
,
status
);
expect
(
1
,
glyphs
);
expect
(
1
,
lines
);
ok
(
bounds
.
Width
<
width
/
2
.
0
,
"width of 1 glyph is wrong
\n
"
);
expectf
(
height
,
bounds
.
Height
);
width_1
=
bounds
.
Width
;
set_rect_empty
(
&
rect
);
set_rect_empty
(
&
bounds
);
status
=
GdipMeasureString
(
graphics
,
string
,
2
,
font
,
&
rect
,
format
,
&
bounds
,
&
glyphs
,
&
lines
);
expect
(
Ok
,
status
);
expect
(
2
,
glyphs
);
expect
(
1
,
lines
);
ok
(
bounds
.
Width
<
width
,
"width of 2 glyphs is wrong
\n
"
);
ok
(
bounds
.
Width
>
width_1
,
"width of 2 glyphs is wrong
\n
"
);
expectf
(
height
,
bounds
.
Height
);
width_2
=
bounds
.
Width
;
set_rect_empty
(
&
rect
);
rect
.
Width
=
width
/
2
.
0
;
set_rect_empty
(
&
bounds
);
status
=
GdipMeasureString
(
graphics
,
string
,
-
1
,
font
,
&
rect
,
format
,
&
bounds
,
&
glyphs
,
&
lines
);
expect
(
Ok
,
status
);
expect
(
1
,
glyphs
);
expect
(
1
,
lines
);
expectf_
(
width_1
,
bounds
.
Width
,
0
.
01
);
expectf
(
height
,
bounds
.
Height
);
set_rect_empty
(
&
rect
);
rect
.
Height
=
height
;
rect
.
Width
=
width
-
0
.
05
;
set_rect_empty
(
&
bounds
);
status
=
GdipMeasureString
(
graphics
,
string
,
-
1
,
font
,
&
rect
,
format
,
&
bounds
,
&
glyphs
,
&
lines
);
expect
(
Ok
,
status
);
todo_wine
expect
(
2
,
glyphs
);
expect
(
1
,
lines
);
todo_wine
expectf_
(
width_2
,
bounds
.
Width
,
0
.
01
);
expectf
(
height
,
bounds
.
Height
);
set_rect_empty
(
&
rect
);
rect
.
Height
=
height
;
rect
.
Width
=
width_2
-
0
.
05
;
set_rect_empty
(
&
bounds
);
status
=
GdipMeasureString
(
graphics
,
string
,
-
1
,
font
,
&
rect
,
format
,
&
bounds
,
&
glyphs
,
&
lines
);
expect
(
Ok
,
status
);
todo_wine
expect
(
1
,
glyphs
);
expect
(
1
,
lines
);
todo_wine
expectf_
(
width_1
,
bounds
.
Width
,
0
.
01
);
expectf
(
height
,
bounds
.
Height
);
status
=
GdipDeleteFont
(
font
);
expect
(
Ok
,
status
);
status
=
GdipDeleteGraphics
(
graphics
);
expect
(
Ok
,
status
);
DeleteDC
(
hdc
);
GdipDeleteFontFamily
(
family
);
GdipDeleteStringFormat
(
format
);
}
START_TEST
(
graphics
)
...
...
@@ -3797,6 +3922,7 @@ START_TEST(graphics)
GdiplusStartup
(
&
gdiplusToken
,
&
gdiplusStartupInput
,
NULL
);
test_measure_string
();
test_font_height_scaling
();
test_transform
();
test_GdipMeasureString
();
...
...
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