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
39d71c52
Commit
39d71c52
authored
May 27, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 27, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite/tests: Some tests for control characters handling.
parent
7ab517c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
1 deletion
+95
-1
analyzer.c
dlls/dwrite/tests/analyzer.c
+52
-0
layout.c
dlls/dwrite/tests/layout.c
+43
-1
No files found.
dlls/dwrite/tests/analyzer.c
View file @
39d71c52
...
...
@@ -1192,15 +1192,18 @@ static void test_GetGlyphs(void)
{
static
const
WCHAR
test1W
[]
=
{
'<'
,
'B'
,
' '
,
'C'
,
0
};
static
const
WCHAR
test2W
[]
=
{
'<'
,
'B'
,
'\t'
,
'C'
,
0
};
static
const
WCHAR
test3W
[]
=
{
0x202a
,
0x202c
,
0
};
DWRITE_SHAPING_GLYPH_PROPERTIES
shapingprops
[
20
];
DWRITE_SHAPING_TEXT_PROPERTIES
props
[
20
];
UINT32
maxglyphcount
,
actual_count
;
IDWriteTextAnalyzer
*
analyzer
;
IDWriteFontFace
*
fontface
;
DWRITE_SCRIPT_ANALYSIS
sa
;
DWRITE_GLYPH_OFFSET
offsets
[
10
];
UINT16
clustermap
[
10
];
UINT16
glyphs1
[
10
];
UINT16
glyphs2
[
10
];
FLOAT
advances
[
10
];
HRESULT
hr
;
hr
=
IDWriteFactory_CreateTextAnalyzer
(
factory
,
&
analyzer
);
...
...
@@ -1262,6 +1265,55 @@ if (0) {
ok
(
actual_count
==
4
,
"got %d
\n
"
,
actual_count
);
ok
(
glyphs1
[
0
]
!=
glyphs2
[
0
],
"got %d
\n
"
,
glyphs1
[
0
]);
/* embedded control codes, with unknown script id 0 */
actual_count
=
0
;
hr
=
IDWriteTextAnalyzer_GetGlyphs
(
analyzer
,
test3W
,
lstrlenW
(
test3W
),
fontface
,
FALSE
,
TRUE
,
&
sa
,
NULL
,
NULL
,
NULL
,
NULL
,
0
,
maxglyphcount
,
clustermap
,
props
,
glyphs1
,
shapingprops
,
&
actual_count
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
actual_count
==
2
,
"got %d
\n
"
,
actual_count
);
ok
(
glyphs1
[
0
]
==
0
,
"got %d
\n
"
,
glyphs1
[
0
]);
ok
(
glyphs1
[
1
]
==
0
,
"got %d
\n
"
,
glyphs1
[
1
]);
ok
(
shapingprops
[
0
].
isClusterStart
==
1
,
"got %d
\n
"
,
shapingprops
[
0
].
isClusterStart
);
ok
(
shapingprops
[
0
].
isZeroWidthSpace
==
0
,
"got %d
\n
"
,
shapingprops
[
0
].
isZeroWidthSpace
);
ok
(
shapingprops
[
1
].
isClusterStart
==
1
,
"got %d
\n
"
,
shapingprops
[
1
].
isClusterStart
);
ok
(
shapingprops
[
1
].
isZeroWidthSpace
==
0
,
"got %d
\n
"
,
shapingprops
[
1
].
isZeroWidthSpace
);
ok
(
clustermap
[
0
]
==
0
,
"got %d
\n
"
,
clustermap
[
0
]);
ok
(
clustermap
[
1
]
==
1
,
"got %d
\n
"
,
clustermap
[
1
]);
memset
(
advances
,
0
,
sizeof
(
advances
));
hr
=
IDWriteTextAnalyzer_GetGlyphPlacements
(
analyzer
,
test3W
,
clustermap
,
props
,
lstrlenW
(
test3W
),
glyphs1
,
shapingprops
,
actual_count
,
fontface
,
10
.
0
,
FALSE
,
FALSE
,
&
sa
,
NULL
,
NULL
,
NULL
,
0
,
advances
,
offsets
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
advances
[
0
]
==
10
.
0
,
"got %.2f
\n
"
,
advances
[
0
]);
ok
(
advances
[
1
]
==
10
.
0
,
"got %.2f
\n
"
,
advances
[
1
]);
/* embedded control codes with proper script */
sa
.
script
=
0
;
get_script_analysis
(
test3W
,
&
sa
);
ok
(
sa
.
script
!=
0
,
"got %d
\n
"
,
sa
.
script
);
actual_count
=
0
;
hr
=
IDWriteTextAnalyzer_GetGlyphs
(
analyzer
,
test3W
,
lstrlenW
(
test3W
),
fontface
,
FALSE
,
FALSE
,
&
sa
,
NULL
,
NULL
,
NULL
,
NULL
,
0
,
maxglyphcount
,
clustermap
,
props
,
glyphs1
,
shapingprops
,
&
actual_count
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
actual_count
==
2
,
"got %d
\n
"
,
actual_count
);
ok
(
glyphs1
[
0
]
==
0
,
"got %d
\n
"
,
glyphs1
[
0
]);
ok
(
glyphs1
[
1
]
==
0
,
"got %d
\n
"
,
glyphs1
[
1
]);
ok
(
shapingprops
[
0
].
isClusterStart
==
1
,
"got %d
\n
"
,
shapingprops
[
0
].
isClusterStart
);
ok
(
shapingprops
[
0
].
isZeroWidthSpace
==
0
,
"got %d
\n
"
,
shapingprops
[
0
].
isZeroWidthSpace
);
ok
(
shapingprops
[
1
].
isClusterStart
==
1
,
"got %d
\n
"
,
shapingprops
[
1
].
isClusterStart
);
ok
(
shapingprops
[
1
].
isZeroWidthSpace
==
0
,
"got %d
\n
"
,
shapingprops
[
1
].
isZeroWidthSpace
);
ok
(
clustermap
[
0
]
==
0
,
"got %d
\n
"
,
clustermap
[
0
]);
ok
(
clustermap
[
1
]
==
1
,
"got %d
\n
"
,
clustermap
[
1
]);
memset
(
advances
,
0
,
sizeof
(
advances
));
hr
=
IDWriteTextAnalyzer_GetGlyphPlacements
(
analyzer
,
test3W
,
clustermap
,
props
,
lstrlenW
(
test3W
),
glyphs1
,
shapingprops
,
actual_count
,
fontface
,
10
.
0
,
FALSE
,
FALSE
,
&
sa
,
NULL
,
NULL
,
NULL
,
0
,
advances
,
offsets
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
advances
[
0
]
==
10
.
0
,
"got %.2f
\n
"
,
advances
[
0
]);
ok
(
advances
[
1
]
==
10
.
0
,
"got %.2f
\n
"
,
advances
[
1
]);
IDWriteTextAnalyzer_Release
(
analyzer
);
IDWriteFontFace_Release
(
fontface
);
}
...
...
dlls/dwrite/tests/layout.c
View file @
39d71c52
...
...
@@ -990,6 +990,7 @@ static void test_typography(void)
static
void
test_GetClusterMetrics
(
void
)
{
static
const
WCHAR
str2W
[]
=
{
0x202a
,
0x202c
,
'a'
,
0
};
static
const
WCHAR
strW
[]
=
{
'a'
,
'b'
,
'c'
,
'd'
,
0
};
DWRITE_INLINE_OBJECT_METRICS
inline_metrics
;
DWRITE_CLUSTER_METRICS
metrics
[
4
];
...
...
@@ -1096,8 +1097,49 @@ todo_wine
ok
(
inline_metrics
.
width
>
0
.
0
&&
inline_metrics
.
width
==
metrics
[
0
].
width
,
"got %.2f, expected %.2f
\n
"
,
inline_metrics
.
width
,
metrics
[
0
].
width
);
IDWriteInlineObject_Release
(
trimm
);
IDWriteTextLayout_Release
(
layout
);
/* text with non-visual control codes */
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
str2W
,
3
,
format
,
1000
.
0
,
1000
.
0
,
&
layout
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
/* bidi control codes take a separate cluster */
count
=
0
;
memset
(
metrics
,
0
,
sizeof
(
metrics
));
hr
=
IDWriteTextLayout_GetClusterMetrics
(
layout
,
metrics
,
3
,
&
count
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
count
==
3
,
"got %u
\n
"
,
count
);
todo_wine
ok
(
metrics
[
0
].
width
==
0
.
0
,
"got %.2f
\n
"
,
metrics
[
0
].
width
);
ok
(
metrics
[
0
].
length
==
1
,
"got %d
\n
"
,
metrics
[
0
].
length
);
ok
(
metrics
[
0
].
canWrapLineAfter
==
0
,
"got %d
\n
"
,
metrics
[
0
].
canWrapLineAfter
);
ok
(
metrics
[
0
].
isWhitespace
==
0
,
"got %d
\n
"
,
metrics
[
0
].
isWhitespace
);
ok
(
metrics
[
0
].
isNewline
==
0
,
"got %d
\n
"
,
metrics
[
0
].
isNewline
);
ok
(
metrics
[
0
].
isSoftHyphen
==
0
,
"got %d
\n
"
,
metrics
[
0
].
isSoftHyphen
);
ok
(
metrics
[
0
].
isRightToLeft
==
0
,
"got %d
\n
"
,
metrics
[
0
].
isRightToLeft
);
todo_wine
ok
(
metrics
[
1
].
width
==
0
.
0
,
"got %.2f
\n
"
,
metrics
[
1
].
width
);
ok
(
metrics
[
1
].
length
==
1
,
"got %d
\n
"
,
metrics
[
1
].
length
);
ok
(
metrics
[
1
].
canWrapLineAfter
==
0
,
"got %d
\n
"
,
metrics
[
1
].
canWrapLineAfter
);
ok
(
metrics
[
1
].
isWhitespace
==
0
,
"got %d
\n
"
,
metrics
[
1
].
isWhitespace
);
ok
(
metrics
[
1
].
isNewline
==
0
,
"got %d
\n
"
,
metrics
[
1
].
isNewline
);
ok
(
metrics
[
1
].
isSoftHyphen
==
0
,
"got %d
\n
"
,
metrics
[
1
].
isSoftHyphen
);
ok
(
metrics
[
1
].
isRightToLeft
==
0
,
"got %d
\n
"
,
metrics
[
1
].
isRightToLeft
);
ok
(
metrics
[
2
].
width
>
0
.
0
,
"got %.2f
\n
"
,
metrics
[
2
].
width
);
ok
(
metrics
[
2
].
length
==
1
,
"got %d
\n
"
,
metrics
[
2
].
length
);
todo_wine
ok
(
metrics
[
2
].
canWrapLineAfter
==
1
,
"got %d
\n
"
,
metrics
[
2
].
canWrapLineAfter
);
ok
(
metrics
[
2
].
isWhitespace
==
0
,
"got %d
\n
"
,
metrics
[
2
].
isWhitespace
);
ok
(
metrics
[
2
].
isNewline
==
0
,
"got %d
\n
"
,
metrics
[
2
].
isNewline
);
ok
(
metrics
[
2
].
isSoftHyphen
==
0
,
"got %d
\n
"
,
metrics
[
2
].
isSoftHyphen
);
ok
(
metrics
[
2
].
isRightToLeft
==
0
,
"got %d
\n
"
,
metrics
[
2
].
isRightToLeft
);
IDWriteTextLayout_Release
(
layout
);
IDWriteInlineObject_Release
(
trimm
);
IDWriteTextFormat_Release
(
format
);
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