]> git.donarmstrong.com Git - lilypond.git/blob - input/regression/musicxml/book-musicxml-testsuite.py
MusicXML test suite: use custom py formatter for MusicXML files
[lilypond.git] / input / regression / musicxml / book-musicxml-testsuite.py
1 # -*- coding: utf-8 -*-
2
3 import book_base as BookBase
4 import book_texinfo as BookTexinfo
5 import book_snippets as BookSnippet
6 import lilylib as ly
7
8 MusicXMLOutputImage = r'''@noindent
9 @ifinfo
10 @image{%(info_image_path)s,,,%(alt)s,%(ext)s}
11 @end ifinfo
12 @html
13 <p>
14  <a href="%(base)s%(ext)s">
15   <img align="middle" border="0" src="%(image)s" alt="%(alt)s">
16  </a>
17 </p>
18 @end html
19 '''
20
21 MusicXMLOutput = r'''
22 @iftex
23 @include %(base)s-systems.texi
24 @end iftex
25 '''
26
27 MusicXMLPrintFilename = r'''
28 @html
29 <a href="%(base)s%(ext)s">
30 @end html
31 @file{%(filename)s}
32 @html
33 </a>
34 @end html
35 '''
36
37
38
39
40 class BookMusicXML (BookTexinfo.BookTexinfoOutputFormat):
41     def __init__ (self):
42         BookTexinfo.BookTexinfoOutputFormat.__init__ (self)
43         self.format = "MusicXMLTest"
44         self.output[BookBase.OUTPUTIMAGE] = MusicXMLOutputImage
45         self.output[BookBase.OUTPUT] = MusicXMLOutput
46         self.output[BookBase.PRINTFILENAME] = MusicXMLPrintFilename
47     def snippet_class (self, type):
48       if type == "musicxml_file":
49           return MusicXMLTestSuiteSnippet
50       else:
51           return BookSnippet.snippet_type_to_class.get (type, BookSnippet.Snippet)
52     def snippet_output (self, basename, snippet):
53         return BookTexinfo.BookTexinfoOutputFormat.snippet_output (self, basename, snippet)
54
55
56 class MusicXMLTestSuiteSnippet (BookSnippet.MusicXMLFileSnippet):
57     def __init__ (self, type, match, formatter, line_number, global_options):
58         BookSnippet.MusicXMLFileSnippet.__init__ (self, type, match, formatter, line_number, global_options)
59
60 ## TODO: Customize output with renderings from other MusicXML-supporting
61 #        applications. Also add some link to the intermediate .ly file
62
63
64 BookBase.register_format (BookMusicXML ());