From 360100402cac5c946b90afa026882304031308b9 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Fri, 13 Jan 2017 12:37:37 +0100 Subject: [PATCH] Generalize clef handling --- mei2ly.xsl | 82 ++++++++++++++++++++++++------------------ tests/clefs.mei | 94 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+), 34 deletions(-) create mode 100644 tests/clefs.mei diff --git a/mei2ly.xsl b/mei2ly.xsl index 3c41feb..6eb05b4 100644 --- a/mei2ly.xsl +++ b/mei2ly.xsl @@ -27,6 +27,27 @@ + + + + + + + + + + + + + + + + + + + \version "2.18.2" #(ly:set-option 'point-and-click #f) @@ -169,16 +190,7 @@ - - - - - - - - - - + @@ -280,10 +292,10 @@ - + - + \score { << @@ -294,7 +306,7 @@ ) - + >> \layout { @@ -366,7 +378,7 @@ - + \new StaffGroup \with { @@ -375,11 +387,11 @@ << - + >> - + \new @@ -457,16 +469,6 @@ \set tieWaitForNote = ##t - - - - - - - - - - @@ -559,7 +561,7 @@ } - + @@ -595,13 +597,25 @@ \\ + + + + - - - - - - + + + + + + + + + + + + + + @@ -641,7 +655,7 @@ - + diff --git a/tests/clefs.mei b/tests/clefs.mei new file mode 100644 index 0000000..5da9c54 --- /dev/null +++ b/tests/clefs.mei @@ -0,0 +1,94 @@ + + + + + + + + clef change tests + + + + + + # Test strategy: We assigned ascending color values to elements in the order of appearance. + # We expect the order to be the same in the output. + testcolors=$(egrep -o 'rgb-color[^)]+' "$ly" | egrep --color=never -o '[0-9.].+') + # Clefs are flagged with a trailing 255 blue value (1 in lilypond) + cleftestcolors=$(echo "$testcolors" | grep --color=never '1$') + if echo "$cleftestcolors" | sort | uniq --count | egrep -v '^\s*1' > /dev/null + then + echo "At least one clef was output twice" + exit 1 + fi + if [ $( echo "$cleftestcolors" | wc -l ) -ne 8 ] + then + echo "Number of output clefs does not match number of defined clefs" + exit 1 + fi + if [ "$testcolors" != "$( echo "$testcolors" | sort )" ] + then + echo "At least one clef was output in the wrong place" + exit 1 + fi + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
\ No newline at end of file