2 #(use-modules (srfi srfi-13)
8 #(use-modules (scm display-lily))
9 #(memoize-clef-names supported-clefs)
10 #(define (parse-lily-and-compute-lily-string chr port)
11 (let ((lily-string (call-with-output-string
13 (do ((c (read-char port) (read-char port)))
15 (char=? (peek-char port) #\]))
18 `(let* ((parser-clone (ly:parser-clone))
19 (input-str (string-trim-both ,lily-string))
20 (music (ly:parse-string-expression parser-clone input-str))
21 (result-str (string-trim-both (music->lily-string music))))
22 (cons input-str result-str))))
24 #(read-hash-extend #\[ parse-lily-and-compute-lily-string) %{ ] %}
26 #(define (lily-string->markup str)
27 (make-column-markup (string-split str #\NewLine)))
30 #(define-void-function (harmless strings)
32 (let ((input (car strings))
33 (output (cdr strings))
34 (result-info (or harmless "BUG")))
35 (if (not (equal? input output))
37 (ly:progress "Test unequal: ~a.\nin = ~a\nout = ~a\n"
38 harmless input output)
39 (ly:input-warning (*location*) "Test unequal: BUG.\nin = ~a\nout = ~a\n"
46 texidoc = "This is a test of the display-lily-music unit. Problems are reported on the
51 \test ##[ { { a4 b4 } { c4 d4 } } #] % SequentialMusic
52 \test ##[ << { a4 b4 } { c4 d4 } >> #] % SimultaneousMusic
53 \test ##[ << { a4 b4 } \\ { c4 d4 } >> #] % VoiceSeparator
56 \test ##[ { ceses4 ces4 c4 cis4 cisis4 } #] % NoteEvent
57 \test ##[ { deses4 des4 d4 dis4 disis4 } #]
58 \test ##[ { eeses4 ees4 e4 eis4 eisis4 } #]
59 \test ##[ { feses4 fes4 f4 fis4 fisis4 } #]
60 \test ##[ { geses4 ges4 g4 gis4 gisis4 } #]
61 \test ##[ { aeses4 aes4 a4 ais4 aisis4 } #]
62 \test ##[ { beses4 bes4 b4 bis4 bisis4 } #]
63 \test ##[ { c,,4 d'4 } #]
64 \test ##[ { c'4 d'='4 } #]
65 \test ##[ { c!4 c?4 } #]
66 \test ##[ r1.*4/3 #] % RestEvent
67 \test ##[ c1\rest #] % RestEvent
68 \test ##[ s2..*3/4 #] % SkipEvent
69 \test ##[ R1.*2/3 #] % MultiMeasureRestMusicGroup, MultiMeasureRestEvent
70 \test ##[ \skip 2.*3/4 #] % SkipMusic
71 \test ##[ < c\1 e\3 >4.*3/4-. #] % EventChord, NoteEvent, StringNumberEvent, ArticulationEvent
72 \test ##[ < c-1\4 >8 #]
73 \test ##[ { < c e g c' >4 q8-. } #] % RepeatedChord
76 \test ##[ { \tag #'foo { c4 d4 } } #]
77 \test ##[ c4-\tag #'foo -\tag #'baz -^-. #]
80 \test ##[ { \grace c8 d2 } #] % GraceMusic
81 \test ##[ { \appoggiatura c8 d2 } #]
82 \test ##[ { \acciaccatura c8 d2 } #]
83 \test ##[ { c1 \afterGrace { b,16 c16 } d2 } #]
86 \test ##[ { \makeClusters { c4 g4 } } #] % ClusterNoteEvent
89 \test ##[ \figures { < 6 >4 } #] % BassFigureEvent
90 \test ##[ \figuremode { < 1-- 3- >4 < 2+ 4++ >4 < _! 7! >4 } #]
91 \test ##[ \figuremode { < [6 >4 < 5] >4 } #]
94 \test ##[ \lyrics { a b } #]
95 \test ##[ \lyricmode { a -- b } #] % HyphenEvent
96 \test ##[ \lyricmode { a __ b } #] % ExtenderEvent
97 \test ##[ \lyricmode { "a " } #] % LyricEvent
98 \test ##[ \lyricsto "foo" { bla bla } #] % LyricCombineMusic
100 \addlyrics { bla bla } } #]
103 \test ##[ \drums { hihat4 } #]
104 \test ##[ \drummode { hihat4.*3/4 } #]
107 \test ##[ c4 ~ #] % TieEvent
108 \test ##[ c4\noBeam #] % BeamForbidEvent
109 \test ##[ c4\1 #] % StringNumberEvent
110 \test ##[ { c4:8 c4:1 } #] % TremoloEvent
111 \test ##[ { c4-^ c4^^ c4_^ } #] % ArticulationEvent
112 \test ##[ { c4-+ c4^+ c4_+ } #]
113 \test ##[ { c4-- c4^- c4_- } #]
114 \test ##[ { c4-! c4^! c4_! } #]
115 \test ##[ { c4-> c4^> c4_> } #]
116 \test ##[ { c4-. c4^. c4_. } #]
117 \test ##[ { c4-_ c4^_ c4__ } #]
118 \test ##[ { c4\trill c4^\trill c4_\trill } #]
119 \test ##[ { c4-1 c4^2 c4_3 } #] % FingerEvent
120 \test ##[ { c4-"foo" c4^"foo" c4_"foo" } #] % TextScriptEvent
121 \test ##[ { R1*4-"foo" R1*4^"foo" R1*4_"foo" } #] % MultiMeasureTextEvent
122 \test ##[ { < c\harmonic >4 < c e\harmonic >4 } #] % HarmonicEvent
123 \test ##[ { c4\glissando c4^\glissando c4_\glissando } #] % GlissandoEvent
124 \test ##[ { c4\arpeggio c4^\arpeggio c4_\arpeggio } #] % ArpeggioEvent
125 \test ##[ { c4\p c4^\ff c4_\sfz } #] % AbsoluteDynamicEvent
126 \test ##[ { c4[ c4] c4^[ c4^] c4_[ c4_] } #] % BeamEvent
127 \test ##[ { c4( c4) c4^( c4^) c4_( c4_) } #] % SlurEvent
128 \test ##[ { c4\< c4\! c4^\< c4^\! c4_\< c4_\! } #] % CrescendoEvent
129 \test ##[ { c4\> c4\! c4^\> c4^\! c4_\> c4_\! } #] % DecrescendoEvent
130 \test ##[ { c4\episemInitium c4\episemFinis } #] % EpisemaEvent
131 \test ##[ { c4\( c4\) c4^\( c4^\) c4_\( c4_\) } #] % PhrasingSlurEvent
132 \test ##[ { c4\sustainOn c4\sustainOff } #] % SustainEvent
133 \test ##[ { c4\sostenutoOn c4\sostenutoOff } #] % SostenutoEvent
134 \test ##[ \melisma #]
135 \test ##[ \melismaEnd #]
136 \test ##[ { c4\startTextSpan c4\stopTextSpan } #] % TextSpanEvent
137 \test ##[ { c4\startTrillSpan c4\stopTrillSpan } #] % TrillSpanEvent
138 \test ##[ { c4 \startStaff c4 \stopStaff } #] % StaffSpanEvent
139 \test ##[ { c4\startGroup c4\stopGroup c4^\startGroup c4^\stopGroup c4_\startGroup c4_\stopGroup } #] % NoteGroupingEvent
140 \test ##[ { c4\unaCorda c4\treCorde } #] % UnaCordaEvent
141 \test ##[ \breathe #]
142 \test ##[ { c4 \[ c4 \] } #] % LigatureEvent
143 \test ##[ \~ #] % PesOrFlexaEvent
144 \test ##[ c4\bendAfter #3 #] % BendAfterEvent
145 \test ##[ c4\rightHandFinger #1 #] % StrokeFingerEvent
148 \test ##[ \noBreak #]
149 \test ##[ \pageBreak #]
150 \test ##[ \noPageBreak #]
151 \test ##[ \pageTurn #]
152 \test ##[ \noPageTurn #]
155 \test ##[ \octaveCheck a' #] % RelativeOctaveCheck
156 \test ##[ | #] % BarCheck
159 \test ##[ \mark \default #] % MarkEvent
160 \test ##[ \mark "Allegro" #]
161 \test ##[ \tempo 4 = 120 #] % MetronomeChangeEvent
162 \test ##[ \tempo 4 = 108 - 116 #]
163 \test ##[ \tempo "Allegro" 4 = 132 #]
164 \test ##[ \tempo "Andante" #]
166 %% key, time, clef, bar
167 \test ##[ \key \default #] % KeyChangeEvent
168 \test ##[ \key e \minor #]
169 \test ##[ \clef "bass" #]
170 \test ##[ \clef "french^2" #]
171 \test ##[ \clef "treble_[8]" #]
172 \test ##[ \clef "bass^(15)" #]
173 \test ##[ \clef "alto_3" #]
174 \test ##[ \time 2/4 #]
175 \test ##[ \time 3,2 5/8 #]
176 \test ##[ \bar "|." #]
179 \test ##[ \autochange { c4 d4 } #] % AutoChangeMusic
180 \test ##[ { \change Staff = "up" { c4 d4 } } #] % ContextChange
183 \test ##[ \tuplet 3/2 { c8 d8 e8 } #] % TimeScaledMusic
184 \test ##[ \tuplet 6/4 { c16 d16 e16 f16 g16 a16 } #]
185 \test ##[ \tuplet 3/2 { c4 d4 e4 \tuplet 5/2 { f4 e4 d2 d4 } c4 } #]
186 \test ##[ \tuplet 3/2 2 { c4 d4 e4 \tuplet 5/2 2 { f4 e4 d2 d4 } c4 } #]
189 \test ##[ { 4 4 8 \tuplet 3/2 { 8[ 16] } 16 } #]
191 %% \relative and \tranpose
192 \test #"NOT A BUG" ##[ \relative { c'4 b4 } #] % RelativeOctaveMusic
193 \test #"NOT A BUG" ##[ \transpose c d { c4 d4 } #] % TransposedMusic
196 \test ##[ \repeat volta 2 { c4 d4 } #] % VoltaRepeatedMusic
197 \test ##[ \repeat unfold 2 { c4 d4 } #] % UnfoldedRepeatedMusic
198 \test ##[ \repeat percent 2 { c4 d4 } #] % PercentRepeatedMusic
199 \test ##[ \repeat tremolo 4 { c16 d16 } #] % TremoloRepeatedMusic
200 \test ##[ \repeat tremolo 7 { c''32 b'32 } #]
201 \test ##[ \repeat tremolo 15 { c''16 b'16 } #]
202 \test ##[ \repeat volta 2 { c4 d4 } \alternative { { c4 d4 } { e4 f4 } } #] %
205 \test ##[ \new Staff { c4 d4 } #] % ContextSpeccedMusic
206 \test ##[ \new Staff = "up" { c4 d4 } #] % ContextSpeccedMusic
207 \test ##[ \context Staff { c4 d4 } #]
208 \test ##[ \context Staff = "up" { c4 d4 } #]
211 \consists "Timing_engraver"
212 \remove "Clef_engraver"
214 %% Context properties
215 \test ##[ \once \set Score . skipBars = ##t #] % PropertySet
216 \test ##[ \set autoBeaming = ##f #]
217 \test ##[ \unset Score . skipBars #] % PropertyUnset
218 \test ##[ \unset autoBeaming #]
220 \test ##[ \override Staff.Stem.thickness = #4.0 #] % OverrideProperty
221 \test ##[ \once \override Beam.beam-thickness = #0.6 #]
222 \test ##[ \revert Staff.Stem.thickness #] % RevertProperty
223 \test ##[ \revert Beam.beam-thickness #]
224 \test "NOT A BUG" ##[ \oneVoice #] % resetting a bunch of properties
225 \test ##[ \override StaffGrouper.staff-staff-spacing.basic-distance = #7 #] % nested properties
226 \test ##[ \revert StaffGrouper.staff-staff-spacing.basic-distance #] % nested properties
229 \test ##[ \applyOutput Foo #(lambda (arg) (list)) #]
230 \test ##[ \applyOutput Foo.NoteHead #(lambda (arg) (list)) #]
232 \test ##[ \applyContext #(lambda (arg) (list)) #]
235 \test ##[ \partial 2 #]
236 \test ##[ \partial 8. #]
237 \test ##[ \partial 4*2/3 #]
240 \test ##[ \partcombine { c4 e4 }
242 \test ##[ \partcombineUp { c2 e2 }
244 \test ##[ \partcombineDown { c1 e1 }
248 \test ##[ \cueDuring #"foo" #1 { c4 d4 } #]
249 \test ##[ \quoteDuring #"foo" { c4 d4 } #]
252 \test ##[ \ottava #1 #] % OttavaMusic
255 \test ##[ < \tweak duration-log #2 c >4 #]
256 \test ##[ < c \tweak transparent ##t e >4 #]
257 \test ##[ < \tweak color #'(1.0 0.0 0.0) \tweak duration-log #2 c >4 #]
258 \test ##[ c4-\tweak font-size #3 -> #]
259 \test ##[ < \tweak Accidental.color #'(1.0 0.0 0.0) cis eis g >4 #]
263 #(read-hash-extend #\[ #f) %{ ] %}