Showing
3 changed files
with
58 additions
and
0 deletions
@@ -36,6 +36,7 @@ import 'widget_container_test.dart' as widget_container; | @@ -36,6 +36,7 @@ import 'widget_container_test.dart' as widget_container; | ||
36 | import 'widget_flex_test.dart' as widget_flex; | 36 | import 'widget_flex_test.dart' as widget_flex; |
37 | import 'widget_grid_view_test.dart' as widget_grid_view; | 37 | import 'widget_grid_view_test.dart' as widget_grid_view; |
38 | import 'widget_multipage_test.dart' as widget_multipage; | 38 | import 'widget_multipage_test.dart' as widget_multipage; |
39 | +import 'widget_opacity_test.dart' as widget_opacity; | ||
39 | import 'widget_partitions_test.dart' as widget_partitions; | 40 | import 'widget_partitions_test.dart' as widget_partitions; |
40 | import 'widget_table_test.dart' as widget_table; | 41 | import 'widget_table_test.dart' as widget_table; |
41 | import 'widget_test.dart' as widget; | 42 | import 'widget_test.dart' as widget; |
@@ -65,6 +66,7 @@ void main() { | @@ -65,6 +66,7 @@ void main() { | ||
65 | widget_flex.main(); | 66 | widget_flex.main(); |
66 | widget_grid_view.main(); | 67 | widget_grid_view.main(); |
67 | widget_multipage.main(); | 68 | widget_multipage.main(); |
69 | + widget_opacity.main(); | ||
68 | widget_partitions.main(); | 70 | widget_partitions.main(); |
69 | widget_table.main(); | 71 | widget_table.main(); |
70 | widget_text.main(); | 72 | widget_text.main(); |
pdf/test/widget_opacity_test.dart
0 → 100644
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 | +// ignore_for_file: omit_local_variable_types | ||
18 | + | ||
19 | +import 'dart:io'; | ||
20 | + | ||
21 | +import 'package:pdf/widgets.dart'; | ||
22 | +import 'package:test/test.dart'; | ||
23 | + | ||
24 | +Document pdf; | ||
25 | + | ||
26 | +void main() { | ||
27 | + setUpAll(() { | ||
28 | + Document.debug = true; | ||
29 | + pdf = Document(); | ||
30 | + }); | ||
31 | + | ||
32 | + test('Opacity Widgets', () { | ||
33 | + pdf.addPage( | ||
34 | + Page( | ||
35 | + build: (Context context) => Stack( | ||
36 | + alignment: Alignment.center, | ||
37 | + children: <Widget>[ | ||
38 | + Text('Background', textScaleFactor: 5), | ||
39 | + Opacity( | ||
40 | + opacity: .5, | ||
41 | + child: PdfLogo(), | ||
42 | + ), | ||
43 | + ], | ||
44 | + ), | ||
45 | + ), | ||
46 | + ); | ||
47 | + }); | ||
48 | + | ||
49 | + tearDownAll(() { | ||
50 | + final File file = File('widgets-opacity.pdf'); | ||
51 | + file.writeAsBytesSync(pdf.save()); | ||
52 | + }); | ||
53 | +} |
test/golden/widgets-opacity.pdf
0 → 100644
No preview for this file type
-
Please register or login to post a comment