Exemplo n.º 1
0
    def but_it_clears_the_target_slide_if_None_is_assigned(
            self, _clear_click_action_):
        action_setting = ActionSetting(element("p:cNvPr{a:b=c,r:s=t}"), None)

        action_setting.target_slide = None

        _clear_click_action_.assert_called_once_with(action_setting)
        assert action_setting._element.xml == xml("p:cNvPr{a:b=c,r:s=t}")
 def action_fixture(self, request):
     cNvPr_cxml, action_text, expected_action = request.param
     cNvPr = element(cNvPr_cxml)
     if action_text is not None:
         cNvPr.hlinkClick.action = action_text
     action_setting = ActionSetting(cNvPr, None)
     return action_setting, expected_action
Exemplo n.º 3
0
 def _slide_index_fixture(self, request, part_prop_):
     action_setting = ActionSetting(None, None)
     slide = part_prop_.return_value
     slides = slide.package.presentation.slides
     expected_value = 123
     slides.index.return_value = expected_value
     return action_setting, slides, slide, expected_value
Exemplo n.º 4
0
    def it_can_change_its_slide_jump_target(self, request,
                                            _clear_click_action_, slide_,
                                            part_prop_, part_):
        part_prop_.return_value = part_
        part_.relate_to.return_value = "rId42"
        slide_part_ = instance_mock(request, SlidePart)
        slide_.part = slide_part_
        action_setting = ActionSetting(element("p:cNvPr{a:b=c,r:s=t}"), None)

        action_setting.target_slide = slide_

        _clear_click_action_.assert_called_once_with(action_setting)
        part_.relate_to.assert_called_once_with(slide_part_, RT.SLIDE)
        assert action_setting._element.xml == xml(
            "p:cNvPr{a:b=c,r:s=t}/a:hlinkClick{action=ppaction://hlinksldjump,r:id=rI"
            "d42}", )
 def target_raise_fixture(self, request, action_prop_, part_prop_,
                          _slide_index_prop_):
     action_type, slide_idx = request.param
     action_setting = ActionSetting(None, None)
     action_prop_.return_value = action_type
     # this becomes the return value of ActionSetting._slides
     part_prop_.return_value.package.presentation.slides = [0, 1, 2]
     _slide_index_prop_.return_value = slide_idx
     return action_setting
    def clear_fixture(self, request, part_prop_, slide_part_):
        xPr_cxml, rId, expected_cxml = request.param
        action_setting = ActionSetting(element(xPr_cxml), None)

        part_prop_.return_value = slide_part_

        calls = [call(rId)] if rId else []
        expected_xml = xml(expected_cxml)
        return action_setting, calls, expected_xml
Exemplo n.º 7
0
    def click_action(self):
        """|ActionSetting| instance providing access to click behaviors.

        Click behaviors are hyperlink-like behaviors including jumping to
        a hyperlink (web page) or to another slide in the presentation. The
        click action is that defined on the overall shape, not a run of text
        within the shape. An |ActionSetting| object is always returned, even
        when no click behavior is defined on the shape.
        """
        cNvPr = self._element._nvXxPr.cNvPr
        return ActionSetting(cNvPr, self)
    def target_set_fixture(self, request, slide_, _clear_click_action_,
                           part_prop_, slide_part_):
        value_key, expected_cxml = request.param
        action_setting = ActionSetting(element("p:cNvPr{a:b=c,r:s=t}"), None)
        value = None if value_key is None else slide_

        part_prop_.return_value = slide_part_
        slide_part_.relate_to.return_value = "rId42"
        slide_.part = slide_part_

        expected_xml = xml(expected_cxml)
        calls = [] if value is None else [call(slide_part_, RT.SLIDE)]
        return action_setting, value, expected_xml, slide_part_, calls
 def target_get_fixture(self, request, action_prop_, _slide_index_prop_,
                        part_prop_):
     action_type, expected_value = request.param
     cNvPr = element("p:cNvPr/a:hlinkClick{r:id=rId6}")
     action_setting = ActionSetting(cNvPr, None)
     action_prop_.return_value = action_type
     _slide_index_prop_.return_value = 2
     # this becomes the return value of ActionSetting._slides
     prs_part_ = part_prop_.return_value.package.presentation_part
     prs_part_.presentation.slides = [0, 1, 2, 3, 4, 5]
     related_parts_ = part_prop_.return_value.related_parts
     related_parts_.__getitem__.return_value.slide = 4
     return action_setting, expected_value
Exemplo n.º 10
0
 def target_slide_fixture(self, request, action_prop_, _slide_index_prop_,
                          part_prop_):
     action_type, expected_value = request.param
     cNvPr = element('p:cNvPr/a:hlinkClick{r:id=rId6}')
     action_setting = ActionSetting(cNvPr, None)
     action_prop_.return_value = action_type
     _slide_index_prop_.return_value = 2
     # this becomes the return value of ActionSetting._slides
     part_prop_.return_value.package.presentation.slides = [
         0, 1, 2, 3, 4, 5
     ]
     part_prop_.return_value.rels.related_parts = {'rId6': 4}
     return action_setting, expected_value
 def hyperlink_fixture(self, Hyperlink_, hyperlink_):
     xPr, parent = "xPr", "parent"
     action_setting = ActionSetting(xPr, parent)
     return action_setting, hyperlink_, Hyperlink_, xPr, parent
Exemplo n.º 12
0
 def hyperlink_fixture(self, Hyperlink_, hyperlink_):
     xPr, parent = 'xPr', 'parent'
     action_setting = ActionSetting(xPr, parent)
     return action_setting, hyperlink_, Hyperlink_, xPr, parent