Skip to content

Commit 9f964a4

Browse files
authored
Merge pull request #1482 from rvilarl/fix/clefCodeAndTempoNotes
Fix/clef code and tempo notes
2 parents 7067aef + 9eccfef commit 9f964a4

File tree

3 files changed

+23
-44
lines changed

3 files changed

+23
-44
lines changed

src/clef.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class Clef extends StaveModifier {
7878
point: 0,
7979
},
8080
percussion: {
81-
code: 'restMaxima',
81+
code: 'unpitchedPercussionClef1',
8282
line: 2,
8383
point: 0,
8484
},

src/stavetempo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export class StaveTempo extends StaveModifier {
100100

101101
x += 3 * scale;
102102
Glyph.renderGlyph(ctx, x, y, options.glyph_font_scale, glyphProps.code_head);
103-
x += glyphProps.getWidth ? glyphProps.getWidth() : 0 * scale;
103+
x += Glyph.getWidth(glyphProps.code_head, options.glyph_font_scale);
104104

105105
// Draw stem and flags
106106
if (glyphProps.stem) {

tools/visual_regression.sh

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
# The optional argument allows you to compare a subset of the images
2323
# (only those with names starting with the specified prefix).
2424
#
25-
# Check build/images/diff/results.txt for results. This file is sorted
26-
# by PHASH difference (most different files on top.) The composite diff
27-
# images for failed tests (i.e., PHASH > 1.0) are stored in build/images/diff.
25+
# Check build/images/diff/results.txt for results. The composite diff
26+
# images for failed tests are stored in build/images/diff.
2827
#
2928

3029
# PNG viewer on OSX. Switch this to whatever your system uses.
@@ -36,10 +35,6 @@ LC_NUMERIC="en_US.UTF-8"
3635
# Check ImageMagick installation
3736
command -v convert >/dev/null 2>&1 || { echo >&2 "Error: ImageMagick not found."; exit 1; }
3837

39-
# Show images over this PHASH threshold. This is probably too low, but
40-
# a good first pass.
41-
THRESHOLD=0.01
42-
4338
# Directories. You might want to change BASE, if you're running from a
4439
# different working directory.
4540
BASE=.
@@ -110,7 +105,7 @@ if [ -n "$NPROC" ]; then
110105
nproc=$NPROC
111106
fi
112107

113-
echo "Running $totalImagesA tests with threshold $THRESHOLD (nproc=$nproc)..."
108+
echo "Running $totalImagesA tests (nproc=$nproc)..."
114109

115110
function ProgressBar {
116111
let _progress=(${1}*100/${2}*100)/100
@@ -142,37 +137,24 @@ function diff_image() {
142137
fi
143138

144139
# If the two files are byte-for-byte identical, skip the image comparison below.
145-
cmp -s $fileA $fileB && echo $name "0" >$diff.pass && return
140+
cmp -s $fileA $fileB && return
146141

147142
cp $fileA $diff-a.png
148143
cp $fileB $diff-b.png
149144

150-
# Calculate the difference metric and store the composite diff image.
151-
local hash=`compare -metric PHASH -highlight-color '#ff000050' $diff-b.png $diff-a.png $diff-diff.png 2>&1`
152-
153-
# Remove scientific notation
154-
local hash6=`printf "%.6f" $hash`
155-
local THRESHOLD6=`printf "%.6f" $THRESHOLD`
156-
157-
local isGT=`echo "$hash6 > $THRESHOLD6" | bc -l`
158-
if [ "$isGT" == "1" ]
159-
then
160-
# Add the result to results.text
161-
echo $name $hash >$diff.fail
162-
# Threshold exceeded, save the diff and the original, current
163-
cp $diff-diff.png $DIFF/$name.png
164-
cp $diff-a.png $DIFF/$name'_'$ANAME.png
165-
cp $diff-b.png $DIFF/$name'_'$BNAME.png
166-
echo
167-
echo "Test: $name"
168-
echo " PHASH value exceeds threshold: $hash > $THRESHOLD"
169-
echo " Image diff stored in $DIFF/$name.png"
170-
# $VIEWER "$diff-diff.png" "$diff-a.png" "$diff-b.png"
171-
# echo 'Hit return to process next image...'
172-
# read
173-
else
174-
echo $name $hash >$diff.pass
175-
fi
145+
# Store the composite diff image.
146+
# Add the result to results.text
147+
echo $name >$diff.fail
148+
# Threshold exceeded, save the diff and the original, current
149+
cp $diff-diff.png $DIFF/$name.png
150+
cp $diff-a.png $DIFF/$name'_'$ANAME.png
151+
cp $diff-b.png $DIFF/$name'_'$BNAME.png
152+
echo
153+
echo "Test: $name"
154+
echo " Image diff stored in $DIFF/$name.png"
155+
# $VIEWER "$diff-diff.png" "$diff-a.png" "$diff-b.png"
156+
# echo 'Hit return to process next image...'
157+
# read
176158
rm -f $diff-a.png $diff-b.png $diff-diff.png
177159
}
178160

@@ -219,18 +201,15 @@ cat $BDIR/*.fail 1>$RESULTS.fail 2>/dev/null
219201
num_fails=`cat $RESULTS.fail | wc -l`
220202
rm -f $BDIR/*.fail
221203

222-
# Sort results by PHASH
223-
sort -r -n -k 2 $RESULTS.fail >$RESULTS
224-
sort -r -n -k 2 $BDIR/*.pass 1>>$RESULTS 2>/dev/null
204+
# Sort results
205+
sort $RESULTS.fail >$RESULTS
225206

226207
# The previous cleanup approach (rm -f) triggered the error: Argument list too long.
227-
find $BDIR -name '*-temp.pass' -type f -delete
228208
rm -f $RESULTS.fail
229209

230210
echo
231211
echo Results stored in $DIFF/results.txt
232-
echo All images with a difference over threshold, $THRESHOLD, are
233-
echo available in $DIFF, sorted by perceptual hash.
212+
echo All images with a difference, are available in $DIFF.
234213
echo
235214

236215
if [ "$num_warnings" -gt 0 ]
@@ -245,5 +224,5 @@ then
245224
echo "You have $num_fails fail(s):"
246225
head -n $num_fails $RESULTS
247226
else
248-
echo "Success - All diffs under threshold!"
227+
echo "Success - No differences!"
249228
fi

0 commit comments

Comments
 (0)