]> git.donarmstrong.com Git - lilypond.git/blob - input/regression/display-lily-tests.ly
Doc-fr: update for 2.16.1 (second part)
[lilypond.git] / input / regression / display-lily-tests.ly
1 \version "2.16.0"
2 #(use-modules (srfi srfi-13)
3               (ice-9 format))
4
5 %%%
6 %%% Testing utilities
7 %%%
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
12                       (lambda (out)
13                         (do ((c (read-char port) (read-char port)))
14                             ((and (char=? c #\#)
15                                   (char=? (peek-char port) #\]))
16                              (read-char port))
17                           (display c out))))))
18     `(let* ((parser-clone (ly:parser-clone parser))
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 parser-clone))))
22        (cons input-str result-str))))
23
24 #(read-hash-extend #\[ parse-lily-and-compute-lily-string) %{ ] %}
25
26 #(define (lily-string->markup str)
27    (make-column-markup (string-split str #\NewLine)))
28
29 test =
30 #(define-void-function (parser location harmless strings)
31   ((string?) pair?)
32   (let ((input (car strings))
33         (output (cdr strings))
34         (result-info (or harmless "BUG")))
35    (if (not (equal? input output))
36     (if harmless
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"
40       input output)))))
41
42 %%%
43 %%% Tests
44 %%%
45 \header {
46   texidoc = "This is a test of the display-lily-music unit. Problems are reported on the
47 stderr of this run." 
48 }
49
50 %% Sequential music
51 \test ##[ { { a b } { c d } } #]                % SequentialMusic
52 \test ##[ << { a b } { c d } >> #]              % SimultaneousMusic
53 \test ##[ << { a b } \\ { c d } >> #]           % VoiceSeparator
54
55 %% Chords and Notes
56 \test ##[ { ceses ces c cis cisis } #]          % NoteEvent
57 \test ##[ { deses des d dis disis } #]
58 \test ##[ { eeses ees e eis eisis } #]
59 \test ##[ { feses fes f fis fisis } #]
60 \test ##[ { geses ges g gis gisis } #]
61 \test ##[ { aeses aes a ais aisis } #]
62 \test ##[ { beses bes b bis bisis } #]
63 \test ##[ { c,, d' } #]
64 \test ##[ { c' d'=' } #]
65 \test ##[ { c! c? } #]
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
74
75 %% tags
76 \test ##[ { \tag #'foo { c4 d } } #]
77 \test ##[ c-\tag #'foo -\tag #'baz -^-. #]
78
79 %% Graces
80 \test ##[ { \grace c8 d2 } #]                           % GraceMusic
81 \test ##[ { \appoggiatura c8 d2 } #]
82 \test ##[ { \acciaccatura c8 d2 } #]
83 \test ##[ { c1 \afterGrace { b,16 c } d2 } #]
84
85 %% Clusters
86 \test ##[ { \makeClusters { c4 g } } #]                 % ClusterNoteEvent
87
88 %% Figured bass
89 \test ##[ \figures { < 6 > } #]                         % BassFigureEvent
90 \test ##[ \figuremode { < 1-- 3- > < 2+ 4++ > < _! 7! > } #]
91 \test ##[ \figuremode { < [6 > < 5] > } #]
92
93 %% Lyrics
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
99 \test ##[ { { c d }
100   \addlyrics { bla bla  } } #]
101
102 %% Drums
103 \test ##[ \drums { hihat } #]
104 \test ##[ \drummode { hihat4.*3/4 } #]
105
106 %% Expressive marks
107 \test ##[ c4 ~ #]                                       % TieEvent
108 \test ##[ c\noBeam #]                                   % BeamForbidEvent
109 \test ##[ c\1 #]                                        % StringNumberEvent
110 \test ##[ { c: c:1 } #]                                 % TremoloEvent
111 \test ##[ { c-^ c^^ c_^ } #]                            % ArticulationEvent
112 \test ##[ { c-+ c^+ c_+ } #]
113 \test ##[ { c-- c^- c_- } #]
114 \test ##[ { c-| c^| c_| } #]
115 \test ##[ { c-> c^> c_> } #]
116 \test ##[ { c-. c^. c_. } #]
117 \test ##[ { c-_ c^_ c__ } #]
118 \test ##[ { c\trill c^\trill c_\trill } #]
119 \test ##[ { c-1 c^2 c_3 } #]                            % FingerEvent
120 \test ##[ { c-"foo" c^"foo" c_"foo" } #]                % TextScriptEvent
121 \test ##[ { R1*4-"foo" R^"foo" R_"foo" } #]             % MultiMeasureTextEvent
122 \test ##[ { < c\harmonic >4 < c e\harmonic > } #]       % HarmonicEvent
123 \test ##[ { c\glissando c^\glissando c_\glissando } #]  % GlissandoEvent
124 \test ##[ { c\arpeggio c^\arpeggio c_\arpeggio } #]     % ArpeggioEvent
125 \test ##[ { c\p c^\ff c_\sfz } #]                       % AbsoluteDynamicEvent
126 \test ##[ { c[ c] c^[ c^] c_[ c_] } #]                  % BeamEvent
127 \test ##[ { c( c) c^( c^) c_( c_) } #]                  % SlurEvent
128 \test ##[ { c\< c\! c^\< c^\! c_\< c_\! } #]            % CrescendoEvent
129 \test ##[ { c\> c\! c^\> c^\! c_\> c_\! } #]            % DecrescendoEvent
130 \test ##[ { c\episemInitium c\episemFinis } #]          % EpisemaEvent
131 \test ##[ { c\( c\) c^\( c^\) c_\( c_\) } #]            % PhrasingSlurEvent
132 \test ##[ { c\sustainOn c\sustainOff } #]               % SustainEvent
133 \test ##[ { c\sostenutoOn c\sostenutoOff } #]           % SostenutoEvent
134 \test ##[ \melisma #]
135 \test ##[ \melismaEnd #]
136 \test ##[ { c\startTextSpan c\stopTextSpan } #]         % TextSpanEvent
137 \test ##[ { c\startTrillSpan c\stopTrillSpan } #]       % TrillSpanEvent
138 \test ##[ { c \startStaff c \stopStaff } #]             % StaffSpanEvent
139 \test ##[ { c\startGroup c\stopGroup c^\startGroup c^\stopGroup c_\startGroup c_\stopGroup } #]    % NoteGroupingEvent
140 \test ##[ { c\unaCorda c\treCorde } #]                  % UnaCordaEvent
141 \test ##[ \breathe #]
142 \test ##[ { c \[ c \] } #]                      % LigatureEvent
143 \test ##[ \~ #]                                         % PesOrFlexaEvent
144 \test ##[ c\bendAfter #3 #]    % BendAfterEvent
145 \test ##[ c\rightHandFinger #1 #]    % StrokeFingerEvent
146
147 \test ##[ \break #]
148 \test ##[ \noBreak #]
149 \test ##[ \pageBreak #]
150 \test ##[ \noPageBreak #]
151 \test ##[ \pageTurn #]
152 \test ##[ \noPageTurn #]
153
154 %% Checks
155 \test ##[ \octaveCheck a' #]                            % RelativeOctaveCheck
156 \test ##[ | #]                                          % BarCheck
157
158 %% Marks
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" #]
165
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 "alto_3" #]
172 \test ##[ \time 2/4 #]
173 \test ##[ \time #'(3 2) 5/8 #]
174 \test ##[ \bar "|." #]
175
176 %% staff switches
177 \test ##[ \autochange { c d } #]                        % AutoChangeMusic
178 \test ##[ { \change Staff = "up" { c d } } #]           % ContextChange
179
180 %% Tuplets
181 \test ##[ \times 2/3 { c8 d e } #]                              % TimeScaledMusic
182 \test ##[ \times 4/6 { c16 d e f g a } #]
183 \test ##[ \times 2/3 { c d e \times 2/5 { f e d2 d4 } c } #]
184 %}
185 %% \relative and \tranpose
186 \test #"NOT A BUG" ##[ \relative c' { c b } #]  % RelativeOctaveMusic
187 \test #"NOT A BUG" ##[ \transpose c d { c d } #]        % TransposedMusic
188 %}
189 %% Repeats
190 \test ##[ \repeat volta 2 { c d } #]            % VoltaRepeatedMusic
191 \test ##[ \repeat unfold 2 { c d } #]                   % UnfoldedRepeatedMusic
192 \test ##[ \repeat percent 2 { c d } #]                  % PercentRepeatedMusic
193 \test ##[ \repeat tremolo 4 { c16 d } #]                % TremoloRepeatedMusic
194 \test ##[ \repeat tremolo 7 { c''32 b' } #]
195 \test ##[ \repeat tremolo 15 { c''16 b' } #]
196 \test ##[ \repeat volta 2 { c4 d } \alternative { { c d } { e f } } #]    % 
197
198 %% Context creation
199 \test ##[ \new Staff { c d } #]                         % ContextSpeccedMusic
200 \test ##[ \new Staff = "up" { c d } #]                          % ContextSpeccedMusic
201 \test ##[ \context Staff { c d } #]
202 \test ##[ \context Staff = "up" { c d } #]
203 \test ##[
204 \new Staff \with {
205   \consists "Timing_engraver"
206   \remove "Clef_engraver"
207 } { c d } #]
208 %% Context properties
209 \test ##[ \once \set Score . skipBars = ##t #]          % PropertySet
210 \test ##[ \set autoBeaming = ##f #]
211 \test ##[ \unset Score . skipBars #]            % PropertyUnset
212 \test ##[ \unset autoBeaming #]
213 %% Layout properties
214 \test ##[ \override Staff . Stem #'thickness = #4.0 #]          % OverrideProperty
215 \test ##[ \once \override Beam #'beam-thickness = #0.6 #]
216 \test ##[ \revert Staff . Stem #'thickness #]           % RevertProperty
217 \test ##[ \revert Beam #'beam-thickness #]
218 \test "NOT A BUG" ##[ \oneVoice #]      % resetting a bunch of properties
219 \test ##[ \override StaffGrouper #'(staff-staff-spacing basic-distance) = #7 #]    % nested properties
220 \test ##[ \revert StaffGrouper #'(staff-staff-spacing basic-distance) #]    % nested properties
221
222 %% \applyOutput
223 \test ##[ \applyOutput #'Foo #(lambda (arg) (list)) #]
224 %% \applyContext
225 \test ##[ \applyContext #(lambda (arg) (list)) #]
226
227 %% \partial
228 \test ##[ \partial 2 #]
229 \test ##[ \partial 8. #]
230 \test ##[ \partial 4*2/3 #]
231
232 %% \partcombine
233 \test ##[ \partcombine { c e }
234 { d f } #]                                              % PartCombineMusic UnrelativableMusic
235
236 %% Cue notes
237 \test ##[ \cueDuring #"foo" #1 { c d } #]
238 \test ##[ \quoteDuring #"foo" { c d } #]
239
240 %% \ottava
241 \test ##[ \ottava #1 #]    % OttavaMusic
242
243 %% \tweak
244 \test ##[ < \tweak #'duration-log #2 c > #]
245 \test ##[ < c \tweak #'transparent ##t e > #]
246 \test ##[ < \tweak #'color #'(1.0 0.0 0.0) \tweak #'duration-log #2 c > #]
247 \test ##[ c-\tweak #'font-size #3 -> #]
248 \test ##[ < \tweak Accidental #'color #'(1.0 0.0 0.0) cis eis g > #]
249
250 %% end test.
251
252 #(read-hash-extend #\[ #f) %{ ] %}