Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
dart_pdf
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
David PHAM-VAN
2020-05-13 08:04:21 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d5cbadd0fe511469b83ff2521e4c77e510f5d2d5
d5cbadd0
1 parent
77046656
Add more text test
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
8 deletions
pdf/test/widget_text_test.dart
test/golden/widgets-text.pdf
pdf/test/widget_text_test.dart
View file @
d5cbadd
...
...
@@ -18,15 +18,17 @@
import
'dart:io'
;
import
'dart:math'
as
math
;
import
'dart:typed_data'
;
import
'package:test/test.dart'
;
import
'package:pdf/pdf.dart'
;
import
'package:pdf/widgets.dart'
;
import
'package:test/test.dart'
;
import
'utils.dart'
;
Document
pdf
;
Font
ttf
;
Font
ttfBold
;
Font
asian
;
Iterable
<
TextDecoration
>
permute
(
List
<
TextDecoration
>
prefix
,
List
<
TextDecoration
>
remaining
)
sync
*
{
...
...
@@ -44,10 +46,10 @@ void main() {
setUpAll
(()
{
Document
.
debug
=
true
;
RichText
.
debug
=
true
;
final
Uint8List
fontData
=
File
(
'open-sans.ttf'
).
readAsBytesSync
();
ttf
=
Font
.
ttf
(
fontData
.
buffer
.
asByteData
());
final
Uint8List
fontDataBold
=
File
(
'open-sans-bold.ttf'
).
readAsBytesSync
();
ttfBold
=
Font
.
ttf
(
fontDataBold
.
buffer
.
asByteData
());
ttf
=
loadFont
(
'open-sans.ttf'
);
ttfBold
=
loadFont
(
'open-sans-bold.ttf'
);
asian
=
loadFont
(
'genyomintw.ttf'
);
pdf
=
Document
();
});
...
...
@@ -244,6 +246,29 @@ void main() {
]));
});
test
(
'Text Widgets RichText Multiple lang'
,
()
{
pdf
.
addPage
(
Page
(
build:
(
Context
context
)
=>
RichText
(
text:
TextSpan
(
text:
'Hello '
,
style:
TextStyle
(
font:
ttf
,
fontSize:
20
,
),
children:
<
InlineSpan
>[
TextSpan
(
text:
'中文'
,
style:
TextStyle
(
font:
asian
),
),
TextSpan
(
text:
' world!'
,
),
],
),
),
));
});
tearDownAll
(()
{
final
File
file
=
File
(
'widgets-text.pdf'
);
file
.
writeAsBytesSync
(
pdf
.
save
());
...
...
test/golden/widgets-text.pdf
View file @
d5cbadd
No preview for this file type
Please
register
or
login
to post a comment