Exemple #1
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")
Exemple #2
0
 def test_method_clean(self):
     tmp = helper.get_tmpfile_path("clean.mscx", version=3)
     tree = MscoreXmlTree(tmp)
     tree.clean()
     tree.save()
     tree = MscoreXmlTree(tmp)
     xml_tree = tree.xml_tree
     self.assertEqual(xml_tree.xpath("/museScore/Score/Style"), [])
     self.assertEqual(xml_tree.xpath("//LayoutBreak"), [])
     self.assertEqual(xml_tree.xpath("//StemDirection"), [])
     self.assertEqual(xml_tree.xpath("//font"), [])
     self.assertEqual(xml_tree.xpath("//b"), [])
     self.assertEqual(xml_tree.xpath("//i"), [])
     self.assertEqual(xml_tree.xpath("//pos"), [])
     self.assertEqual(xml_tree.xpath("//offset"), [])
Exemple #3
0
 def test_method_clean(self):
     tmp = helper.get_tmpfile_path('clean.mscx', version=3)
     tree = MscoreXmlTree(tmp)
     tree.clean()
     tree.save()
     tree = MscoreXmlTree(tmp)
     xml_tree = tree.xml_tree
     self.assertEqual(xml_tree.xpath('/museScore/Score/Style'), [])
     self.assertEqual(xml_tree.xpath('//LayoutBreak'), [])
     self.assertEqual(xml_tree.xpath('//StemDirection'), [])
     self.assertEqual(xml_tree.xpath('//font'), [])
     self.assertEqual(xml_tree.xpath('//b'), [])
     self.assertEqual(xml_tree.xpath('//i'), [])
     self.assertEqual(xml_tree.xpath('//pos'), [])
     self.assertEqual(xml_tree.xpath('//offset'), [])