|
21 | 21 | an_spPr, an_xfrm |
22 | 22 | ) |
23 | 23 | from .oxml.unitdata.text import an_r |
| 24 | +from .unitutil.cxml import element, xml |
24 | 25 | from .unitutil.mock import instance_mock |
25 | 26 |
|
26 | 27 |
|
@@ -58,37 +59,21 @@ def it_can_change_its_display_dimensions(self, dimensions_set_fixture): |
58 | 59 |
|
59 | 60 | @pytest.fixture |
60 | 61 | def dimensions_get_fixture(self): |
61 | | - cx, cy = 333, 666 |
62 | | - inline = self._inline_bldr_with_dimensions(cx, cy).element |
63 | | - inline_shape = InlineShape(inline) |
64 | | - return inline_shape, cx, cy |
| 62 | + inline_cxml, expected_cx, expected_cy = ( |
| 63 | + 'wp:inline/wp:extent{cx=333, cy=666}', 333, 666 |
| 64 | + ) |
| 65 | + inline_shape = InlineShape(element(inline_cxml)) |
| 66 | + return inline_shape, expected_cx, expected_cy |
65 | 67 |
|
66 | 68 | @pytest.fixture |
67 | 69 | def dimensions_set_fixture(self): |
68 | | - # inline_shape ----------------- |
69 | | - cx, cy = 333, 666 |
70 | | - inline = self._inline_bldr_with_dimensions(cx, cy).element |
71 | | - inline_shape = InlineShape(inline) |
72 | | - # expected_xml ----------------- |
73 | | - cx, cy = cx + 111, cy + 222 |
74 | | - expected_xml = self._inline_bldr_with_dimensions(cx, cy).xml() |
75 | | - return inline_shape, cx, cy, expected_xml |
76 | | - |
77 | | - @pytest.fixture |
78 | | - def image_params(self): |
79 | | - filename = 'foobar.garf' |
80 | | - rId = 'rId42' |
81 | | - cx, cy = 914422, 223344 |
82 | | - return filename, rId, cx, cy |
83 | | - |
84 | | - @pytest.fixture |
85 | | - def image_part_(self, request, image_params): |
86 | | - filename, rId, cx, cy = image_params |
87 | | - image_part_ = instance_mock(request, ImagePart) |
88 | | - image_part_.default_cx = cx |
89 | | - image_part_.default_cy = cy |
90 | | - image_part_.filename = filename |
91 | | - return image_part_ |
| 70 | + inline_cxml, new_cx, new_cy, expected_cxml = ( |
| 71 | + 'wp:inline/wp:extent{cx=333, cy=666}', 444, 888, |
| 72 | + 'wp:inline/wp:extent{cx=444, cy=888}' |
| 73 | + ) |
| 74 | + inline_shape = InlineShape(element(inline_cxml)) |
| 75 | + expected_xml = xml(expected_cxml) |
| 76 | + return inline_shape, new_cx, new_cy, expected_xml |
92 | 77 |
|
93 | 78 | @pytest.fixture |
94 | 79 | def new_picture_fixture(self, request, image_part_, image_params): |
@@ -144,11 +129,23 @@ def shape_type_fixture(self, request): |
144 | 129 |
|
145 | 130 | return InlineShape(inline), shape_type |
146 | 131 |
|
147 | | - def _inline_bldr_with_dimensions(self, cx, cy): |
148 | | - return ( |
149 | | - an_inline().with_nsdecls().with_child( |
150 | | - an_extent().with_cx(cx).with_cy(cy)) |
151 | | - ) |
| 132 | + # fixture components --------------------------------------------- |
| 133 | + |
| 134 | + @pytest.fixture |
| 135 | + def image_params(self): |
| 136 | + filename = 'foobar.garf' |
| 137 | + rId = 'rId42' |
| 138 | + cx, cy = 914422, 223344 |
| 139 | + return filename, rId, cx, cy |
| 140 | + |
| 141 | + @pytest.fixture |
| 142 | + def image_part_(self, request, image_params): |
| 143 | + filename, rId, cx, cy = image_params |
| 144 | + image_part_ = instance_mock(request, ImagePart) |
| 145 | + image_part_.default_cx = cx |
| 146 | + image_part_.default_cy = cy |
| 147 | + image_part_.filename = filename |
| 148 | + return image_part_ |
152 | 149 |
|
153 | 150 | def _inline_with_picture(self, embed=False, link=False): |
154 | 151 | picture_ns = nsmap['pic'] |
|
0 commit comments