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
3f754db5
Commit
3f754db5
authored
Dec 23, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite/tests: Add IsColorFont() tests.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ab9ac59c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
0 deletions
+104
-0
font.c
dlls/dwrite/tests/font.c
+104
-0
No files found.
dlls/dwrite/tests/font.c
View file @
3f754db5
...
...
@@ -9546,6 +9546,109 @@ static void test_font_resource(void)
ok
(
ref
==
0
,
"Factory wasn't released, %u.
\n
"
,
ref
);
}
static
BOOL
get_expected_is_color
(
IDWriteFontFace2
*
fontface
)
{
void
*
context
;
UINT32
size
;
BOOL
exists
;
void
*
data
;
HRESULT
hr
;
hr
=
IDWriteFontFace2_TryGetFontTable
(
fontface
,
MS_CPAL_TAG
,
(
const
void
**
)
&
data
,
&
size
,
&
context
,
&
exists
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
if
(
context
)
IDWriteFontFace2_ReleaseFontTable
(
fontface
,
context
);
if
(
exists
)
{
hr
=
IDWriteFontFace2_TryGetFontTable
(
fontface
,
MS_COLR_TAG
,
(
const
void
**
)
&
data
,
&
size
,
&
context
,
&
exists
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
if
(
context
)
IDWriteFontFace2_ReleaseFontTable
(
fontface
,
context
);
}
return
exists
;
}
static
void
test_IsColorFont
(
void
)
{
IDWriteFontCollection
*
collection
;
IDWriteFactory2
*
factory
;
UINT32
count
,
i
;
ULONG
refcount
;
HRESULT
hr
;
factory
=
create_factory_iid
(
&
IID_IDWriteFactory2
);
if
(
!
factory
)
{
win_skip
(
"IsColorFont() is not supported.
\n
"
);
return
;
}
hr
=
IDWriteFactory2_GetSystemFontCollection
(
factory
,
&
collection
,
FALSE
);
ok
(
hr
==
S_OK
,
"Failed to get font collection, hr %#x.
\n
"
,
hr
);
count
=
IDWriteFontCollection_GetFontFamilyCount
(
collection
);
for
(
i
=
0
;
i
<
count
;
++
i
)
{
IDWriteLocalizedStrings
*
names
;
IDWriteFontFamily
*
family
;
UINT32
font_count
,
j
;
WCHAR
nameW
[
256
];
hr
=
IDWriteFontCollection_GetFontFamily
(
collection
,
i
,
&
family
);
ok
(
hr
==
S_OK
,
"Failed to get family, hr %#x.
\n
"
,
hr
);
hr
=
IDWriteFontFamily_GetFamilyNames
(
family
,
&
names
);
ok
(
hr
==
S_OK
,
"Failed to get names, hr %#x.
\n
"
,
hr
);
get_enus_string
(
names
,
nameW
,
ARRAY_SIZE
(
nameW
));
IDWriteLocalizedStrings_Release
(
names
);
font_count
=
IDWriteFontFamily_GetFontCount
(
family
);
for
(
j
=
0
;
j
<
font_count
;
++
j
)
{
BOOL
is_color_font
,
is_color_face
,
is_color_expected
;
IDWriteFontFace2
*
fontface2
;
IDWriteFontFace
*
fontface
;
IDWriteFont2
*
font2
;
IDWriteFont
*
font
;
hr
=
IDWriteFontFamily_GetFont
(
family
,
j
,
&
font
);
ok
(
hr
==
S_OK
,
"Failed to get font, hr %#x.
\n
"
,
hr
);
hr
=
IDWriteFont_QueryInterface
(
font
,
&
IID_IDWriteFont2
,
(
void
**
)
&
font2
);
ok
(
hr
==
S_OK
,
"Failed to get interface, hr %#x.
\n
"
,
hr
);
IDWriteFont_Release
(
font
);
hr
=
IDWriteFont2_CreateFontFace
(
font2
,
&
fontface
);
ok
(
hr
==
S_OK
,
"Failed to create fontface, hr %#x.
\n
"
,
hr
);
hr
=
IDWriteFontFace_QueryInterface
(
fontface
,
&
IID_IDWriteFontFace2
,
(
void
**
)
&
fontface2
);
ok
(
hr
==
S_OK
,
"Failed to get interface, hr %#x.
\n
"
,
hr
);
IDWriteFontFace_Release
(
fontface
);
is_color_font
=
IDWriteFont2_IsColorFont
(
font2
);
is_color_face
=
IDWriteFontFace2_IsColorFont
(
fontface2
);
ok
(
is_color_font
==
is_color_face
,
"Unexpected color flag.
\n
"
);
is_color_expected
=
get_expected_is_color
(
fontface2
);
ok
(
is_color_expected
==
is_color_face
,
"Unexpected is_color flag %d for %s, font %d.
\n
"
,
is_color_face
,
wine_dbgstr_w
(
nameW
),
j
);
IDWriteFontFace2_Release
(
fontface2
);
IDWriteFont2_Release
(
font2
);
}
IDWriteFontFamily_Release
(
family
);
}
IDWriteFontCollection_Release
(
collection
);
refcount
=
IDWriteFactory2_Release
(
factory
);
ok
(
refcount
==
0
,
"Factory not released, refcount %u.
\n
"
,
refcount
);
}
START_TEST
(
font
)
{
IDWriteFactory
*
factory
;
...
...
@@ -9614,6 +9717,7 @@ START_TEST(font)
test_AnalyzeContainerType
();
test_fontsetbuilder
();
test_font_resource
();
test_IsColorFont
();
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