示例#1
0
 def test_create_complex_page(self):
     element = DrawPage(
         "id1",
         name="Introduction",
         master_page="prs-novelty",
         presentation_page_layout="AL1T0",
         style="dp1",
     )
     self.assertIn(
         element.serialize(),
         (
             (
                 '<draw:page draw:id="id1" draw:name="Introduction" '
                 'draw:master-page-name="prs-novelty" '
                 'presentation:presentation-page-layout-name="AL1T0" '
                 'draw:style-name="dp1"/>'
             ),
             (
                 '<draw:page draw:id="id1" draw:name="Introduction" '
                 'draw:style-name="dp1" '
                 'draw:master-page-name="prs-novelty" '
                 'presentation:presentation-page-layout-name="AL1T0"/>'
             ),
         ),
     )
示例#2
0
 def test_create_line(self):
     page = DrawPage('Page1')
     line = LineShape(p1=('2cm', '2cm'), p2=('1cm', '1cm'))
     page.append(line)
     expected = ('<draw:page draw:id="Page1">\n'
                 '  <draw:line svg:x1="2cm" svg:y1="2cm" svg:x2="1cm" '
                 'svg:y2="1cm"/>\n'
                 '</draw:page>\n')
     self.assertEqual(page.serialize(pretty=True), expected)
示例#3
0
 def test_create_connector(self):
     page = DrawPage('Page1')
     rectangle = RectangleShape(size=('2cm', '1cm'),
                                position=('3cm', '4cm'),
                                draw_id='rectangle')
     ellipse = EllipseShape(size=('2cm', '1cm'),
                            position=('3cm', '4cm'),
                            draw_id='ellipse')
     connector = ConnectorShape(connected_shapes=(rectangle, ellipse),
                                glue_points=(1, 2))
     page.append(rectangle)
     page.append(ellipse)
     page.append(connector)
     expected = ('<draw:page draw:id="Page1">'
                 '<draw:rect draw:id="rectangle" '
                 'svg:x="3cm" svg:y="4cm" '
                 'svg:width="2cm" svg:height="1cm"/>'
                 '<draw:ellipse draw:id="ellipse" '
                 'svg:x="3cm" svg:y="4cm" '
                 'svg:width="2cm" svg:height="1cm"/>'
                 '<draw:connector draw:start-shape="rectangle" '
                 'draw:end-shape="ellipse" '
                 'draw:start-glue-point="1" '
                 'draw:end-glue-point="2"/>'
                 '</draw:page>')
     self.assertEqual(page.serialize(), expected)
示例#4
0
 def test_create_rectangle(self):
     page = DrawPage('Page1')
     rectangle = RectangleShape(size=('2cm', '1cm'),
                                position=('3cm', '4cm'))
     page.append(rectangle)
     self.assertIn(page.serialize(),
                   (('<draw:page draw:id="Page1">'
                     '<draw:rect svg:x="3cm" svg:y="4cm" '
                     'svg:width="2cm" svg:height="1cm"/>'
                     '</draw:page>'), ('<draw:page draw:id="Page1">'
                                       '<draw:rect svg:width="2cm" '
                                       'svg:height="1cm" svg:x="3cm"'
                                       ' svg:y="4cm"/>'
                                       '</draw:page>')))
示例#5
0
 def test_create_ellipse(self):
     page = DrawPage('Page1')
     svg_attrs = {
         'svg:width': '2cm',
         'svg:height': '2cm',
         'svg:x': '2cm',
         'svg:y': '2cm'
     }
     ellipse = EllipseShape(size=('2cm', '1cm'), position=('3cm', '4cm'))
     page.append(ellipse)
     expected = ('<draw:page draw:id="Page1">'
                 '<draw:ellipse '
                 'svg:x="3cm" svg:y="4cm" '
                 'svg:width="2cm" svg:height="1cm"/>'
                 '</draw:page>')
     self.assertEqual(page.serialize(), expected)
示例#6
0
文件: test_shapes.py 项目: jdum/odfdo
 def test_create_ellipse(self):
     page = DrawPage("Page1")
     svg_attrs = {
         "svg:width": "2cm",
         "svg:height": "2cm",
         "svg:x": "2cm",
         "svg:y": "2cm",
     }
     ellipse = EllipseShape(size=("2cm", "1cm"), position=("3cm", "4cm"))
     page.append(ellipse)
     expected = ('<draw:page draw:id="Page1">'
                 "<draw:ellipse "
                 'svg:x="3cm" svg:y="4cm" '
                 'svg:width="2cm" svg:height="1cm"/>'
                 "</draw:page>")
     self.assertEqual(page.serialize(), expected)
示例#7
0
文件: test_shapes.py 项目: jdum/odfdo
 def test_create_rectangle(self):
     page = DrawPage("Page1")
     rectangle = RectangleShape(size=("2cm", "1cm"),
                                position=("3cm", "4cm"))
     page.append(rectangle)
     self.assertIn(
         page.serialize(),
         (
             ('<draw:page draw:id="Page1">'
              '<draw:rect svg:x="3cm" svg:y="4cm" '
              'svg:width="2cm" svg:height="1cm"/>'
              "</draw:page>"),
             ('<draw:page draw:id="Page1">'
              '<draw:rect svg:width="2cm" '
              'svg:height="1cm" svg:x="3cm"'
              ' svg:y="4cm"/>'
              "</draw:page>"),
         ),
     )
示例#8
0
 def test_create_simple_page(self):
     element = DrawPage("id1")
     expected = '<draw:page draw:id="id1"/>'
     self.assertEqual(element.serialize(), expected)