Exemplo n.º 1
0
 def test_get_draw_rectangle_by_id(self):
     body = self.content.get_body()
     page = body.get_draw_page_by_position(0)
     rectangle = odf_create_rectangle(shape_id=u'an id')
     page.append_element(rectangle)
     rectangle = page.get_draw_rectangle_by_id(ur'an id')
     expected = ('<draw:rect draw:id="an id" svg:width="1cm" '
                 'svg:height="1cm"/>\n')
     self.assertEqual(rectangle.serialize(pretty=True), expected)
Exemplo n.º 2
0
 def test_get_draw_rectangle_by_id(self):
     body = self.content.get_body()
     page = body.get_draw_page()
     rectangle = odf_create_rectangle(shape_id=u'an id')
     page.append(rectangle)
     rectangle = page.get_draw_rectangle(id=ur'an id')
     expected = ('<draw:rect draw:id="an id" svg:width="1cm" '
                 'svg:height="1cm"/>\n')
     self.assertEqual(rectangle.serialize(pretty=True), expected)
Exemplo n.º 3
0
 def test_create_rectangle(self):
     page = odf_create_draw_page('Page1')
     rectangle = odf_create_rectangle(size=('2cm', '1cm'),
                                      position=('3cm', '4cm'))
     page.append_element(rectangle)
     expected = ('<draw:page draw:id="Page1">\n'
                 '  <draw:rect svg:width="2cm" svg:height="1cm" svg:x="3cm"'
                 ' svg:y="4cm"/>\n'
                 '</draw:page>\n')
     self.assertEqual(page.serialize(pretty=True), expected)
Exemplo n.º 4
0
 def test_create_rectangle(self):
     page = odf_create_draw_page('Page1')
     rectangle = odf_create_rectangle(size=('2cm', '1cm'),
                                      position=('3cm', '4cm'))
     page.append(rectangle)
     expected = ('<draw:page draw:id="Page1">\n'
                 '  <draw:rect svg:width="2cm" svg:height="1cm" svg:x="3cm"'
                 ' svg:y="4cm"/>\n'
                 '</draw:page>\n')
     self.assertEqual(page.serialize(pretty=True), expected)
Exemplo n.º 5
0
 def test_create_connector(self):
     page = odf_create_draw_page('Page1')
     rectangle = odf_create_rectangle(size=('2cm', '1cm'),
                                      position=('3cm', '4cm'),
                                      shape_id='rectangle')
     ellipse = odf_create_ellipse(size=('2cm', '1cm'),
                                  position=('3cm', '4cm'),
                                  shape_id='ellipse')
     connector = odf_create_connector(connected_shapes=(rectangle, ellipse),
                                      glue_points=(1, 2))
     page.append(rectangle)
     page.append(ellipse)
     page.append(connector)
     expected = ('<draw:page draw:id="Page1">\n'
                 '  <draw:rect draw:id="rectangle" svg:width="2cm" '
                 'svg:height="1cm" svg:x="3cm" svg:y="4cm"/>\n'
                 '  <draw:ellipse draw:id="ellipse" svg:width="2cm" '
                 'svg:height="1cm" svg:x="3cm" svg:y="4cm"/>\n'
                 '  <draw:connector draw:start-shape="rectangle" '
                 'draw:end-shape="ellipse" draw:start-glue-point="1" '
                 'draw:end-glue-point="2"/>\n'
                 '</draw:page>\n')
     self.assertEqual(page.serialize(pretty=True), expected)
Exemplo n.º 6
0
 def test_create_connector(self):
     page = odf_create_draw_page('Page1')
     rectangle = odf_create_rectangle(size=('2cm', '1cm'),
                                      position=('3cm', '4cm'),
                                      shape_id='rectangle')
     ellipse = odf_create_ellipse(size=('2cm', '1cm'),
                                  position=('3cm', '4cm'),
                                  shape_id='ellipse')
     connector = odf_create_connector(connected_shapes=(rectangle,
                                                        ellipse),
                                      glue_points=(1, 2))
     page.append_element(rectangle)
     page.append_element(ellipse)
     page.append_element(connector)
     expected = ('<draw:page draw:id="Page1">\n'
                 '  <draw:rect draw:id="rectangle" svg:width="2cm" '
                 'svg:height="1cm" svg:x="3cm" svg:y="4cm"/>\n'
                 '  <draw:ellipse draw:id="ellipse" svg:width="2cm" '
                 'svg:height="1cm" svg:x="3cm" svg:y="4cm"/>\n'
                 '  <draw:connector draw:start-shape="rectangle" '
                 'draw:end-shape="ellipse" draw:start-glue-point="1" '
                 'draw:end-glue-point="2"/>\n'
                 '</draw:page>\n')
     self.assertEqual(page.serialize(pretty=True), expected)
Exemplo n.º 7
0
page2.append(text_frame)

# Add a transition for this frame
page2.set_transition("fade", "fadeOverColor")

#
# Shapes
#

# Last page
page3 = odf_create_draw_page(u"page3")
body.append(page3)

# Square
square = odf_create_rectangle(shape_id=u"square",
                              size=('8cm', '8cm'),
                              position=('17cm', '2.5cm'),
                              style=u"colored")
page3.append(square)

# Circle
circle = odf_create_ellipse(shape_id=u"circle",
                            size=('8cm', '8cm'),
                            position=('2cm', '10cm'),
                            style=u"colored")
page3.append(circle)

# Line
line = odf_create_line(p1=('8cm', '5cm'), p2=('20cm', '17.5cm'))
page3.append(line)

# Connector
Exemplo n.º 8
0
page2.append(text_frame)

# Add a transition for this frame
page2.set_transition("fade", "fadeOverColor")

#
# Shapes
#

# Last page
page3 = odf_create_draw_page(u"page3")
body.append(page3)

# Square
square = odf_create_rectangle(shape_id=u"square", size=('8cm', '8cm'),
                              position=('17cm', '2.5cm'),
                              style=u"colored")
page3.append(square)

# Circle
circle = odf_create_ellipse(shape_id=u"circle", size=('8cm', '8cm'),
                            position=('2cm', '10cm'), style=u"colored")
page3.append(circle)

# Line
line = odf_create_line(p1=('8cm', '5cm'), p2=('20cm', '17.5cm'))
page3.append(line)

# Connector
connector = odf_create_connector(connected_shapes=(square, circle),
                                 glue_points=('1', '3'))