-
Notifications
You must be signed in to change notification settings - Fork 9
/
generate-screenshots.sh
106 lines (86 loc) · 3.55 KB
/
generate-screenshots.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
#
#
rm -rf docs/testfiles/
mkdir -p docs/testfiles/
echo "{}" > docs/testfiles/setup.json
echo "# Screenshots (testfile)" > docs/testfiles/README.md
echo "" >> docs/testfiles/README.md
echo "screenshots of the testfiles in tests/data/ loaded in viaconstructor with the default configuration" >> docs/testfiles/README.md
echo "" >> docs/testfiles/README.md
for IMG in `ls tests/data/* | grep -v "\.check$\|\.cfg\|\.xnc\|\.scad"`
do
#echo ../../$IMG
#continue
echo -n > /tmp/vlog
echo "viaconstructor $IMG"
viaconstructor -s docs/testfiles/setup.json -D $IMG 2> /tmp/vlog &
for n in `seq 20`
do
cat /tmp/vlog
if grep -s -q "update_drawing: done" /tmp/vlog
then
sleep .5
import -silent -quiet -window "viaConstructor" docs/testfiles/`basename $IMG`.png
echo "## `basename $IMG`" >> docs/testfiles/README.md
echo "drawing: [`basename $IMG`](../../$IMG)" >> docs/testfiles/README.md
echo "" >> docs/testfiles/README.md
echo "<img src=\"`basename $IMG`.png\" width=\"320\">" >> docs/testfiles/README.md
echo "" >> docs/testfiles/README.md
break
fi
sleep .5
done
killall -9 viaconstructor
sleep .5
if echo "$IMG" | grep -s -q "\.svg"
then
echo -n > /tmp/vlog
echo "viaconstructor --dxfread-no-svg $IMG"
viaconstructor -s docs/testfiles/setup.json -D --dxfread-no-svg $IMG 2> /tmp/vlog &
for n in `seq 20`
do
if grep -s -q "update_drawing: done" /tmp/vlog
then
sleep .5
import -silent -quiet -window "viaConstructor" docs/testfiles/`basename $IMG`--dxfread-no-svg.png
echo "## `basename $IMG`" >> docs/testfiles/README.md
echo "drawing: [`basename $IMG`](../../$IMG)" >> docs/testfiles/README.md
echo "" >> docs/testfiles/README.md
echo "with option: --dxfread-no-svg" >> docs/testfiles/README.md
echo "" >> docs/testfiles/README.md
echo "<img src=\"`basename $IMG`--dxfread-no-svg.png\" width=\"320\">" >> docs/testfiles/README.md
echo "" >> docs/testfiles/README.md
break
fi
sleep .5
done
killall -9 viaconstructor
sleep .5
fi
if echo "$IMG" | grep -s -q "\.bmp"
then
echo -n > /tmp/vlog
echo "viaconstructor --dxfread-no-bmp $IMG"
viaconstructor -s docs/testfiles/setup.json -D --dxfread-no-bmp --imgread-scale 10 $IMG 2> /tmp/vlog &
for n in `seq 20`
do
if grep -s -q "update_drawing: done" /tmp/vlog
then
sleep .5
import -silent -quiet -window "viaConstructor" docs/testfiles/`basename $IMG`--dxfread-no-bmp--imgread-scale10.png
echo "## `basename $IMG`" >> docs/testfiles/README.md
echo "drawing: [`basename $IMG`](../../$IMG)" >> docs/testfiles/README.md
echo "" >> docs/testfiles/README.md
echo "with option: --dxfread-no-bmp --imgread-scale 10" >> docs/testfiles/README.md
echo "" >> docs/testfiles/README.md
echo "<img src=\"`basename $IMG`--dxfread-no-bmp--imgread-scale10.png\" width=\"320\">" >> docs/testfiles/README.md
echo "" >> docs/testfiles/README.md
break
fi
sleep .5
done
killall -9 viaconstructor
sleep .5
fi
done