comparison test/test-layer-exports.sh @ 2509:03b12584af5b

Add svl format export regression tests (but see also bug #1979 SVL export does not export Colour 3D Plot data)
author Chris Cannam
date Tue, 21 Apr 2020 09:19:27 +0100
parents 048d9eed0a1f
children 5a397accaf59
comparison
equal deleted inserted replaced
2508:c68b431ca101 2509:03b12584af5b
87 87
88 # Note layer can also be exported as MIDI 88 # Note layer can also be exported as MIDI
89 /setcurrent 4 3 89 /setcurrent 4 3
90 /exportlayer "$tmpdir/notes.mid" 90 /exportlayer "$tmpdir/notes.mid"
91 91
92 # Now test exporting only the contents of a (multiple) selection. 92 # And everything as SVL
93 /setcurrent 1 3
94 /exportlayer "$tmpdir/instants.svl"
95 /setcurrent 2 3
96 /exportlayer "$tmpdir/values.svl"
97 /setcurrent 3 2
98 /exportlayer "$tmpdir/image.svl"
99 /setcurrent 3 3
100 /exportlayer "$tmpdir/regions.svl"
101 /setcurrent 4 2
102 /exportlayer "$tmpdir/text.svl"
103 /setcurrent 4 3
104 /exportlayer "$tmpdir/notes.svl"
105 /setcurrent 5 2
106 /exportlayer "$tmpdir/3dplot.svl"
107 /setcurrent 6 2
108 /exportlayer "$tmpdir/spectrogram.svl"
109 /setcurrent 6 3
110 /exportlayer "$tmpdir/boxes.svl"
111 /setcurrent 7 2
112 /exportlayer "$tmpdir/peakfreq.svl"
113
114 # Now test exporting only the contents of a (multiple) selection. This
115 # is only supported for CSV files.
93 # First set waveform layer as current, to avoid snapping the selection 116 # First set waveform layer as current, to avoid snapping the selection
94 # to the contents of an annotation layer. 117 # to the contents of an annotation layer.
95 /setcurrent 1 2 118 /setcurrent 1 2
96 119
97 # Make a selection 120 # Make a selection
133 EOF 156 EOF
134 157
135 "$sv" --no-splash --osc-script "$tmpdir/script" 158 "$sv" --no-splash --osc-script "$tmpdir/script"
136 159
137 for type in instants values image regions text notes 3dplot spectrogram boxes peakfreq ; do 160 for type in instants values image regions text notes 3dplot spectrogram boxes peakfreq ; do
138 for pfx in "" "selected-"; do 161 for format in csv svl ; do
139 actual="$tmpdir/$pfx$type.csv" 162 for pfx in "" "selected-"; do
140 expected="layers-expected/$pfx$type.csv" 163 if [ "$format" = "svl" ] && [ -n "$pfx" ]; then
141 if ! cmp -s "$actual" "$expected" ; then 164 continue
142 echo
143 if [ -z "$pfx" ]; then
144 echo "Test failed for layer type \"$type\"!"
145 else
146 echo "Test failed for selected regions in layer type \"$type\"!"
147 fi 165 fi
148 echo 166 actual="$tmpdir/$pfx$type.$format"
149 echo "Actual:" 167 expected="layers-expected/$pfx$type.$format"
150 ls -l "$actual" 168 if ! cmp -s "$actual" "$expected" ; then
151 echo "Expected:" 169 echo
152 ls -l "$expected" 170 if [ -z "$pfx" ]; then
153 echo 171 echo "Test failed for file type $format, layer type \"$type\"!"
154 echo "Diff begins:" 172 else
155 git diff --no-index --word-diff=color --word-diff-regex=. "$actual" "$expected" | head 173 echo "Test failed for selected regions in layer type \"$type\"!"
156 echo 174 fi
157 fi 175 echo
176 echo "Actual:"
177 ls -l "$actual"
178 echo "Expected:"
179 ls -l "$expected"
180 echo
181 echo "Diff begins:"
182 git diff --no-index --word-diff=color --word-diff-regex=. "$actual" "$expected" | head
183 echo
184 fi
185 done
158 done 186 done
159 done 187 done
160 188
161 for csv in selected-zoomed-3dplot.csv ; do 189 for csv in selected-zoomed-3dplot.csv ; do
162 actual="$tmpdir/$csv" 190 actual="$tmpdir/$csv"