Showing
31 changed files
with
123 additions
and
2 deletions
.gitattributes
0 → 100644
1 | +test/golden/* filter=lfs diff=lfs merge=lfs -text |
@@ -4,6 +4,8 @@ addons: | @@ -4,6 +4,8 @@ addons: | ||
4 | apt: | 4 | apt: |
5 | packages: | 5 | packages: |
6 | - lib32stdc++6 | 6 | - lib32stdc++6 |
7 | + - poppler-utils | ||
8 | + - imagemagick | ||
7 | install: | 9 | install: |
8 | - git clone https://github.com/flutter/flutter.git -b stable --depth 1 $HOME/flutter | 10 | - git clone https://github.com/flutter/flutter.git -b stable --depth 1 $HOME/flutter |
9 | - export PATH=$HOME/flutter/bin:$PATH | 11 | - export PATH=$HOME/flutter/bin:$PATH |
@@ -73,6 +73,7 @@ test-pdf: $(FONTS) get-pdf .coverage | @@ -73,6 +73,7 @@ test-pdf: $(FONTS) get-pdf .coverage | ||
73 | dart --enable-asserts --disable-service-auth-codes --enable-vm-service=$(COV_PORT) --pause-isolates-on-exit test/all_tests.dart | 73 | dart --enable-asserts --disable-service-auth-codes --enable-vm-service=$(COV_PORT) --pause-isolates-on-exit test/all_tests.dart |
74 | cd pdf; pub global run coverage:format_coverage --packages=.packages -i coverage.json --report-on lib --lcov --out lcov.info | 74 | cd pdf; pub global run coverage:format_coverage --packages=.packages -i coverage.json --report-on lib --lcov --out lcov.info |
75 | cd pdf; for EXAMPLE in $(shell cd pdf; find example -name '*.dart'); do dart $$EXAMPLE; done | 75 | cd pdf; for EXAMPLE in $(shell cd pdf; find example -name '*.dart'); do dart $$EXAMPLE; done |
76 | + test/compare-pdf.sh pdf test/golden | ||
76 | 77 | ||
77 | test-printing: $(FONTS) get-printing .coverage | 78 | test-printing: $(FONTS) get-printing .coverage |
78 | cd printing/example; flutter test --coverage --coverage-path ../lcov.info | 79 | cd printing/example; flutter test --coverage --coverage-path ../lcov.info |
@@ -107,12 +108,12 @@ publish-printing: format clean | @@ -107,12 +108,12 @@ publish-printing: format clean | ||
107 | 108 | ||
108 | analyze-pdf: .pana | 109 | analyze-pdf: .pana |
109 | @find pdf -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' | 110 | @find pdf -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' |
110 | - @pub global run pana --no-warning --source path pdf 2> /dev/null | python pana_report.py | 111 | + @pub global run pana --no-warning --source path pdf 2> /dev/null | python test/pana_report.py |
111 | @find pdf -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' | 112 | @find pdf -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' |
112 | 113 | ||
113 | analyze-printing: .pana | 114 | analyze-printing: .pana |
114 | @find printing -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' | 115 | @find printing -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';' |
115 | - @pub global run pana --no-warning --source path printing 2> /dev/null | python pana_report.py | 116 | + @pub global run pana --no-warning --source path printing 2> /dev/null | python test/pana_report.py |
116 | @find printing -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' | 117 | @find printing -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';' |
117 | 118 | ||
118 | analyze: analyze-pdf analyze-printing | 119 | analyze: analyze-pdf analyze-printing |
test/compare-pdf.sh
0 → 100755
1 | +#!/bin/bash | ||
2 | + | ||
3 | +DST=$(dirname "$0")/diff | ||
4 | +SRC=$1 | ||
5 | +GOLD=$2 | ||
6 | +ERROR=0 | ||
7 | +DPI=50 | ||
8 | +COMPARE=$(command -v compare) | ||
9 | + | ||
10 | +for PDF in "$SRC"/*.pdf; do | ||
11 | + echo "Diffing $PDF" | ||
12 | + G="$GOLD"/$(basename "$PDF") | ||
13 | + if [ ! -f "$G" ]; then | ||
14 | + echo " Golden image $G not found" | ||
15 | + ERROR=1 | ||
16 | + continue | ||
17 | + fi | ||
18 | + | ||
19 | + T=$(basename "$PDF" .pdf) | ||
20 | + mkdir -p "$DST"/"$T" | ||
21 | + pdftocairo "$PDF" -png -r "$DPI" "$DST"/"$T"/src 2> /dev/null | ||
22 | + pdftocairo "$G" -png -r "$DPI" "$DST"/"$T"/gold 2> /dev/null | ||
23 | + | ||
24 | + for PNG in "$DST"/"$T"/gold*.png; do | ||
25 | + S="$DST"/"$T"/src-"${PNG##*-}" | ||
26 | + RES=$($COMPARE -metric AE "$PNG" "$S" null: 2>&1) | ||
27 | + if [ "$RES" != "0" ]; then | ||
28 | + D="$DST"/"$T"/diff-"${PNG##*-}" | ||
29 | + $COMPARE "$PNG" "$S" -highlight-color red "$D" | ||
30 | + echo " Differences in $PNG and $S => $D" | ||
31 | + ERROR=1 | ||
32 | + fi | ||
33 | + done | ||
34 | +done | ||
35 | + | ||
36 | +if [ $ERROR -eq 0 ]; then | ||
37 | + rm -rf "$DST" | ||
38 | +fi | ||
39 | + | ||
40 | +exit $ERROR |
test/golden/annotations.pdf
0 → 100644
No preview for this file type
test/golden/colors.pdf
0 → 100644
No preview for this file type
test/golden/complex.pdf
0 → 100644
No preview for this file type
test/golden/example.pdf
0 → 100644
No preview for this file type
test/golden/isolate.pdf
0 → 100644
No preview for this file type
test/golden/jpeg.pdf
0 → 100644
No preview for this file type
test/golden/metrics.pdf
0 → 100644
No preview for this file type
test/golden/minimal.pdf
0 → 100644
No preview for this file type
test/golden/orientation.pdf
0 → 100644
No preview for this file type
test/golden/ttf.pdf
0 → 100644
No preview for this file type
test/golden/type1.pdf
0 → 100644
No preview for this file type
test/golden/widgets-basic.pdf
0 → 100644
No preview for this file type
test/golden/widgets-clip.pdf
0 → 100644
No preview for this file type
test/golden/widgets-container.pdf
0 → 100644
No preview for this file type
test/golden/widgets-flex.pdf
0 → 100644
No preview for this file type
test/golden/widgets-monopage-1.pdf
0 → 100644
No preview for this file type
test/golden/widgets-monopage.pdf
0 → 100644
No preview for this file type
test/golden/widgets-multipage-1.pdf
0 → 100644
No preview for this file type
test/golden/widgets-multipage.pdf
0 → 100644
No preview for this file type
test/golden/widgets-table.pdf
0 → 100644
No preview for this file type
test/golden/widgets-text.pdf
0 → 100644
No preview for this file type
test/golden/widgets-theme.pdf
0 → 100644
No preview for this file type
test/golden/widgets-watermark.pdf
0 → 100644
No preview for this file type
test/golden/widgets-wrap.pdf
0 → 100644
No preview for this file type
test/golden/widgets.pdf
0 → 100644
No preview for this file type
-
Please register or login to post a comment