コード例 #1
0
 def autosize_get_fixture(self, request):
     auto_size = request.param
     bodyPr_bldr = self.bodyPr_bldr_with_autofit(auto_size)
     txBody = a_txBody().with_nsdecls().with_child(bodyPr_bldr).element
     textframe = TextFrame(txBody, None)
     expected_value = auto_size
     return textframe, expected_value
コード例 #2
0
 def autosize_set_fixture(self, request):
     auto_size = request.param
     txBody = a_txBody().with_nsdecls().with_child(a_bodyPr()).element
     textframe = TextFrame(txBody, None)
     value = auto_size
     expected_xml = (a_txBody().with_nsdecls().with_child(
         self.bodyPr_bldr_with_autofit(auto_size))).xml()
     return textframe, value, expected_xml
コード例 #3
0
ファイル: test_text.py プロジェクト: CSberger/python-pptx
    def it_can_change_the_word_wrap_setting(
            self, txBody, txBody_with_wrap_on_xml, txBody_with_wrap_off_xml,
            txBody_xml):
        textframe = TextFrame(txBody, None)
        assert textframe.word_wrap is None

        textframe.word_wrap = True
        assert actual_xml(textframe._txBody) == txBody_with_wrap_on_xml
        assert textframe.word_wrap is True

        textframe.word_wrap = False
        assert actual_xml(textframe._txBody) == txBody_with_wrap_off_xml
        assert textframe.word_wrap is False

        textframe.word_wrap = None
        assert actual_xml(textframe._txBody) == txBody_xml
        assert textframe.word_wrap is None
コード例 #4
0
    def it_can_change_the_word_wrap_setting(self, txBody,
                                            txBody_with_wrap_on_xml,
                                            txBody_with_wrap_off_xml,
                                            txBody_xml):
        textframe = TextFrame(txBody, None)
        assert textframe.word_wrap is None

        textframe.word_wrap = True
        assert actual_xml(textframe._txBody) == txBody_with_wrap_on_xml
        assert textframe.word_wrap is True

        textframe.word_wrap = False
        assert actual_xml(textframe._txBody) == txBody_with_wrap_off_xml
        assert textframe.word_wrap is False

        textframe.word_wrap = None
        assert actual_xml(textframe._txBody) == txBody_xml
        assert textframe.word_wrap is None
コード例 #5
0
    def it_can_get_its_margin_settings(self, txBody, txBody_with_lIns,
                                       txBody_with_tIns, txBody_with_rIns,
                                       txBody_with_bIns):

        textframe = TextFrame(txBody, None)
        assert textframe.margin_left is None
        assert textframe.margin_top is None
        assert textframe.margin_right is None
        assert textframe.margin_bottom is None

        textframe = TextFrame(txBody_with_lIns, None)
        assert textframe.margin_left == Inches(0.01)

        textframe = TextFrame(txBody_with_tIns, None)
        assert textframe.margin_top == Inches(0.02)

        textframe = TextFrame(txBody_with_rIns, None)
        assert textframe.margin_right == Inches(0.03)

        textframe = TextFrame(txBody_with_bIns, None)
        assert textframe.margin_bottom == Inches(0.04)
コード例 #6
0
ファイル: test_text.py プロジェクト: CSberger/python-pptx
    def it_can_change_its_margin_settings(
            self, txBody_bldr, txBody_with_lIns_xml, txBody_with_tIns_xml,
            txBody_with_rIns_xml, txBody_with_bIns_xml):

        textframe = TextFrame(txBody_bldr.element, None)
        textframe.margin_left = Inches(0.01)
        assert actual_xml(textframe._txBody) == txBody_with_lIns_xml

        textframe = TextFrame(txBody_bldr.element, None)
        textframe.margin_top = Inches(0.02)
        assert actual_xml(textframe._txBody) == txBody_with_tIns_xml

        textframe = TextFrame(txBody_bldr.element, None)
        textframe.margin_right = Inches(0.03)
        assert actual_xml(textframe._txBody) == txBody_with_rIns_xml

        textframe = TextFrame(txBody_bldr.element, None)
        textframe.margin_bottom = Inches(0.04)
        assert actual_xml(textframe._txBody) == txBody_with_bIns_xml
コード例 #7
0
ファイル: test_text.py プロジェクト: CSberger/python-pptx
 def it_can_change_its_vertical_anchor_setting(
         self, txBody, txBody_with_anchor_ctr_xml):
     textframe = TextFrame(txBody, None)
     textframe.vertical_anchor = MSO_ANCHOR.MIDDLE
     assert actual_xml(textframe._txBody) == txBody_with_anchor_ctr_xml
コード例 #8
0
    def it_can_change_its_margin_settings(self, txBody_bldr,
                                          txBody_with_lIns_xml,
                                          txBody_with_tIns_xml,
                                          txBody_with_rIns_xml,
                                          txBody_with_bIns_xml):

        textframe = TextFrame(txBody_bldr.element, None)
        textframe.margin_left = Inches(0.01)
        assert actual_xml(textframe._txBody) == txBody_with_lIns_xml

        textframe = TextFrame(txBody_bldr.element, None)
        textframe.margin_top = Inches(0.02)
        assert actual_xml(textframe._txBody) == txBody_with_tIns_xml

        textframe = TextFrame(txBody_bldr.element, None)
        textframe.margin_right = Inches(0.03)
        assert actual_xml(textframe._txBody) == txBody_with_rIns_xml

        textframe = TextFrame(txBody_bldr.element, None)
        textframe.margin_bottom = Inches(0.04)
        assert actual_xml(textframe._txBody) == txBody_with_bIns_xml
コード例 #9
0
 def it_can_replace_the_text_it_contains(self, txBody,
                                         txBody_with_text_xml):
     textframe = TextFrame(txBody, None)
     textframe.text = 'foobar'
     assert actual_xml(txBody) == txBody_with_text_xml
コード例 #10
0
 def it_can_add_a_paragraph_to_the_text_it_contains(
         self, txBody, txBody_with_2_paras_xml):
     textframe = TextFrame(txBody, None)
     textframe.add_paragraph()
     assert actual_xml(textframe._txBody) == txBody_with_2_paras_xml
コード例 #11
0
ファイル: test_text.py プロジェクト: rokclimb15/python-pptx
 def margin_get_fixture(self, request):
     txBody_cxml, side, unit, expected_value = request.param
     text_frame = TextFrame(element(txBody_cxml), None)
     prop_name = "margin_%s" % side
     return text_frame, prop_name, unit, expected_value
コード例 #12
0
ファイル: test_text.py プロジェクト: CSberger/python-pptx
 def it_can_replace_the_text_it_contains(
         self, txBody, txBody_with_text_xml):
     textframe = TextFrame(txBody, None)
     textframe.text = 'foobar'
     assert actual_xml(txBody) == txBody_with_text_xml
コード例 #13
0
 def textframe(self, txBody):
     return TextFrame(txBody, None)
コード例 #14
0
 def it_can_change_its_vertical_anchor_setting(self, txBody,
                                               txBody_with_anchor_ctr_xml):
     textframe = TextFrame(txBody, None)
     textframe.vertical_anchor = MSO_ANCHOR.MIDDLE
     assert actual_xml(textframe._txBody) == txBody_with_anchor_ctr_xml
コード例 #15
0
ファイル: test_text.py プロジェクト: rokclimb15/python-pptx
 def text_get_fixture(self, request):
     txBody_cxml, expected_value = request.param
     text_frame = TextFrame(element(txBody_cxml), None)
     return text_frame, expected_value
コード例 #16
0
ファイル: test_text.py プロジェクト: rokclimb15/python-pptx
 def margin_set_fixture(self, request):
     txBody_cxml, side, new_value, expected_txBody_cxml = request.param
     text_frame = TextFrame(element(txBody_cxml), None)
     prop_name = "margin_%s" % side
     expected_xml = xml(expected_txBody_cxml)
     return text_frame, prop_name, new_value, expected_xml
コード例 #17
0
ファイル: test_text.py プロジェクト: CSberger/python-pptx
 def it_can_add_a_paragraph_to_the_text_it_contains(
         self, txBody, txBody_with_2_paras_xml):
     textframe = TextFrame(txBody, None)
     textframe.add_paragraph()
     assert actual_xml(textframe._txBody) == txBody_with_2_paras_xml
コード例 #18
0
 def textframe_with_parent_(self, request):
     parent_ = loose_mock(request, name='parent_')
     textframe = TextFrame(None, parent_)
     return textframe, parent_
コード例 #19
0
 def it_knows_the_number_of_paragraphs_it_contains(self, txBody,
                                                   txBody_with_2_paras):
     assert len(TextFrame(txBody, None).paragraphs) == 1
     assert len(TextFrame(txBody_with_2_paras, None).paragraphs) == 2
コード例 #20
0
ファイル: test_text.py プロジェクト: rokclimb15/python-pptx
 def autosize_set_fixture(self, request):
     txBody_cxml, value, expected_cxml = request.param
     text_frame = TextFrame(element(txBody_cxml), None)
     expected_xml = xml(expected_cxml)
     return text_frame, value, expected_xml