Exemplo n.º 1
0
 def test_method_set_muliple_element_path_multiple_times(self):
     self.style.set_value('page-layout/page-height', 99)
     self.style.set_value('page-layout/page-width', 100)
     self.style.set_value('page-layout/page-depth', 101)
     self.style.save()
     style2 = MscoreStyleInterface(self.style.abspath)
     self.assertEqual(style2.get_value('page-layout/page-depth'), '101')
     self.assertEqual(style2.get_value('page-layout/page-height'), '99')
     self.assertEqual(style2.get_value('page-layout/page-width'), '100')
Exemplo n.º 2
0
 def test_method_set_muliple_element_path_multiple_times(self):
     self.style.set_value("page-layout/page-height", 99)
     self.style.set_value("page-layout/page-width", 100)
     self.style.set_value("page-layout/page-depth", 101)
     self.style.save()
     style2 = MscoreStyleInterface(self.style.abspath)
     self.assertEqual(style2.get_value("page-layout/page-depth"), "101")
     self.assertEqual(style2.get_value("page-layout/page-height"), "99")
     self.assertEqual(style2.get_value("page-layout/page-width"), "100")
Exemplo n.º 3
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")
Exemplo n.º 4
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')
Exemplo n.º 5
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")
Exemplo n.º 6
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')
Exemplo n.º 7
0
class TestClassMscoreStyleInterface3(unittest.TestCase):
    def setUp(self):
        self.style = MscoreStyleInterface(
            helper.get_tmpfile_path("All_Dudes.mscx", version=3))

    def test_attributes_style(self):
        self.assertEqual(self.style.style.tag, "Style")

    def test_method_get(self):
        self.assertEqual(self.style.get_value("staffUpperBorder"), "6.5")

    def test_method_set(self):
        self.style.set_value("staffUpperBorder", 99)
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value("staffUpperBorder"), "99")

    def test_method_set_create(self):
        self.style.set_value("lol", "lol")
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value("lol"), "lol")
Exemplo n.º 8
0
class TestClassMscoreStyleInterface3(unittest.TestCase):

    def setUp(self):
        self.style = MscoreStyleInterface(
            helper.get_tmpfile_path('All_Dudes.mscx', version=3)
        )

    def test_attributes_style(self):
        self.assertEqual(self.style.style.tag, 'Style')

    def test_method_get(self):
        self.assertEqual(self.style.get_value('staffUpperBorder'), '6.5')

    def test_method_set(self):
        self.style.set_value('staffUpperBorder', 99)
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value('staffUpperBorder'), '99')

    def test_method_set_create(self):
        self.style.set_value('lol', 'lol')
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value('lol'), 'lol')
Exemplo n.º 9
0
class TestClassMscoreStyleInterfaceWithoutTags(unittest.TestCase):
    def setUp(self):
        self.style = MscoreStyleInterface(
            helper.get_tmpfile_path("without-style.mscx"))

    def test_load(self):
        self.assertEqual(self.style.style.tag, "Style")

    def test_method_set(self):
        self.style.set_value("staffUpperBorder", 99)
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value("staffUpperBorder"), "99")

    def test_method_set_element_path_multiple(self):
        self.style.set_value("lol/troll", 99)
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value("lol/troll"), "99")

    def test_method_get_text_style_unkown(self):
        unkown = self.style.get_text_style("Unkown")
        self.assertEqual(unkown, {"name": "Unkown"})

    def test_method_set_text_style_unkown(self):
        self.style.set_text_style("Unkown", {"size": 99})
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        unkown = style2.get_text_style("Unkown")
        self.assertEqual(unkown["size"], "99")
Exemplo n.º 10
0
 def test_method_set_create(self):
     self.style.set_value("lol", "lol")
     self.style.save()
     style2 = MscoreStyleInterface(self.style.abspath)
     self.assertEqual(style2.get_value("lol"), "lol")
Exemplo n.º 11
0
 def setUp(self):
     self.style = MscoreStyleInterface(
         helper.get_tmpfile_path("All_Dudes.mscx", version=3))
Exemplo n.º 12
0
 def test_method_set_text_style(self):
     self.style.set_text_style("Title", {"size": 99})
     self.style.save()
     style2 = MscoreStyleInterface(self.style.abspath)
     title = style2.get_text_style("Title")
     self.assertEqual(title["size"], "99")
Exemplo n.º 13
0
 def test_method_set_text_style(self):
     self.style.set_text_style('Title', {'size': 99})
     self.style.save()
     style2 = MscoreStyleInterface(self.style.abspath)
     title = style2.get_text_style('Title')
     self.assertEqual(title['size'], '99')
Exemplo n.º 14
0
 def test_method_set_element_path_multiple(self):
     self.style.set_value("lol/troll", 99)
     self.style.save()
     style2 = MscoreStyleInterface(self.style.abspath)
     self.assertEqual(style2.get_value("lol/troll"), "99")
Exemplo n.º 15
0
 def setUp(self):
     self.style = MscoreStyleInterface(
         helper.get_tmpfile_path("without-style.mscx"))
Exemplo n.º 16
0
class TestClassStyle(unittest.TestCase):
    def setUp(self):
        self.style = MscoreStyleInterface(
            helper.get_tmpfile_path("All_Dudes.mscx", version=2))

    def test_attributes_style(self):
        self.assertEqual(self.style.style.tag, "Style")

    def test_method_get(self):
        self.assertEqual(self.style.get_value("staffUpperBorder"), "6.5")

    def test_method_get_muliple_element_path(self):
        self.assertEqual(self.style.get_value("page-layout/page-height"),
                         "1584")

    def test_method_get_element(self):
        self.assertEqual(self.style.get_element("voltaY").tag, "voltaY")

    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")

    def test_method_get_value(self):
        self.assertEqual(self.style.get_value("voltaY"), "-2")

    def test_method_set_value(self):
        self.style.set_value("staffUpperBorder", 99)
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value("staffUpperBorder"), "99")

    def test_method_set_value_create(self):
        self.style.set_value("lol", "lol")
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value("lol"), "lol")

    def test_method_set_value_muliple_element_path(self):
        self.style.set_value("page-layout/page-height", 99)
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value("page-layout/page-height"), "99")

    def test_method_set_muliple_element_path_multiple_times(self):
        self.style.set_value("page-layout/page-height", 99)
        self.style.set_value("page-layout/page-width", 100)
        self.style.set_value("page-layout/page-depth", 101)
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value("page-layout/page-depth"), "101")
        self.assertEqual(style2.get_value("page-layout/page-height"), "99")
        self.assertEqual(style2.get_value("page-layout/page-width"), "100")

    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")

    def test_method_get_text_style(self):
        title = self.style.get_text_style("Title")
        self.assertEqual(
            title,
            {
                "halign": "center",
                "size": "28",
                "family": "MuseJazz",
                "bold": "1",
                "valign": "top",
                "name": "Title",
                "offsetType": "absolute",
            },
        )

    def test_method_set_text_style(self):
        self.style.set_text_style("Title", {"size": 99})
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        title = style2.get_text_style("Title")
        self.assertEqual(title["size"], "99")
Exemplo n.º 17
0
 def test_method_set_text_style_unkown(self):
     self.style.set_text_style('Unkown', {'size': 99})
     self.style.save()
     style2 = MscoreStyleInterface(self.style.abspath)
     unkown = style2.get_text_style('Unkown')
     self.assertEqual(unkown['size'], '99')
Exemplo n.º 18
0
class TestClassMscoreStyleInterfaceWithoutTags(unittest.TestCase):

    def setUp(self):
        self.style = MscoreStyleInterface(
            helper.get_tmpfile_path('without-style.mscx')
        )

    def test_load(self):
        self.assertEqual(self.style.style.tag, 'Style')

    def test_method_set(self):
        self.style.set_value('staffUpperBorder', 99)
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value('staffUpperBorder'), '99')

    def test_method_set_element_path_multiple(self):
        self.style.set_value('lol/troll', 99)
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value('lol/troll'), '99')

    def test_method_get_text_style_unkown(self):
        unkown = self.style.get_text_style('Unkown')
        self.assertEqual(unkown, {'name': 'Unkown'})

    def test_method_set_text_style_unkown(self):
        self.style.set_text_style('Unkown', {'size': 99})
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        unkown = style2.get_text_style('Unkown')
        self.assertEqual(unkown['size'], '99')
Exemplo n.º 19
0
 def test_method_set(self):
     self.style.set_value("staffUpperBorder", 99)
     self.style.save()
     style2 = MscoreStyleInterface(self.style.abspath)
     self.assertEqual(style2.get_value("staffUpperBorder"), "99")
Exemplo n.º 20
0
 def test_method_set_value_muliple_element_path(self):
     self.style.set_value("page-layout/page-height", 99)
     self.style.save()
     style2 = MscoreStyleInterface(self.style.abspath)
     self.assertEqual(style2.get_value("page-layout/page-height"), "99")
Exemplo n.º 21
0
 def test_method_set_text_style_unkown(self):
     self.style.set_text_style("Unkown", {"size": 99})
     self.style.save()
     style2 = MscoreStyleInterface(self.style.abspath)
     unkown = style2.get_text_style("Unkown")
     self.assertEqual(unkown["size"], "99")
Exemplo n.º 22
0
class TestClassStyle(unittest.TestCase):

    def setUp(self):
        self.style = MscoreStyleInterface(
            helper.get_tmpfile_path('All_Dudes.mscx', version=2)
        )

    def test_attributes_style(self):
        self.assertEqual(self.style.style.tag, 'Style')

    def test_method_get(self):
        self.assertEqual(self.style.get_value('staffUpperBorder'), '6.5')

    def test_method_get_muliple_element_path(self):
        self.assertEqual(self.style.get_value('page-layout/page-height'),
                         '1584')

    def test_method_get_element(self):
        self.assertEqual(self.style.get_element('voltaY').tag, 'voltaY')

    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')

    def test_method_get_value(self):
        self.assertEqual(self.style.get_value('voltaY'), '-2')

    def test_method_set_value(self):
        self.style.set_value('staffUpperBorder', 99)
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value('staffUpperBorder'), '99')

    def test_method_set_value_create(self):
        self.style.set_value('lol', 'lol')
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value('lol'), 'lol')

    def test_method_set_value_muliple_element_path(self):
        self.style.set_value('page-layout/page-height', 99)
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value('page-layout/page-height'), '99')

    def test_method_set_muliple_element_path_multiple_times(self):
        self.style.set_value('page-layout/page-height', 99)
        self.style.set_value('page-layout/page-width', 100)
        self.style.set_value('page-layout/page-depth', 101)
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        self.assertEqual(style2.get_value('page-layout/page-depth'), '101')
        self.assertEqual(style2.get_value('page-layout/page-height'), '99')
        self.assertEqual(style2.get_value('page-layout/page-width'), '100')

    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')

    def test_method_get_text_style(self):
        title = self.style.get_text_style('Title')
        self.assertEqual(title, {'halign': 'center',
                                 'size': '28',
                                 'family': 'MuseJazz',
                                 'bold': '1',
                                 'valign': 'top',
                                 'name': 'Title',
                                 'offsetType': 'absolute'})

    def test_method_set_text_style(self):
        self.style.set_text_style('Title', {'size': 99})
        self.style.save()
        style2 = MscoreStyleInterface(self.style.abspath)
        title = style2.get_text_style('Title')
        self.assertEqual(title['size'], '99')