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 parser))
19 (input-str (string-trim-both ,lily-string))
20 (music (car (ly:music-property (parse-string-result input-str
23 (result-str (string-trim-both (music->lily-string music parser-clone))))
24 (cons input-str result-str))))
26 #(read-hash-extend #\[ parse-lily-and-compute-lily-string) %{ ] %}
28 #(define (lily-string->markup str)
29 (make-column-markup (string-split str #\NewLine)))
31 #(define test-function
32 (let ((test-number 0))
33 (lambda (parser location result-info strings)
34 (let ((input (car strings))
35 (output (cdr strings)))
36 (set! test-number (1+ test-number))
37 (if (not (equal? input output))
38 (ly:progress "Test ~a unequal: ~a. \nin = ~a\nout = ~a\n"
43 (make-music 'SequentialMusic 'void #t)))))
46 #(define-music-function (parser location result-info strings) (string? pair?)
47 (test-function parser location result-info strings))
53 texidoc = "This is a test of the display-lily-music unit. Problems are reported on the
58 \test "" ##[ { { a b } { c d } } #] % SequentialMusic
59 \test "" ##[ << { a b } { c d } >> #] % SimultaneousMusic
60 \test "" ##[ << { a b } \\ { c d } >> #] % VoiceSeparator
63 \test "" ##[ { ceses ces c cis cisis } #] % NoteEvent
64 \test "" ##[ { deses des d dis disis } #]
65 \test "" ##[ { eeses ees e eis eisis } #]
66 \test "" ##[ { feses fes f fis fisis } #]
67 \test "" ##[ { geses ges g gis gisis } #]
68 \test "" ##[ { aeses aes a ais aisis } #]
69 \test "" ##[ { beses bes b bis bisis } #]
70 \test "" ##[ { c,, d' } #]
71 \test "" ##[ { c' d'=' } #]
72 \test "" ##[ { c! c? } #]
73 \test "" ##[ r1.*4/3 #] % RestEvent
74 \test "" ##[ c1\rest #] % RestEvent
75 \test "" ##[ s2..*3/4 #] % SkipEvent
76 \test "" ##[ R1.*2/3 #] % MultiMeasureRestMusicGroup, MultiMeasureRestEvent
77 \test "" ##[ \skip 2.*3/4 #] % SkipMusic
78 \test "" ##[ < c\1 e\3 >4.*3/4-. #] % EventChord, NoteEvent, StringNumberEvent, ArticulationEvent
81 \test "" ##[ { \tag #'foo { c4 d } } #]
82 \test "" ##[ c-\tag #'foo -\tag #'baz -^ -. #]
85 \test "" ##[ { \grace c8 d2 } #] % GraceMusic
86 \test "" ##[ { \appoggiatura c8 d2 } #]
87 \test "" ##[ { \acciaccatura c8 d2 } #]
88 \test "" ##[ { c1 \afterGrace { b,16 c } d2 } #]
91 \test "" ##[ { \makeClusters { c4 g } } #] % ClusterNoteEvent
94 \test "" ##[ \figures { < 6 > } #] % BassFigureEvent
95 \test "" ##[ \figuremode { < 1-- 3- > < 2+ 4++ > < _! 7! > } #]
96 \test "" ##[ \figuremode { < [6 > < 5] > } #]
99 \test "" ##[ \lyrics { a b } #]
100 \test "" ##[ \lyricmode { a -- b } #] % HyphenEvent
101 \test "" ##[ \lyricmode { a __ b } #] % ExtenderEvent
102 \test "" ##[ \lyricmode { "a " } #] % LyricEvent
103 \test "" ##[ \lyricsto "foo" { bla bla } #] % LyricCombineMusic
104 \test "" ##[ { { c d }
105 \addlyrics { bla bla } } #]
108 \test "" ##[ \drums { hihat } #]
109 \test "" ##[ \drummode { hihat4.*3/4 } #]
112 \test "" ##[ c4 ~ #] % TieEvent
113 \test "" ##[ c\noBeam #] % BeamForbidEvent
114 \test "" ##[ c\1 #] % StringNumberEvent
115 \test "" ##[ { c: c:1 } #] % TremoloEvent
116 \test "" ##[ { c-^ c^^ c_^ } #] % ArticulationEvent
117 \test "" ##[ { c-+ c^+ c_+ } #]
118 \test "" ##[ { c-- c^- c_- } #]
119 \test "" ##[ { c-| c^| c_| } #]
120 \test "" ##[ { c-> c^> c_> } #]
121 \test "" ##[ { c-. c^. c_. } #]
122 \test "" ##[ { c-_ c^_ c__ } #]
123 \test "" ##[ { c-\trill c^\trill c_\trill } #]
124 \test "" ##[ { c-1 c^2 c_3 } #] % FingerEvent
125 \test "" ##[ { c-"foo" c^"foo" c_"foo" } #] % TextScriptEvent
126 \test "" ##[ { R1*4-"foo" R^"foo" R_"foo" } #] % MultiMeasureTextEvent
127 \test "" ##[ { c4-\harmonic c^\harmonic c_\harmonic } #] % HarmonicEvent
128 \test "" ##[ { c-\glissando c^\glissando c_\glissando } #] % GlissandoEvent
129 \test "" ##[ { c-\arpeggio c^\arpeggio c_\arpeggio } #] % ArpeggioEvent
130 \test "" ##[ { c\p c^\ff c_\sfz } #] % AbsoluteDynamicEvent
131 \test "" ##[ { c[ c] c^[ c^] c_[ c_] } #] % BeamEvent
132 \test "" ##[ { c( c) c^( c^) c_( c_) } #] % SlurEvent
133 \test "" ##[ { c\< c\! c^\< c^\! c_\< c_\! } #] % CrescendoEvent
134 \test "" ##[ { c\> c\! c^\> c^\! c_\> c_\! } #] % DecrescendoEvent
135 \test "" ##[ { c\( c\) c^\( c^\) c_\( c_\) } #] % PhrasingSlurEvent
136 \test "" ##[ { c\sustainDown c\sustainUp } #] % SustainEvent
137 \test "" ##[ { c\sostenutoDown c\sostenutoUp } #] % SostenutoEvent
138 \test "" ##[ \melisma #]
139 \test "" ##[ \melismaEnd #]
140 \test "" ##[ { c\startTextSpan c\stopTextSpan } #] % TextSpanEvent
141 \test "" ##[ { c\startTrillSpan c\stopTrillSpan } #] % TrillSpanEvent
142 \test "" ##[ { c \startStaff c \stopStaff } #] % StaffSpanEvent
143 \test "" ##[ { c\startGroup c\stopGroup c^\startGroup c^\stopGroup c_\startGroup c_\stopGroup } #] % NoteGroupingEvent
144 \test "" ##[ { c\unaCorda c\treCorde } #] % UnaCordaEvent
145 \test "" ##[ \breathe #]
146 \test "" ##[ { c \[ c \] } #] % LigatureEvent
147 \test "" ##[ \~ #] % PesOrFlexaEvent
149 \test "" ##[ \break #]
150 \test "" ##[ \noBreak #]
151 \test "" ##[ \pageBreak #]
152 \test "" ##[ \noPageBreak #]
153 \test "" ##[ \pageTurn #]
154 \test "" ##[ \noPageTurn #]
157 \test "" ##[ \octave a' #] % RelativeOctaveCheck
158 \test "" ##[ | #] % BarCheck
161 \test "" ##[ \mark \default #] % MarkEvent
162 \test "" ##[ \mark "Allegro" #]
163 \test "" ##[ \tempo 4 = 120 #] % MetronomeChangeEvent
165 %% key, time, clef, bar
166 \test "" ##[ \key \default #] % KeyChangeEvent
167 \test "" ##[ \key e \minor #]
168 \test "" ##[ \clef "bass" #]
169 \test "" ##[ \clef "french^2" #]
170 \test "" ##[ \clef "alto_3" #]
171 \test "" ##[ \time 2/4 #]
172 \test "" ##[ #(set-time-signature 5 8 '(3 2)) #]
173 \test "" ##[ \bar "|." #]
176 \test "" ##[ \autochange { c d } #] % AutoChangeMusic
177 \test "" ##[ { \change Staff = "up" { c d } } #] % ContextChange
180 \test "" ##[ \times 2/3 { c8 d e } #] % TimeScaledMusic
181 \test "" ##[ \times 4/6 { c16 d e f g a } #]
183 %% \relative and \tranpose
184 \test #"NOT A BUG" ##[ \relative c' { c b } #] % RelativeOctaveMusic
185 \test #"NOT A BUG" ##[ \transpose c d { c d } #] % TransposedMusic
188 \test "" ##[ \repeat volta 2 { c d } #] % VoltaRepeatedMusic
189 \test "" ##[ \repeat unfold 2 { c d } #] % UnfoldedRepeatedMusic
190 \test "" ##[ \repeat percent 2 { c d } #] % PercentRepeatedMusic
191 \test "" ##[ \repeat tremolo 4 { c16 d } #] % TremoloRepeatedMusic
192 \test "" ##[ \repeat volta 2 { c4 d } \alternative { { c d } { e f } } #] %
195 \test "" ##[ \new Staff { c d } #] % ContextSpeccedMusic
196 \test "" ##[ \new Staff = "up" { c d } #] % ContextSpeccedMusic
197 \test "" ##[ \context Staff { c d } #]
198 \test "" ##[ \context Staff = "up" { c d } #]
201 \consists "Timing_engraver"
202 \remove "Clef_engraver"
204 %% Context properties
205 \test "" ##[ \once \set Score . skipBars = ##t #] % PropertySet
206 \test "" ##[ \set autoBeaming = ##f #]
207 \test "" ##[ \unset Score . skipBars #] % PropertyUnset
208 \test "" ##[ \unset autoBeaming #]
210 \test "" ##[ \override Staff . Stem #'thickness = #4.0 #] % OverrideProperty
211 \test "" ##[ \once \override Beam #'thickness = #0.6 #]
212 \test "" ##[ \revert Staff . Stem #'thickness #] % RevertProperty
213 \test "" ##[ \revert Beam #'thickness #]
216 \test "" ##[ \applyOutput #'Foo #(lambda (arg) (list)) #]
218 \test "" ##[ \applyContext #(lambda (arg) (list)) #]
221 \test "" ##[ \partial 2 #]
222 \test "" ##[ \partial 8. #]
223 \test #"TODO? exotic durations in \\partial" ##[ \partial 4*2/3 #]
226 \test "" ##[ \partcombine { c e }
227 { d f } #] % PartCombineMusic UnrelativableMusic
230 \test "" ##[ \cueDuring #"foo" #1 { c d } #]
231 \test "" ##[ \quoteDuring #"foo" { c d } #]
236 #(read-hash-extend #\[ #f) %{ ] %}