예제 #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)
예제 #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"/>')))
예제 #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)
예제 #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>'))
예제 #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>'))
예제 #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>'))
예제 #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>'))
예제 #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())
예제 #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>'),
     )
예제 #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())
예제 #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"/>'),
         ),
     )
예제 #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>')))
예제 #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>"),
         ),
     )
예제 #14
0
 def test_create_style_outline(self):
     style = Style("outline")
     expected = "<text:outline-style/>"
     self.assertEqual(style.serialize(), expected)
예제 #15
0
 def test_create_style_page_layout(self):
     style = Style("page-layout")
     expected = "<style:page-layout/>"
     self.assertEqual(style.serialize(), expected)
예제 #16
0
 def test_create_style_master_page(self):
     style = Style("master-page")
     expected = "<style:master-page/>"
     self.assertEqual(style.serialize(), expected)
예제 #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)
예제 #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)
예제 #19
0
 def test_create_style_text(self):
     style = Style('text')
     expected = ('<style:style style:family="text"/>')
     self.assertEqual(style.serialize(), expected)
예제 #20
0
 def test_create_style_master_page(self):
     style = Style('master-page')
     expected = ('<style:master-page/>')
     self.assertEqual(style.serialize(), expected)
예제 #21
0
 def test_create_style_page_layout(self):
     style = Style('page-layout')
     expected = ('<style:page-layout/>')
     self.assertEqual(style.serialize(), expected)
예제 #22
0
 def test_create_style_outline(self):
     style = Style('outline')
     expected = ('<text:outline-style/>')
     self.assertEqual(style.serialize(), expected)
예제 #23
0
 def test_create_style_list(self):
     style = Style('list')
     expected = ('<text:list-style/>')
     self.assertEqual(style.serialize(), expected)
예제 #24
0
 def test_create_style_section(self):
     style = Style('section')
     expected = ('<style:style style:family="section"/>')
     self.assertEqual(style.serialize(), expected)
예제 #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)
예제 #26
0
 def test_create_style_graphic(self):
     style = Style('graphic')
     expected = ('<style:style style:family="graphic"/>')
     self.assertEqual(style.serialize(), expected)
예제 #27
0
 def test_create_style_list(self):
     style = Style("list")
     expected = "<text:list-style/>"
     self.assertEqual(style.serialize(), expected)
예제 #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)
예제 #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)