Пример #1
0
 def test_has_table_return_value(self):
     """CT_GraphicalObjectFrame.has_table property has correct value"""
     # setup ------------------------
     id_, name = 9, 'Table 8'
     left, top, width, height = 111, 222, 333, 444
     tbl_uri = 'http://schemas.openxmlformats.org/drawingml/2006/table'
     chart_uri = 'http://schemas.openxmlformats.org/drawingml/2006/chart'
     graphicFrame = CT_GraphicalObjectFrame.new_graphicFrame(
         id_, name, left, top, width, height)
     graphicData = graphicFrame[qn('a:graphic')].graphicData
     # verify -----------------------
     graphicData.set('uri', tbl_uri)
     assert_that(graphicFrame.has_table, is_(equal_to(True)))
     graphicData.set('uri', chart_uri)
     assert_that(graphicFrame.has_table, is_(equal_to(False)))
Пример #2
0
 def test_has_table_return_value(self):
     """CT_GraphicalObjectFrame.has_table property has correct value"""
     # setup ------------------------
     id_, name = 9, 'Table 8'
     left, top, width, height = 111, 222, 333, 444
     tbl_uri = 'http://schemas.openxmlformats.org/drawingml/2006/table'
     chart_uri = 'http://schemas.openxmlformats.org/drawingml/2006/chart'
     graphicFrame = CT_GraphicalObjectFrame.new_graphicFrame(
         id_, name, left, top, width, height)
     graphicData = graphicFrame[qn('a:graphic')].graphicData
     # verify -----------------------
     graphicData.set('uri', tbl_uri)
     assert_that(graphicFrame.has_table, is_(equal_to(True)))
     graphicData.set('uri', chart_uri)
     assert_that(graphicFrame.has_table, is_(equal_to(False)))
Пример #3
0
 def test_new_graphicFrame_generates_correct_xml(self):
     """CT_GraphicalObjectFrame.new_graphicFrame() returns correct XML"""
     # setup ------------------------
     id_, name = 9, 'Table 8'
     left, top, width, height = 111, 222, 333, 444
     xml = (
         '<p:graphicFrame %s>\n  <p:nvGraphicFramePr>\n    <p:cNvPr id="%d'
         '" name="%s"/>\n    <p:cNvGraphicFramePr>\n      <a:graphicFrameL'
         'ocks noGrp="1"/>\n    </p:cNvGraphicFramePr>\n    <p:nvPr/>\n  <'
         '/p:nvGraphicFramePr>\n  <p:xfrm>\n    <a:off x="%d" y="%d"/>\n  '
         '  <a:ext cx="%d" cy="%d"/>\n  </p:xfrm>\n  <a:graphic>\n    <a:g'
         'raphicData/>\n  </a:graphic>\n</p:graphicFrame>\n' %
         (nsdecls('a', 'p'), id_, name, left, top, width, height))
     # exercise ---------------------
     graphicFrame = CT_GraphicalObjectFrame.new_graphicFrame(
         id_, name, left, top, width, height)
     # verify -----------------------
     self.assertEqualLineByLine(xml, graphicFrame)
Пример #4
0
 def test_new_graphicFrame_generates_correct_xml(self):
     """CT_GraphicalObjectFrame.new_graphicFrame() returns correct XML"""
     # setup ------------------------
     id_, name = 9, 'Table 8'
     left, top, width, height = 111, 222, 333, 444
     xml = (
         '<p:graphicFrame %s>\n  <p:nvGraphicFramePr>\n    <p:cNvPr id="%d'
         '" name="%s"/>\n    <p:cNvGraphicFramePr>\n      <a:graphicFrameL'
         'ocks noGrp="1"/>\n    </p:cNvGraphicFramePr>\n    <p:nvPr/>\n  <'
         '/p:nvGraphicFramePr>\n  <p:xfrm>\n    <a:off x="%d" y="%d"/>\n  '
         '  <a:ext cx="%d" cy="%d"/>\n  </p:xfrm>\n  <a:graphic>\n    <a:g'
         'raphicData/>\n  </a:graphic>\n</p:graphicFrame>\n' %
         (nsdecls('a', 'p'), id_, name, left, top, width, height)
     )
     # exercise ---------------------
     graphicFrame = CT_GraphicalObjectFrame.new_graphicFrame(
         id_, name, left, top, width, height)
     # verify -----------------------
     self.assertEqualLineByLine(xml, graphicFrame)
Пример #5
0
 def it_can_construct_a_new_graphicFrame(self, new_graphicFrame_fixture):
     id_, name, x, y, cx, cy, expected_xml = new_graphicFrame_fixture
     graphicFrame = CT_GraphicalObjectFrame.new_graphicFrame(
         id_, name, x, y, cx, cy)
     assert graphicFrame.xml == expected_xml
Пример #6
0
 def it_can_construct_a_new_graphicFrame(self, new_graphicFrame_fixture):
     id_, name, x, y, cx, cy, expected_xml = new_graphicFrame_fixture
     graphicFrame = CT_GraphicalObjectFrame.new_graphicFrame(id_, name, x, y, cx, cy)
     assert graphicFrame.xml == expected_xml