Esempio n. 1
0
 def _test_clean_add_style(self, version=2):
     tmp = helper.get_tmpfile_path("simple.mscx", version)
     mscxyz.execute([
         "clean", "--style",
         helper.get_tmpfile_path("style.mss", version), tmp
     ])
     style = helper.read_file(tmp)
     self.assertTrue("<staffUpperBorder>77</staffUpperBorder>" in style)
Esempio n. 2
0
    def test_property_version(self):
        tree = MscoreXmlTree(helper.get_tmpfile_path("simple.mscx", version=2))
        self.assertEqual(tree.version, 2.06)
        self.assertEqual(tree.version_major, 2)

        tree = MscoreXmlTree(helper.get_tmpfile_path("simple.mscx", version=3))
        self.assertEqual(tree.version, 3.01)
        self.assertEqual(tree.version_major, 3)
Esempio n. 3
0
 def test_broken_file(self):
     with helper.Capturing() as output:
         mscxyz.execute(['--config-file', ini_file, 'meta',
                         helper.get_tmpfile_path('broken.mscx')])
     self.assertTrue('Error: XMLSyntaxError; message: Start tag expected, '
                     '\'<\' not found, line 1, column 1' in
                     ' '.join(output))
Esempio n. 4
0
    def test_broken_file(self):
        with helper.Capturing() as output:
            mscxyz.execute(['meta', helper.get_tmpfile_path('broken.mscx')])

        self.assertTrue('Error: XMLSyntaxError; message: Start tag expected, '
                        '\'<\' not found, line 1, column 1' in
                        ' '.join(output))
    def test_method_merge_style(self):
        tree = XMLTree(helper.get_tmpfile_path('simple.mscx'))
        styles = """
            <TextStyle>
              <halign>center</halign>
              <valign>bottom</valign>
              <xoffset>0</xoffset>
              <yoffset>-1</yoffset>
              <offsetType>spatium</offsetType>
              <name>Form Section</name>
              <family>Alegreya Sans</family>
              <size>12</size>
              <bold>1</bold>
              <italic>1</italic>
              <sizeIsSpatiumDependent>1</sizeIsSpatiumDependent>
              <frameWidthS>0.1</frameWidthS>
              <paddingWidthS>0.2</paddingWidthS>
              <frameRound>0</frameRound>
              <frameColor r="0" g="0" b="0" a="255"/>
              </TextStyle>
        """
        tree.clean()
        tree.merge_style(styles)

        xml_tree = tree.xml_tree
        result = xml_tree.xpath('/museScore/Score/Style')
        self.assertEqual(result[0][0][0].tag, 'halign')
        self.assertEqual(result[0][0][0].text, 'center')
Esempio n. 6
0
 def test_export(self, mscore_function):
     tmp = helper.get_tmpfile_path('simple.mscx')
     mscxyz.execute(['export', '--extension', 'mp3', tmp])
     args = mscore_function.call_args_list[0][0][0]
     self.assertEqual(args[0], '--export-to')
     self.assertEqual(args[1], tmp.replace('mscx', 'mp3'))
     self.assertEqual(args[2], tmp)
Esempio n. 7
0
 def test_export(self, mscore_function):
     tmp = helper.get_tmpfile_path("simple.mscx")
     mscxyz.execute(["export", "--extension", "mp3", tmp])
     args = mscore_function.call_args_list[0][0][0]
     self.assertEqual(args[0], "--export-to")
     self.assertEqual(args[1], tmp.replace("mscx", "mp3"))
     self.assertEqual(args[2], tmp)
Esempio n. 8
0
 def test_export(self, mscore_function):
     tmp = helper.get_tmpfile_path('simple.mscx')
     mscxyz.execute(['export', '--extension', 'mp3', tmp])
     args = mscore_function.call_args_list[0][0][0]
     self.assertEqual(args[0], '--export-to')
     self.assertEqual(args[1], tmp.replace('mscx', 'mp3'))
     self.assertEqual(args[2], tmp)
Esempio n. 9
0
    def test_method_merge_style(self):
        tree = MscoreXmlTree(helper.get_tmpfile_path("simple.mscx"))
        styles = """
            <TextStyle>
              <halign>center</halign>
              <valign>bottom</valign>
              <xoffset>0</xoffset>
              <yoffset>-1</yoffset>
              <offsetType>spatium</offsetType>
              <name>Form Section</name>
              <family>Alegreya Sans</family>
              <size>12</size>
              <bold>1</bold>
              <italic>1</italic>
              <sizeIsSpatiumDependent>1</sizeIsSpatiumDependent>
              <frameWidthS>0.1</frameWidthS>
              <paddingWidthS>0.2</paddingWidthS>
              <frameRound>0</frameRound>
              <frameColor r="0" g="0" b="0" a="255"/>
              </TextStyle>
        """
        tree.clean()
        tree.merge_style(styles)

        xml_tree = tree.xml_tree
        result = xml_tree.xpath("/museScore/Score/Style")
        self.assertEqual(result[0][0][0].tag, "halign")
        self.assertEqual(result[0][0][0].text, "center")
Esempio n. 10
0
 def test_method_set_attributes(self):
     dudes = MscoreStyleInterface(
         helper.get_tmpfile_path("All_Dudes.mscx", version=3))
     dudes.set_attributes("XXX", {"one": 1, "two": 2})
     dudes.save()
     dudes2 = MscoreStyleInterface(dudes.abspath)
     self.assertEqual(dudes2.get_element("XXX").attrib["one"], "1")
Esempio n. 11
0
    def setUp(self):
        self.fields = [
            "combined_composer",
            "combined_lyricist",
            "combined_subtitle",
            "combined_title",
            "metatag_arranger",
            "metatag_composer",
            "metatag_copyright",
            "metatag_creation_date",
            "metatag_lyricist",
            "metatag_movement_number",
            "metatag_movement_title",
            "metatag_platform",
            "metatag_poet",
            "metatag_source",
            "metatag_translator",
            "metatag_work_number",
            "metatag_work_title",
            "readonly_abspath",
            "readonly_basename",
            "readonly_dirname",
            "readonly_extension",
            "readonly_filename",
            "readonly_relpath",
            "readonly_relpath_backup",
            "vbox_composer",
            "vbox_lyricist",
            "vbox_subtitle",
            "vbox_title",
        ]

        self.tmp = helper.get_tmpfile_path("meta-all-values.mscx")
        self.xml_tree = MscoreXmlTree(self.tmp)
        self.interface = Interface(self.xml_tree)
Esempio n. 12
0
 def test_set_field_with_templating(self):
     tmp = helper.get_tmpfile_path('meta-all-values.mscx')
     mscxyz.execute(['meta', '--set-field', 'vbox_title',
                     '$vbox_title ($vbox_composer)', tmp])
     meta = Meta(tmp)
     self.assertEqual(meta.interface.vbox_title,
                      'vbox_title (vbox_composer)')
Esempio n. 13
0
 def test_clean_single_field(self):
     tmp = helper.get_tmpfile_path('meta-all-values.mscx')
     mscxyz.execute(['meta', '--clean', 'vbox_title', tmp])
     meta = Meta(tmp)
     iface = meta.interface
     self.assertEqual(iface.vbox_title, None, 'vbox_title')
     self.assertEqual(iface.vbox_composer, 'vbox_composer', 'vbox_composer')
Esempio n. 14
0
 def test_log(self):
     tmp = helper.get_tmpfile_path('simple.mscx')
     log = tempfile.mktemp()
     mscxyz.execute(
         ['meta', '--log', log, '$combined_title-$combined_composer', tmp])
     log_file = open(log, 'r')
     self.assertEqual(log_file.readline(), 'Title-Composer\n')
Esempio n. 15
0
 def test_set_field_multiple_times(self):
     tmp = helper.get_tmpfile_path('meta-all-values.mscx')
     mscxyz.execute(['meta', '--set-field', 'vbox_title', 'lol',
                     '--set-field', 'vbox_composer', 'troll', tmp])
     meta = Meta(tmp)
     self.assertEqual(meta.interface.vbox_title, 'lol')
     self.assertEqual(meta.interface.vbox_composer, 'troll')
Esempio n. 16
0
 def test_log(self):
     tmp = helper.get_tmpfile_path('simple.mscx')
     log = tempfile.mktemp()
     mscxyz.execute(['meta', '--log',  log,
                     '$combined_title-$combined_composer', tmp])
     log_file = open(log, 'r')
     self.assertEqual(log_file.readline(), 'Title-Composer\n')
Esempio n. 17
0
 def test_show_verbose_one(self):
     with helper.Capturing() as output:
         mscxyz.execute(['-v', 'meta', '--clean', 'all',
                        helper.get_tmpfile_path('simple.mscx')])
     output = ' '.join(output)
     self.assertTrue('readonly_abspath' in output)
     self.assertFalse('readonly_relpath_backup' in output)
Esempio n. 18
0
    def setUp(self):
        self.fields = [
            'combined_composer',
            'combined_lyricist',
            'combined_subtitle',
            'combined_title',
            'metatag_arranger',
            'metatag_composer',
            'metatag_copyright',
            'metatag_creation_date',
            'metatag_lyricist',
            'metatag_movement_number',
            'metatag_movement_title',
            'metatag_platform',
            'metatag_poet',
            'metatag_source',
            'metatag_translator',
            'metatag_work_number',
            'metatag_work_title',
            'readonly_abspath',
            'readonly_basename',
            'readonly_dirname',
            'readonly_extension',
            'readonly_filename',
            'readonly_relpath',
            'readonly_relpath_backup',
            'vbox_composer',
            'vbox_lyricist',
            'vbox_subtitle',
            'vbox_title',
        ]

        self.tmp = helper.get_tmpfile_path('meta-all-values.mscx')
        self.xml_tree = XMLTree(self.tmp)
        self.interface = Interface(self.xml_tree)
Esempio n. 19
0
 def test_delete_duplicates_move_subtitle(self):
     tmp = helper.get_tmpfile_path('meta-duplicates-move-subtitle.mscx')
     mscxyz.execute(['meta', '--delete-duplicates', tmp])
     meta = Meta(tmp)
     self.assertFalse(meta.interface.combined_lyricist)
     self.assertFalse(meta.interface.combined_subtitle)
     self.assertEqual(meta.interface.combined_title, 'Title')
Esempio n. 20
0
    def setUp(self):
        self.fields = [
            'combined_composer',
            'combined_lyricist',
            'combined_subtitle',
            'combined_title',
            'metatag_arranger',
            'metatag_composer',
            'metatag_copyright',
            'metatag_creation_date',
            'metatag_lyricist',
            'metatag_movement_number',
            'metatag_movement_title',
            'metatag_platform',
            'metatag_poet',
            'metatag_source',
            'metatag_translator',
            'metatag_work_number',
            'metatag_work_title',
            'readonly_abspath',
            'readonly_basename',
            'readonly_dirname',
            'readonly_extension',
            'readonly_filename',
            'readonly_relpath',
            'readonly_relpath_backup',
            'vbox_composer',
            'vbox_lyricist',
            'vbox_subtitle',
            'vbox_title',
        ]

        self.tmp = helper.get_tmpfile_path('meta-all-values.mscx')
        self.xml_tree = MscoreXmlTree(self.tmp)
        self.interface = Interface(self.xml_tree)
Esempio n. 21
0
 def test_clean_all(self):
     tmp = helper.get_tmpfile_path("meta-all-values.mscx")
     mscxyz.execute(["meta", "--clean", "all", tmp])
     meta = Meta(tmp)
     iface = meta.interface_read_write
     for field in iface.fields:
         self.assertEqual(getattr(iface, field), None, field)
Esempio n. 22
0
 def test_clean_single_field(self):
     tmp = helper.get_tmpfile_path("meta-all-values.mscx")
     mscxyz.execute(["meta", "--clean", "vbox_title", tmp])
     meta = Meta(tmp)
     iface = meta.interface
     self.assertEqual(iface.vbox_title, None, "vbox_title")
     self.assertEqual(iface.vbox_composer, "vbox_composer", "vbox_composer")
Esempio n. 23
0
 def test_delete_duplicates_move_subtitle(self):
     tmp = helper.get_tmpfile_path("meta-duplicates-move-subtitle.mscx")
     mscxyz.execute(["meta", "--delete-duplicates", tmp])
     meta = Meta(tmp)
     self.assertFalse(meta.interface.combined_lyricist)
     self.assertFalse(meta.interface.combined_subtitle)
     self.assertEqual(meta.interface.combined_title, "Title")
Esempio n. 24
0
 def test_log(self):
     tmp = helper.get_tmpfile_path("simple.mscx")
     log = tempfile.mktemp()
     mscxyz.execute(
         ["meta", "--log", log, "$combined_title-$combined_composer", tmp])
     log_file = open(log, "r")
     self.assertEqual(log_file.readline(), "Title-Composer\n")
Esempio n. 25
0
 def test_show_verbose_two(self):
     with helper.Capturing() as output:
         mscxyz.execute([
             '-vv', 'meta', '--clean', 'all',
             helper.get_tmpfile_path('simple.mscx')
         ])
     output = ' '.join(output)
     self.assertTrue('readonly_relpath_backup' in output)
Esempio n. 26
0
 def test_method_set_attributes(self):
     dudes = MscoreStyleInterface(
         helper.get_tmpfile_path('All_Dudes.mscx', version=3)
     )
     dudes.set_attributes('XXX', {'one': 1, 'two': 2})
     dudes.save()
     dudes2 = MscoreStyleInterface(dudes.abspath)
     self.assertEqual(dudes2.get_element('XXX').attrib['one'], '1')
Esempio n. 27
0
    def test_show(self):
        with helper.Capturing() as output:
            mscxyz.execute(['meta', '--clean', 'all',
                           helper.get_tmpfile_path('meta-all-values.mscx')])

        self.assertEqual(output[0], '')
        self.assertTrue('meta-all-values.mscx' in ' '.join(output))
        self.assertEqual(output[-1], 'vbox_title: “vbox_title” -> “”')
Esempio n. 28
0
 def test_distribute_field_exception_unmatched(self):
     tmp = helper.get_tmpfile_path('simple.mscx')
     with helper.Capturing() as output:
         mscxyz.execute([
             'meta', '--distribute-field', 'vbox_title',
             '$metatag_work_title - $metatag_composer', tmp
         ])
     self.assertTrue('UnmatchedFormatStringError' in output[-1])
Esempio n. 29
0
 def test_function_apply_format_string(self):
     from mscxyz import settings
     settings.args = settings.DefaultArguments()
     meta = mscxyz.meta.Meta(
         helper.get_tmpfile_path('meta-all-values.mscx'))
     fields = meta.interface.export_to_dict()
     name = rename.apply_format_string(fields)
     self.assertEqual(name, 'vbox_title (vbox_composer)')
Esempio n. 30
0
 def test_clean_single_field(self):
     tmp = helper.get_tmpfile_path('meta-all-values.mscx')
     mscxyz.execute(
         ['meta', '--clean', 'vbox_title', tmp]
     )
     meta = Meta(tmp)
     iface = meta.interface
     self.assertEqual(iface.vbox_title, None, 'vbox_title')
     self.assertEqual(iface.vbox_composer, 'vbox_composer', 'vbox_composer')
Esempio n. 31
0
 def test_clean_all(self):
     tmp = helper.get_tmpfile_path('meta-all-values.mscx')
     mscxyz.execute(
         ['meta', '--clean', 'all', tmp]
     )
     meta = Meta(tmp)
     iface = meta.interface_read_write
     for field in iface.fields:
         self.assertEqual(getattr(iface, field), None, field)
Esempio n. 32
0
 def test_show_simple_unverbose(self):
     with helper.Capturing() as output:
         mscxyz.execute(['meta', '--clean', 'all',
                        helper.get_tmpfile_path('simple.mscx')])
     self.assertEqual(output[0], '')
     self.assertTrue('simple.mscx' in ' '.join(output))
     self.assertEqual(output[2], 'combined_composer: “Composer” -> “”')
     self.assertEqual(output[3], 'combined_title: “Title” -> “”')
     self.assertEqual(output[-1], 'vbox_title: “Title” -> “”')
Esempio n. 33
0
 def test_set_field_multiple_times(self):
     tmp = helper.get_tmpfile_path('meta-all-values.mscx')
     mscxyz.execute([
         'meta', '--set-field', 'vbox_title', 'lol', '--set-field',
         'vbox_composer', 'troll', tmp
     ])
     meta = Meta(tmp)
     self.assertEqual(meta.interface.vbox_title, 'lol')
     self.assertEqual(meta.interface.vbox_composer, 'troll')
Esempio n. 34
0
 def test_set_field_with_templating(self):
     tmp = helper.get_tmpfile_path("meta-all-values.mscx")
     mscxyz.execute([
         "meta", "--set-field", "vbox_title",
         "$vbox_title ($vbox_composer)", tmp
     ])
     meta = Meta(tmp)
     self.assertEqual(meta.interface.vbox_title,
                      "vbox_title (vbox_composer)")
Esempio n. 35
0
 def test_set_field_with_templating(self):
     tmp = helper.get_tmpfile_path('meta-all-values.mscx')
     mscxyz.execute([
         'meta', '--set-field', 'vbox_title',
         '$vbox_title ($vbox_composer)', tmp
     ])
     meta = Meta(tmp)
     self.assertEqual(meta.interface.vbox_title,
                      'vbox_title (vbox_composer)')
Esempio n. 36
0
 def test_show_verbose_one(self):
     with helper.Capturing() as output:
         mscxyz.execute([
             "-v", "meta", "--clean", "all",
             helper.get_tmpfile_path("simple.mscx")
         ])
     output = " ".join(output)
     self.assertTrue("readonly_abspath" in output)
     self.assertFalse("readonly_relpath_backup" in output)
Esempio n. 37
0
 def test_clean(self):
     tmp = helper.get_tmpfile_path('formats.mscx')
     mscxyz.execute(['clean', tmp])
     cleaned = helper.read_file(tmp)
     self.assertFalse('<font' in cleaned)
     self.assertFalse('<b>' in cleaned)
     self.assertFalse('<i>' in cleaned)
     self.assertFalse('<pos' in cleaned)
     self.assertFalse('<LayoutBreak>' in cleaned)
     self.assertFalse('<StemDirection>' in cleaned)
Esempio n. 38
0
 def test_broken_file(self):
     with helper.Capturing() as output:
         mscxyz.execute([
             "--config-file",
             ini_file,
             "meta",
             helper.get_tmpfile_path("broken.mscx"),
         ])
     self.assertTrue("Error: XMLSyntaxError; message: Start tag expected, "
                     "'<' not found, line 1, column 1" in " ".join(output))
Esempio n. 39
0
 def _test_clean(self, version=2):
     tmp = helper.get_tmpfile_path("formats.mscx", version)
     mscxyz.execute(["clean", tmp])
     cleaned = helper.read_file(tmp)
     self.assertFalse("<font" in cleaned)
     self.assertFalse("<b>" in cleaned)
     self.assertFalse("<i>" in cleaned)
     self.assertFalse("<pos" in cleaned)
     self.assertFalse("<LayoutBreak>" in cleaned)
     self.assertFalse("<StemDirection>" in cleaned)
 def assertDiff(self, filename):
     orig = os.path.join(os.path.expanduser('~'), filename)
     saved = orig.replace('.mscx', '_saved.mscx')
     tmp = helper.get_tmpfile_path(filename)
     shutil.copy2(tmp, orig)
     tree = XMLTree(tmp)
     tree.save(new_name=saved)
     self.assertTrue(filecmp.cmp(orig, saved))
     os.remove(orig)
     os.remove(saved)
Esempio n. 41
0
 def assertDiff(self, filename, version=2):
     orig = os.path.join(os.path.expanduser("~"), filename)
     saved = orig.replace(".mscx", "_saved.mscx")
     tmp = helper.get_tmpfile_path(filename, version=version)
     shutil.copy2(tmp, orig)
     tree = MscoreXmlTree(tmp)
     tree.save(new_name=saved)
     self.assertTrue(filecmp.cmp(orig, saved))
     os.remove(orig)
     os.remove(saved)
Esempio n. 42
0
 def _test_clean(self, version=2):
     tmp = helper.get_tmpfile_path('formats.mscx', version)
     mscxyz.execute(['clean', tmp])
     cleaned = helper.read_file(tmp)
     self.assertFalse('<font' in cleaned)
     self.assertFalse('<b>' in cleaned)
     self.assertFalse('<i>' in cleaned)
     self.assertFalse('<pos' in cleaned)
     self.assertFalse('<LayoutBreak>' in cleaned)
     self.assertFalse('<StemDirection>' in cleaned)
Esempio n. 43
0
    def test_show(self):
        with helper.Capturing() as output:
            mscxyz.execute([
                '--config-file', ini_file, 'meta', '--clean', 'all',
                helper.get_tmpfile_path('meta-all-values.mscx')
            ])

        self.assertEqual(output[0], '')
        self.assertTrue('meta-all-values.mscx' in ' '.join(output))
        self.assertEqual(output[-1], 'vbox_title: “vbox_title” -> “”')
Esempio n. 44
0
 def test_distribute_field_exception_unmatched(self):
     tmp = helper.get_tmpfile_path("simple.mscx")
     with helper.Capturing() as output:
         mscxyz.execute([
             "meta",
             "--distribute-field",
             "vbox_title",
             "$metatag_work_title - $metatag_composer",
             tmp,
         ])
     self.assertTrue("UnmatchedFormatStringError" in output[-1])
Esempio n. 45
0
    def test_method_get_element_create(self):
        dudes = MscoreStyleInterface(
            helper.get_tmpfile_path("All_Dudes.mscx", version=3))
        self.assertEqual(dudes.get_element("XXX"), None)
        element = dudes.get_element("XXX", create=True)
        element.attrib["y"] = "YYY"
        self.assertEqual(element.tag, "XXX")
        dudes.save()

        dudes2 = MscoreStyleInterface(dudes.abspath)
        self.assertEqual(dudes2.get_element("XXX").attrib["y"], "YYY")
Esempio n. 46
0
 def test_distribute_field_multple_source_fields(self):
     tmp = helper.get_tmpfile_path('Title - Composer.mscx')
     mscxyz.execute(
         ['meta', '--distribute-field', 'vbox_title,readonly_basename',
          '$combined_title - $combined_composer', tmp]
     )
     meta = Meta(tmp)
     iface = meta.interface
     self.assertEqual(iface.vbox_composer, 'Composer')
     self.assertEqual(iface.metatag_composer, 'Composer')
     self.assertEqual(iface.vbox_title, 'Title')
     self.assertEqual(iface.metatag_work_title, 'Title')
Esempio n. 47
0
 def setUp(self):
     self.fields = (
         'readonly_basename',
         'readonly_dirname',
         'readonly_extension',
         'readonly_filename',
         'readonly_relpath',
         'readonly_relpath_backup',
     )
     self.tmp = helper.get_tmpfile_path('simple.mscx')
     self.xml_tree = XMLTree(self.tmp)
     self.interface = InterfaceReadOnly(self.xml_tree)
Esempio n. 48
0
 def _assert_set(self, filename):
     tmp = helper.get_tmpfile_path(filename)
     tree = XMLTree(tmp)
     vbox = Vbox(tree.xml_root)
     vbox.Title = 'lol'
     vbox.composer = 'lol'
     tree.save()
     tree = XMLTree(tmp)
     vbox = Vbox(tree.xml_root)
     self.assertEqual(vbox.title, 'lol')
     self.assertEqual(vbox.Composer, 'lol')
     xml_string = helper.read_file(tmp)
     self.assertTrue('<text>lol</text>' in xml_string)
Esempio n. 49
0
    def test_remap(self):
        tmp = helper.get_tmpfile_path('lyrics-remap.mscx')
        mscxyz.execute(['lyrics', '--remap', '2:6', tmp])
        tree = mscxyz.lyrics.Lyrics(tmp)
        text = []
        for element in tree.lyrics:
            tag = element['element']
            tag_text = tag.find('no')
            if hasattr(tag_text, 'text'):
                no = tag_text.text
            else:
                no = '0'
            text.append(no)

        self.assertEqual(text, ['0', '5', '2', '3', '4'])
Esempio n. 50
0
 def test_distribute_field_multiple_values(self):
     tmp = helper.get_tmpfile_path('meta-distribute-field.mscx')
     mscxyz.execute(
         ['meta',
          '--distribute-field',
          'vbox_title',
          '$metatag_work_title - $metatag_composer',
          '--distribute-field',
          'vbox_title',
          '$metatag_movement_title - $metatag_lyricist',
          tmp]
     )
     meta = Meta(tmp)
     iface = meta.interface
     self.assertEqual(iface.metatag_lyricist, 'Composer')
     self.assertEqual(iface.metatag_composer, 'Composer')
     self.assertEqual(iface.metatag_movement_title, 'Title')
     self.assertEqual(iface.metatag_work_title, 'Title')
Esempio n. 51
0
 def setUp(self):
     self.tmp = helper.get_tmpfile_path('lyrics-fix.mscx')
     mscxyz.execute(['lyrics', '--fix', self.tmp])
     self.xml_tree = mscxyz.lyrics.Lyrics(self.tmp)
     self.lyrics = self.xml_tree.lyrics
Esempio n. 52
0
 def test_set_field_simple_string(self):
     tmp = helper.get_tmpfile_path('meta-all-values.mscx')
     mscxyz.execute(['meta', '--set-field', 'vbox_title', 'lol', tmp])
     meta = Meta(tmp)
     self.assertEqual(meta.interface.vbox_title, 'lol')
Esempio n. 53
0
 def _init_class(self, filename):
     tmp = helper.get_tmpfile_path(filename)
     tree = XMLTree(tmp)
     meta = MetaTag(tree.xml_root)
     return meta, tree, tmp
Esempio n. 54
0
 def test_distribute_field_exception_unmatched(self):
     tmp = helper.get_tmpfile_path('simple.mscx')
     with helper.Capturing() as output:
         mscxyz.execute(['meta', '--distribute-field', 'vbox_title',
                         '$metatag_work_title - $metatag_composer', tmp])
     self.assertTrue('UnmatchedFormatStringError' in output[-1])
Esempio n. 55
0
 def test_distribute_field_invalid_format_string(self):
     tmp = helper.get_tmpfile_path('meta-distribute-field.mscx')
     with self.assertRaises(meta.FormatStringNoFieldError):
         mscxyz.execute(['meta', '--distribute-field', 'vbox_title', 'lol',
                         tmp])
Esempio n. 56
0
 def _init_class(self, filename):
     tmp = helper.get_tmpfile_path(filename)
     tree = XMLTree(tmp)
     vbox = Vbox(tree.xml_root)
     return vbox, tree, tmp
Esempio n. 57
0
 def _init_class(self, filename):
     tmp = helper.get_tmpfile_path(filename)
     tree = XMLTree(tmp)
     combined = Combined(tree.xml_root)
     return combined, tree, tmp
Esempio n. 58
0
 def setUp(self):
     self.tmp = helper.get_tmpfile_path('lyrics.mscx')
Esempio n. 59
0
 def test_clean_add_style(self):
     tmp = helper.get_tmpfile_path('simple.mscx')
     mscxyz.execute(['clean', '--style',
                     helper.get_tmpfile_path('style.mss'), tmp])
     style = helper.read_file(tmp)
     self.assertTrue('<staffUpperBorder>77</staffUpperBorder>' in style)
Esempio n. 60
0
 def _init_class(self, filename):
     tmp = helper.get_tmpfile_path(filename)
     tree = XMLTree(tmp)
     interface = InterfaceReadWrite(tree.xml_root)
     return interface, tree, tmp