David PHAM-VAN

Fix unit tests

@@ -97,9 +97,9 @@ get: $(FONTS) pdf/pubspec.lock printing/pubspec.lock demo/pubspec.lock test/pubs @@ -97,9 +97,9 @@ get: $(FONTS) pdf/pubspec.lock printing/pubspec.lock demo/pubspec.lock test/pubs
97 get-all: $(FONTS) demo/assets/logo.svg demo/assets/profile.jpg get 97 get-all: $(FONTS) demo/assets/logo.svg demo/assets/profile.jpg get
98 98
99 test-pdf: svg $(FONTS) pdf/pubspec.lock .coverage 99 test-pdf: svg $(FONTS) pdf/pubspec.lock .coverage
100 - cd pdf; $(DART_BIN) pub global run coverage:collect_coverage --port=$(COV_PORT) -o coverage.json --resume-isolates --wait-paused &\  
101 - $(DART_BIN) --enable-asserts --disable-service-auth-codes --enable-vm-service=$(COV_PORT) --pause-isolates-on-exit test/all_tests.dart  
102 - cd pdf; $(DART_BIN) pub global run coverage:format_coverage --package=. -i coverage.json --report-on lib --lcov --out lcov.info 100 + cd pdf; $(DART_BIN) run --enable-asserts --pause-isolates-on-exit --disable-service-auth-codes --enable-vm-service=$(COV_PORT) test &\
  101 + $(DART_BIN) pub global run coverage:collect_coverage --wait-paused --uri=http://127.0.0.1:$(COV_PORT)/ -o coverage.json --resume-isolates --scope-output=pdf
  102 + cd pdf; $(DART_BIN) pub global run coverage:format_coverage --packages=.dart_tool/package_config.json -i coverage.json --report-on lib --lcov --out lcov.info
103 cd pdf; for EXAMPLE in $(shell cd pdf; find example -name '*.dart'); do $(DART_BIN) $$EXAMPLE; done 103 cd pdf; for EXAMPLE in $(shell cd pdf; find example -name '*.dart'); do $(DART_BIN) $$EXAMPLE; done
104 test/compare-pdf.sh pdf test/golden 104 test/compare-pdf.sh pdf test/golden
105 105
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 - Improve TTF Writer compatibility 5 - Improve TTF Writer compatibility
6 - Apply THE BIDIRECTIONAL ALGORITHM using dart_bidi [Milad akarie] 6 - Apply THE BIDIRECTIONAL ALGORITHM using dart_bidi [Milad akarie]
7 - Add Inseparable Widget 7 - Add Inseparable Widget
  8 +- Fix unit tests
8 9
9 ## 3.8.4 10 ## 3.8.4
10 11
1 -/*  
2 - * Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com>  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -  
17 -library pdf.all_tests;  
18 -  
19 -import '../example/main.dart' as example;  
20 -import 'annotations_test.dart' as annotations;  
21 -import 'arabic_test.dart' as arabic;  
22 -import 'colors_test.dart' as colors;  
23 -import 'complex_test.dart' as complex;  
24 -import 'data_types_test.dart' as data_types;  
25 -import 'isolate_test.dart' as isolate;  
26 -import 'jpeg_test.dart' as jpeg;  
27 -import 'metrics_test.dart' as metrics;  
28 -import 'minimal_test.dart' as minimal;  
29 -import 'orientation_test.dart' as orientation;  
30 -import 'roll_paper_test.dart' as roll;  
31 -import 'ttf_test.dart' as ttf;  
32 -import 'type1_test.dart' as type1;  
33 -import 'widget_barcode_test.dart' as widget_barcode;  
34 -import 'widget_basic_test.dart' as widget_basic;  
35 -import 'widget_chart_test.dart' as widget_chart;  
36 -import 'widget_clip_test.dart' as widget_clip;  
37 -import 'widget_container_test.dart' as widget_container;  
38 -import 'widget_flex_test.dart' as widget_flex;  
39 -import 'widget_form_test.dart' as widget_form;  
40 -import 'widget_grid_view_test.dart' as widget_grid_view;  
41 -import 'widget_icon_test.dart' as widget_icon;  
42 -import 'widget_multipage_test.dart' as widget_multipage;  
43 -import 'widget_opacity_test.dart' as widget_opacity;  
44 -import 'widget_outline_test.dart' as widget_outline;  
45 -import 'widget_partitions_test.dart' as widget_partitions;  
46 -import 'widget_svg_test.dart' as widget_svg;  
47 -import 'widget_table_test.dart' as widget_table;  
48 -import 'widget_test.dart' as widget;  
49 -import 'widget_text_test.dart' as widget_text;  
50 -import 'widget_theme_test.dart' as widget_theme;  
51 -import 'widget_toc_test.dart' as widget_toc;  
52 -import 'widget_watermark_test.dart' as widget_watermark;  
53 -import 'widget_wrap_test.dart' as widget_wrap;  
54 -  
55 -void main() {  
56 - annotations.main();  
57 - arabic.main();  
58 - colors.main();  
59 - complex.main();  
60 - data_types.main();  
61 - example.main();  
62 - isolate.main();  
63 - jpeg.main();  
64 - metrics.main();  
65 - minimal.main();  
66 - orientation.main();  
67 - roll.main();  
68 - ttf.main();  
69 - type1.main();  
70 - widget_barcode.main();  
71 - widget_basic.main();  
72 - widget_chart.main();  
73 - widget_clip.main();  
74 - widget_container.main();  
75 - widget_flex.main();  
76 - widget_form.main();  
77 - widget_grid_view.main();  
78 - widget_icon.main();  
79 - widget_multipage.main();  
80 - widget_opacity.main();  
81 - widget_outline.main();  
82 - widget_partitions.main();  
83 - widget_svg.main();  
84 - widget_table.main();  
85 - widget_text.main();  
86 - widget_theme.main();  
87 - widget_toc.main();  
88 - widget_watermark.main();  
89 - widget_wrap.main();  
90 - widget.main();  
91 -}  
@@ -25,6 +25,7 @@ late Document pdf; @@ -25,6 +25,7 @@ late Document pdf;
25 void main() { 25 void main() {
26 setUpAll(() { 26 setUpAll(() {
27 Document.debug = true; 27 Document.debug = true;
  28 + RichText.debug = true;
28 pdf = Document(); 29 pdf = Document();
29 }); 30 });
30 31
@@ -37,7 +37,7 @@ TextStyle? style; @@ -37,7 +37,7 @@ TextStyle? style;
37 37
38 void main() { 38 void main() {
39 setUpAll(() { 39 setUpAll(() {
40 - Document.debug = false; 40 + Document.debug = true;
41 RichText.debug = true; 41 RichText.debug = true;
42 pdf = Document(); 42 pdf = Document();
43 43
@@ -173,6 +173,7 @@ late Document pdf; @@ -173,6 +173,7 @@ late Document pdf;
173 void main() { 173 void main() {
174 setUpAll(() { 174 setUpAll(() {
175 Document.debug = true; 175 Document.debug = true;
  176 + RichText.debug = true;
176 pdf = Document(pageMode: PdfPageMode.outlines); 177 pdf = Document(pageMode: PdfPageMode.outlines);
177 }); 178 });
178 179
@@ -29,6 +29,7 @@ late MemoryImage image; @@ -29,6 +29,7 @@ late MemoryImage image;
29 void main() { 29 void main() {
30 setUpAll(() async { 30 setUpAll(() async {
31 Document.debug = true; 31 Document.debug = true;
  32 + RichText.debug = true;
32 pdf = Document(); 33 pdf = Document();
33 34
34 image = MemoryImage( 35 image = MemoryImage(
@@ -100,6 +100,9 @@ void printMetrics( @@ -100,6 +100,9 @@ void printMetrics(
100 100
101 void main() { 101 void main() {
102 test('Pdf Font Metrics', () async { 102 test('Pdf Font Metrics', () async {
  103 + Document.debug = true;
  104 + RichText.debug = true;
  105 +
103 final pdf = Document(); 106 final pdf = Document();
104 107
105 PdfFont.courier(pdf.document); 108 PdfFont.courier(pdf.document);
@@ -53,6 +53,7 @@ List<Widget> contentMultiPage(Context context) { @@ -53,6 +53,7 @@ List<Widget> contentMultiPage(Context context) {
53 void main() { 53 void main() {
54 setUpAll(() { 54 setUpAll(() {
55 Document.debug = true; 55 Document.debug = true;
  56 + RichText.debug = true;
56 pdf = Document(); 57 pdf = Document();
57 }); 58 });
58 59
@@ -24,6 +24,7 @@ late Document pdf; @@ -24,6 +24,7 @@ late Document pdf;
24 24
25 void main() { 25 void main() {
26 setUpAll(() { 26 setUpAll(() {
  27 + RichText.debug = true;
27 Document.debug = true; 28 Document.debug = true;
28 pdf = Document(); 29 pdf = Document();
29 }); 30 });
@@ -113,7 +113,7 @@ void hexDump( @@ -113,7 +113,7 @@ void hexDump(
113 } 113 }
114 } 114 }
115 } 115 }
116 - s += b.toRadixString(16).padLeft(2, '0') + ' '; 116 + s += '${b.toRadixString(16).padLeft(2, '0')} ';
117 if (b > 31 && b < 128) { 117 if (b > 31 && b < 128) {
118 t += String.fromCharCode(b); 118 t += String.fromCharCode(b);
119 } else { 119 } else {
@@ -54,7 +54,8 @@ Widget barcode( @@ -54,7 +54,8 @@ Widget barcode(
54 54
55 void main() { 55 void main() {
56 setUpAll(() { 56 setUpAll(() {
57 - // Document.debug = true; 57 + RichText.debug = true;
  58 + Document.debug = true;
58 pdf = Document(); 59 pdf = Document();
59 }); 60 });
60 61
@@ -25,6 +25,7 @@ late Document pdf; @@ -25,6 +25,7 @@ late Document pdf;
25 void main() { 25 void main() {
26 setUpAll(() { 26 setUpAll(() {
27 Document.debug = true; 27 Document.debug = true;
  28 + RichText.debug = true;
28 pdf = Document(); 29 pdf = Document();
29 }); 30 });
30 31
@@ -25,6 +25,7 @@ late Document pdf; @@ -25,6 +25,7 @@ late Document pdf;
25 void main() { 25 void main() {
26 setUpAll(() { 26 setUpAll(() {
27 Document.debug = true; 27 Document.debug = true;
  28 + RichText.debug = true;
28 pdf = Document(); 29 pdf = Document();
29 }); 30 });
30 31
@@ -27,6 +27,7 @@ late Document pdf; @@ -27,6 +27,7 @@ late Document pdf;
27 void main() { 27 void main() {
28 setUpAll(() { 28 setUpAll(() {
29 Document.debug = true; 29 Document.debug = true;
  30 + RichText.debug = true;
30 pdf = Document(); 31 pdf = Document();
31 }); 32 });
32 33
@@ -25,6 +25,7 @@ late Document pdf; @@ -25,6 +25,7 @@ late Document pdf;
25 void main() { 25 void main() {
26 setUpAll(() { 26 setUpAll(() {
27 Document.debug = true; 27 Document.debug = true;
  28 + RichText.debug = true;
28 pdf = Document(); 29 pdf = Document();
29 }); 30 });
30 31
@@ -65,7 +65,8 @@ class Decorated extends StatelessWidget { @@ -65,7 +65,8 @@ class Decorated extends StatelessWidget {
65 65
66 void main() { 66 void main() {
67 setUpAll(() { 67 setUpAll(() {
68 - // Document.debug = true; 68 + Document.debug = true;
  69 + RichText.debug = true;
69 pdf = Document(); 70 pdf = Document();
70 }); 71 });
71 72
@@ -24,6 +24,7 @@ late Document pdf; @@ -24,6 +24,7 @@ late Document pdf;
24 void main() { 24 void main() {
25 setUpAll(() { 25 setUpAll(() {
26 Document.debug = true; 26 Document.debug = true;
  27 + RichText.debug = true;
27 pdf = Document(); 28 pdf = Document();
28 }); 29 });
29 30
@@ -28,6 +28,7 @@ Font? icons; @@ -28,6 +28,7 @@ Font? icons;
28 void main() { 28 void main() {
29 setUpAll(() { 29 setUpAll(() {
30 Document.debug = true; 30 Document.debug = true;
  31 + RichText.debug = true;
31 pdf = Document(); 32 pdf = Document();
32 icons = loadFont('material.ttf'); 33 icons = loadFont('material.ttf');
33 }); 34 });
@@ -23,6 +23,9 @@ List<Widget> lines = <Widget>[]; @@ -23,6 +23,9 @@ List<Widget> lines = <Widget>[];
23 23
24 void main() { 24 void main() {
25 setUpAll(() { 25 setUpAll(() {
  26 + Document.debug = true;
  27 + RichText.debug = true;
  28 +
26 for (var i = 0; i < 200; i++) { 29 for (var i = 0; i < 200; i++) {
27 lines.add(Text('Line $i')); 30 lines.add(Text('Line $i'));
28 } 31 }
@@ -24,6 +24,7 @@ late Document pdf; @@ -24,6 +24,7 @@ late Document pdf;
24 void main() { 24 void main() {
25 setUpAll(() { 25 setUpAll(() {
26 Document.debug = true; 26 Document.debug = true;
  27 + RichText.debug = true;
27 pdf = Document(); 28 pdf = Document();
28 }); 29 });
29 30
@@ -70,6 +70,7 @@ Iterable<Widget> level(int i) sync* { @@ -70,6 +70,7 @@ Iterable<Widget> level(int i) sync* {
70 void main() { 70 void main() {
71 setUpAll(() { 71 setUpAll(() {
72 Document.debug = true; 72 Document.debug = true;
  73 + RichText.debug = true;
73 pdf = Document(pageMode: PdfPageMode.outlines); 74 pdf = Document(pageMode: PdfPageMode.outlines);
74 }); 75 });
75 76
@@ -24,6 +24,7 @@ late Document pdf; @@ -24,6 +24,7 @@ late Document pdf;
24 void main() { 24 void main() {
25 setUpAll(() { 25 setUpAll(() {
26 Document.debug = true; 26 Document.debug = true;
  27 + RichText.debug = true;
27 pdf = Document(); 28 pdf = Document();
28 }); 29 });
29 30
@@ -25,6 +25,7 @@ late Document pdf; @@ -25,6 +25,7 @@ late Document pdf;
25 void main() { 25 void main() {
26 setUpAll(() { 26 setUpAll(() {
27 Document.debug = true; 27 Document.debug = true;
  28 + RichText.debug = true;
28 pdf = Document(); 29 pdf = Document();
29 }); 30 });
30 31
@@ -66,6 +66,7 @@ List<TableRow> buildTable( @@ -66,6 +66,7 @@ List<TableRow> buildTable(
66 void main() { 66 void main() {
67 setUpAll(() { 67 setUpAll(() {
68 Document.debug = true; 68 Document.debug = true;
  69 + RichText.debug = true;
69 pdf = Document(); 70 pdf = Document();
70 }); 71 });
71 72
@@ -29,6 +29,7 @@ void main() { @@ -29,6 +29,7 @@ void main() {
29 29
30 setUpAll(() { 30 setUpAll(() {
31 Document.debug = true; 31 Document.debug = true;
  32 + RichText.debug = true;
32 33
33 final defaultFont = File('open-sans.ttf').readAsBytesSync(); 34 final defaultFont = File('open-sans.ttf').readAsBytesSync();
34 final defaultFontBold = File('open-sans-bold.ttf').readAsBytesSync(); 35 final defaultFontBold = File('open-sans-bold.ttf').readAsBytesSync();
@@ -104,7 +104,7 @@ void main() { @@ -104,7 +104,7 @@ void main() {
104 for (final align in TextAlign.values) { 104 for (final align in TextAlign.values) {
105 widgets.add( 105 widgets.add(
106 Text( 106 Text(
107 - '$align:\n' + para, 107 + '$align:\n$para',
108 textAlign: align, 108 textAlign: align,
109 ), 109 ),
110 ); 110 );
@@ -25,6 +25,7 @@ late Document pdf; @@ -25,6 +25,7 @@ late Document pdf;
25 void main() { 25 void main() {
26 setUpAll(() { 26 setUpAll(() {
27 Document.debug = true; 27 Document.debug = true;
  28 + RichText.debug = true;
28 pdf = Document(); 29 pdf = Document();
29 }); 30 });
30 31
@@ -26,6 +26,7 @@ PageTheme? pageTheme; @@ -26,6 +26,7 @@ PageTheme? pageTheme;
26 void main() { 26 void main() {
27 setUpAll(() { 27 setUpAll(() {
28 Document.debug = true; 28 Document.debug = true;
  29 + RichText.debug = true;
29 pdf = Document(); 30 pdf = Document();
30 31
31 pageTheme = PageTheme( 32 pageTheme = PageTheme(
@@ -26,6 +26,7 @@ late Document pdf; @@ -26,6 +26,7 @@ late Document pdf;
26 void main() { 26 void main() {
27 setUpAll(() { 27 setUpAll(() {
28 Document.debug = true; 28 Document.debug = true;
  29 + RichText.debug = true;
29 pdf = Document(); 30 pdf = Document();
30 }); 31 });
31 32