-
Notifications
You must be signed in to change notification settings - Fork 3
/
move-actual-expected.sh
48 lines (43 loc) · 1.7 KB
/
move-actual-expected.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
#!/bin/bash
basedir=tests/__tests__/__snapshots__
expected=.expected.png
actual=.actual.png
save=.save.png
app=${REACT_APP_BASE_OS:-macos}
appdir=${basedir}/${app}
if [[ "$1" == "forward" ]]; then
echo "Saving existing expected images"
for fl in `ls ${appdir}/*${expected}`; do
basename=${fl/${appdir}\//}
rootname=${basename/${expected}/}
echo "cp ${appdir}/${basename} ${appdir}/${rootname}${save}"
cp ${appdir}/${basename} ${appdir}/${rootname}${save}
done
echo "Copying actual images to expected (if they exist)"
for fl in `ls ${basedir}/*${actual}`; do
basename=${fl/${basedir}\//}
rootname=${basename/${actual}/}
echo "cp ${basedir}/${basename} ${appdir}/${rootname}${expected}"
cp ${basedir}/${basename} ${appdir}/${rootname}${expected}
done
elif [[ "$1" == "backward" ]]; then
echo "Moving saved images back to expected"
for fl in `ls ${appdir}/*${save}`; do
basename=${fl/${basedir}\//}
rootname=${basename/${save}/}
echo "mv ${appdir}/${basename} ${appdir}/${rootname}${expected}"
mv ${appdir}/${basename} ${appdir}/${rootname}${expected}
done
else
echo "
Due to inconsistencies in the treatment of line objects in WebGL, there is no
guarantee that a given system configuration produces identical PNGs for objects
using THREE.Line objects (including all the unit cells in the expected images).
This script migrates actual images to expected images so one can run tests on
MacOS.
Note:
If run, these new expected images should *NOT* be committed, as the lines
generated by the CentOS-based container are correct for CI testing.
Please provide an argument [forward|backward]
"
fi