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
239530e8
Commit
239530e8
authored
Jan 21, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite/tests: Add some tests for text format properties.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
612652bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
3 deletions
+91
-3
layout.c
dlls/dwrite/tests/layout.c
+91
-3
No files found.
dlls/dwrite/tests/layout.c
View file @
239530e8
...
...
@@ -190,11 +190,17 @@ static IDWriteTextAnalysisSourceVtbl analysissourcevtbl = {
static
IDWriteTextAnalysisSource
analysissource
=
{
&
analysissourcevtbl
};
static
void
*
create_factory_iid
(
REFIID
riid
)
{
IUnknown
*
factory
=
NULL
;
DWriteCreateFactory
(
DWRITE_FACTORY_TYPE_ISOLATED
,
riid
,
&
factory
);
return
factory
;
}
static
IDWriteFactory
*
create_factory
(
void
)
{
IDWriteFactory
*
factory
;
HRESULT
hr
=
DWriteCreateFactory
(
DWRITE_FACTORY_TYPE_ISOLATED
,
&
IID_IDWriteFactory
,
(
IUnknown
**
)
&
factory
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IDWriteFactory
*
factory
=
create_factory_iid
(
&
IID_IDWriteFactory
);
ok
(
factory
!=
NULL
,
"Failed to create factory.
\n
"
);
return
factory
;
}
...
...
@@ -5860,6 +5866,87 @@ static void test_automatic_font_axes(void)
IDWriteFactory_Release
(
factory
);
}
static
void
test_text_format_axes
(
void
)
{
IDWriteFontCollection
*
collection
;
IDWriteFontCollection2
*
collection2
;
DWRITE_FONT_AXIS_VALUE
axis
;
IDWriteTextFormat3
*
format3
;
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_WEIGHT
weight
;
IDWriteTextFormat
*
format
;
IDWriteFactory6
*
factory
;
DWRITE_FONT_STYLE
style
;
DWRITE_FONT_FAMILY_MODEL
model
;
unsigned
int
count
;
HRESULT
hr
;
factory
=
create_factory_iid
(
&
IID_IDWriteFactory6
);
if
(
!
factory
)
{
win_skip
(
"Text format does not support variations.
\n
"
);
return
;
}
hr
=
IDWriteFactory6_CreateTextFormat
(
factory
,
L"test_family"
,
NULL
,
NULL
,
0
,
10
.
0
f
,
L"en-us"
,
&
format3
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDWriteTextFormat3_GetFontCollection
(
format3
,
&
collection
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDWriteFontCollection_QueryInterface
(
collection
,
&
IID_IDWriteFontCollection2
,
(
void
**
)
&
collection2
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
model
=
IDWriteFontCollection2_GetFontFamilyModel
(
collection2
);
ok
(
model
==
DWRITE_FONT_FAMILY_MODEL_TYPOGRAPHIC
,
"Unexpected model %d.
\n
"
,
model
);
IDWriteFontCollection_Release
(
collection
);
IDWriteFontCollection2_Release
(
collection2
);
count
=
IDWriteTextFormat3_GetFontAxisValueCount
(
format3
);
ok
(
!
count
,
"Unexpected axis count %u.
\n
"
,
count
);
stretch
=
IDWriteTextFormat3_GetFontStretch
(
format3
);
ok
(
stretch
==
DWRITE_FONT_STRETCH_NORMAL
,
"Unexpected font stretch %d.
\n
"
,
stretch
);
style
=
IDWriteTextFormat3_GetFontStyle
(
format3
);
ok
(
style
==
DWRITE_FONT_STYLE_NORMAL
,
"Unexpected font style %d.
\n
"
,
style
);
weight
=
IDWriteTextFormat3_GetFontWeight
(
format3
);
ok
(
weight
==
DWRITE_FONT_WEIGHT_NORMAL
,
"Unexpected font weight %d.
\n
"
,
weight
);
/* Regular properties are not set from axis values. */
axis
.
axisTag
=
DWRITE_FONT_AXIS_TAG_WEIGHT
;
axis
.
value
=
200
.
0
f
;
hr
=
IDWriteTextFormat3_SetFontAxisValues
(
format3
,
&
axis
,
1
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
weight
=
IDWriteTextFormat3_GetFontWeight
(
format3
);
ok
(
weight
==
DWRITE_FONT_WEIGHT_NORMAL
,
"Unexpected font weight %d.
\n
"
,
weight
);
IDWriteTextFormat3_Release
(
format3
);
}
hr
=
IDWriteFactory_CreateTextFormat
((
IDWriteFactory
*
)
factory
,
L"test_family"
,
NULL
,
DWRITE_FONT_WEIGHT_BOLD
,
DWRITE_FONT_STYLE_ITALIC
,
DWRITE_FONT_STRETCH_EXPANDED
,
10
.
0
f
,
L"en-us"
,
&
format
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDWriteTextFormat_QueryInterface
(
format
,
&
IID_IDWriteTextFormat3
,
(
void
**
)
&
format3
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
count
=
IDWriteTextFormat3_GetFontAxisValueCount
(
format3
);
ok
(
!
count
,
"Unexpected axis count %u.
\n
"
,
count
);
IDWriteTextFormat3_Release
(
format3
);
IDWriteTextFormat_Release
(
format
);
IDWriteFactory6_Release
(
factory
);
}
START_TEST
(
layout
)
{
IDWriteFactory
*
factory
;
...
...
@@ -5912,6 +5999,7 @@ START_TEST(layout)
test_GetOverhangMetrics
();
test_tab_stops
();
test_automatic_font_axes
();
test_text_format_axes
();
IDWriteFactory_Release
(
factory
);
}
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