Esempio n. 1
0
 def test_create_style_properties_shorcut(self):
     style = Style('paragraph', area='text', color='#ff0000')
     expected = ('<style:style style:family="paragraph">'
                 '<style:text-properties fo:color="#ff0000"/>'
                 '</style:style>')
     #<style:style style:family="paragraph"/>
     self.assertEqual(style.serialize(), expected)
Esempio n. 2
0
 def test_create_style(self):
     style = Style('paragraph', 'style1')
     self.assertIn(style.serialize(),
                   (('<style:style style:name="style1" '
                     'style:family="paragraph"/>'),
                    ('<style:style style:family="paragraph" '
                     'style:name="style1"/>')))
Esempio n. 3
0
 def test_create_style_properties_shorcut(self):
     style = Style("paragraph", area="text", color="#ff0000")
     expected = ('<style:style style:family="paragraph">'
                 '<style:text-properties fo:color="#ff0000"/>'
                 "</style:style>")
     # <style:style style:family="paragraph"/>
     self.assertEqual(style.serialize(), expected)
Esempio n. 4
0
 def test_table_cell_border_border_left(self):
     style = Style('table-cell', border="0.002cm", border_left="0.002cm")
     self.assertEqual(
         style.serialize(),
         ('<style:style '
          'style:family="table-cell"><style:table-cell-properties '
          'fo:border="0.002cm"/></style:style>'))
Esempio n. 5
0
 def test_table_cell_shadow(self):
     style = Style('table-cell', shadow="#808080 0.176cm 0.176cm")
     self.assertEqual(
         style.serialize(),
         ('<style:style '
          'style:family="table-cell"><style:table-cell-properties '
          'style:shadow="#808080 0.176cm 0.176cm"/></style:style>'))
Esempio n. 6
0
 def test_table_row_height(self):
     style = Style('table-row', height="5cm")
     self.assertEqual(
         style.serialize(),
         ('<style:style '
          'style:family="table-row"><style:table-row-properties '
          'style:row-height="5cm"/></style:style>'))
Esempio n. 7
0
 def test_table_column_width(self):
     style = Style('table-column', width="5cm")
     self.assertEqual(
         style.serialize(),
         ('<style:style '
          'style:family="table-column"><style:table-column-properties '
          'style:column-width="5cm"/></style:style>'))
Esempio n. 8
0
    def test_insert_common_style(self):
        doc = self.doc

        style = Style('paragraph', 'MyStyle')
        doc.insert_style(style)
        inserted_style = doc.get_style('paragraph', 'MyStyle')

        self.assertEqual(style.serialize(), inserted_style.serialize())
Esempio n. 9
0
 def test_table_cell_border(self):
     style = Style("table-cell", border="0.002cm")
     self.assertEqual(
         style.serialize(),
         ("<style:style "
          'style:family="table-cell"><style:table-cell-properties '
          'fo:border="0.002cm"/></style:style>'),
     )
Esempio n. 10
0
    def test_insert_master_page_style(self):
        doc = self.doc

        style = Style('master-page', 'MyPageStyle')
        doc.insert_style(style)

        inserted_style = doc.get_style('master-page', 'MyPageStyle')
        self.assertEqual(style.serialize(), inserted_style.serialize())
Esempio n. 11
0
 def test_create_style_paragraph(self):
     style = Style("paragraph", "style1")
     expected = ()
     self.assertIn(
         style.serialize(),
         (
             ('<style:style style:family="paragraph" '
              'style:name="style1"/>'),
             ('<style:style style:name="style1" '
              'style:family="paragraph"/>'),
         ),
     )
Esempio n. 12
0
    def test_table_cell_border_all(self):
        style = Style('table-cell',
                      border_top='0.001cm',
                      border_right='0.002cm',
                      border_bottom='0.003cm',
                      border_left='0.004cm')

        self.assertIn(
            style.serialize(),
            (('<style:style '
              'style:family="table-cell"><style:table-cell-properties '
              'fo:border-top="0.001cm" fo:border-right="0.002cm" '
              'fo:border-bottom="0.003cm" fo:border-left="0.004cm"/>'
              '</style:style>'),
             ('<style:style '
              'style:family="table-cell"><style:table-cell-properties '
              'fo:border-bottom="0.003cm" fo:border-left="0.004cm" '
              'fo:border-right="0.002cm" fo:border-top="0.001cm"/>'
              '</style:style>')))
Esempio n. 13
0
 def test_table_cell_border_top(self):
     style = Style("table-cell", border_top="0.002cm")
     self.assertIn(
         style.serialize(),
         (
             ("<style:style "
              'style:family="table-cell"><style:table-cell-properties '
              'fo:border-bottom="none" fo:border-left="none" '
              'fo:border-right="none" fo:border-top="0.002cm"/>'
              "</style:style>"),
             ("<style:style "
              'style:family="table-cell"><style:table-cell-properties '
              'fo:border-top="0.002cm" fo:border-right="none" '
              'fo:border-bottom="none" fo:border-left="none"/>'
              "</style:style>"),
             ("<style:style "
              'style:family="table-cell"><style:table-cell-properties '
              'fo:border-top="0.002cm" fo:border-left="none" '
              'fo:border-right="none" fo:border-bottom="none"/>'
              "</style:style>"),
         ),
     )
Esempio n. 14
0
 def test_create_style_outline(self):
     style = Style("outline")
     expected = "<text:outline-style/>"
     self.assertEqual(style.serialize(), expected)
Esempio n. 15
0
 def test_create_style_page_layout(self):
     style = Style("page-layout")
     expected = "<style:page-layout/>"
     self.assertEqual(style.serialize(), expected)
Esempio n. 16
0
 def test_create_style_master_page(self):
     style = Style("master-page")
     expected = "<style:master-page/>"
     self.assertEqual(style.serialize(), expected)
Esempio n. 17
0
 def test_create_style_properties(self):
     style = Style('paragraph', **{'fo:margin-top': "0cm"})
     expected = ('<style:style style:family="paragraph">'
                 '<style:paragraph-properties fo:margin-top="0cm"/>'
                 '</style:style>')
     self.assertEqual(style.serialize(), expected)
Esempio n. 18
0
 def test_create_style_parent(self):
     style = Style('paragraph', parent_style="Heading 1")
     expected = ('<style:style style:family="paragraph" '
                 'style:parent-style-name="Heading 1"/>')
     self.assertEqual(style.serialize(), expected)
Esempio n. 19
0
 def test_create_style_text(self):
     style = Style('text')
     expected = ('<style:style style:family="text"/>')
     self.assertEqual(style.serialize(), expected)
Esempio n. 20
0
 def test_create_style_master_page(self):
     style = Style('master-page')
     expected = ('<style:master-page/>')
     self.assertEqual(style.serialize(), expected)
Esempio n. 21
0
 def test_create_style_page_layout(self):
     style = Style('page-layout')
     expected = ('<style:page-layout/>')
     self.assertEqual(style.serialize(), expected)
Esempio n. 22
0
 def test_create_style_outline(self):
     style = Style('outline')
     expected = ('<text:outline-style/>')
     self.assertEqual(style.serialize(), expected)
Esempio n. 23
0
 def test_create_style_list(self):
     style = Style('list')
     expected = ('<text:list-style/>')
     self.assertEqual(style.serialize(), expected)
Esempio n. 24
0
 def test_create_style_section(self):
     style = Style('section')
     expected = ('<style:style style:family="section"/>')
     self.assertEqual(style.serialize(), expected)
Esempio n. 25
0
 def test_create_style_table_row(self):
     style = Style("table-row")
     expected = '<style:style style:family="table-row"/>'
     self.assertEqual(style.serialize(), expected)
Esempio n. 26
0
 def test_create_style_graphic(self):
     style = Style('graphic')
     expected = ('<style:style style:family="graphic"/>')
     self.assertEqual(style.serialize(), expected)
Esempio n. 27
0
 def test_create_style_list(self):
     style = Style("list")
     expected = "<text:list-style/>"
     self.assertEqual(style.serialize(), expected)
Esempio n. 28
0
 def test_create_style_table_cell(self):
     style = Style('table-cell')
     expected = ('<style:style style:family="table-cell"/>')
     self.assertEqual(style.serialize(), expected)
Esempio n. 29
0
 def test_create_style_display_name(self):
     style = Style('paragraph', display_name="Heading 1")
     expected = ('<style:style style:family="paragraph" '
                 'style:display-name="Heading 1"/>')
     self.assertEqual(style.serialize(), expected)