5252)
5353from pptx .slide import SlideLayout , SlideMaster
5454from pptx .table import Table
55- from pptx .util import Emu
55+ from pptx .util import Emu , Inches
5656
5757from ..oxml .unitdata .shape import a_ph , a_pic , an_nvPr , an_nvSpPr , an_sp
5858from ..unitutil .cxml import element , xml
@@ -375,10 +375,30 @@ def it_can_add_an_ole_object(
375375 x , y , cx , cy = 1 , 2 , 3 , 4
376376 shapes = _BaseGroupShapes (element ("p:spTree" ), None )
377377
378- shape = shapes .add_ole_object ("worksheet.xlsx" , PROG_ID .XLSX , x , y , cx , cy )
378+ shape = shapes .add_ole_object (
379+ "worksheet.xlsx" ,
380+ PROG_ID .XLSX ,
381+ x ,
382+ y ,
383+ cx ,
384+ cy ,
385+ "test.xlsx" ,
386+ Inches (0.5 ),
387+ Inches (0.75 ),
388+ )
379389
380390 _OleObjectElementCreator_ .graphicFrame .assert_called_once_with (
381- shapes , 42 , "worksheet.xlsx" , PROG_ID .XLSX , x , y , cx , cy , None
391+ shapes ,
392+ 42 ,
393+ "worksheet.xlsx" ,
394+ PROG_ID .XLSX ,
395+ x ,
396+ y ,
397+ cx ,
398+ cy ,
399+ "test.xlsx" ,
400+ Inches (0.5 ),
401+ Inches (0.75 ),
382402 )
383403 assert shapes ._spTree [- 1 ] is graphicFrame
384404 _recalculate_extents_ .assert_called_once_with (shapes )
@@ -2093,11 +2113,32 @@ def it_provides_a_graphicFrame_interface_method(self, request, shapes_):
20932113 )
20942114
20952115 graphicFrame = _OleObjectElementCreator .graphicFrame (
2096- shapes_ , shape_id , "sheet.xlsx" , PROG_ID .XLSX , x , y , cx , cy , "icon.png"
2116+ shapes_ ,
2117+ shape_id ,
2118+ "sheet.xlsx" ,
2119+ PROG_ID .XLSX ,
2120+ x ,
2121+ y ,
2122+ cx ,
2123+ cy ,
2124+ "icon.png" ,
2125+ Inches (0.5 ),
2126+ Inches (0.75 ),
20972127 )
20982128
20992129 _init_ .assert_called_once_with (
2100- ANY , shapes_ , shape_id , "sheet.xlsx" , PROG_ID .XLSX , x , y , cx , cy , "icon.png"
2130+ ANY ,
2131+ shapes_ ,
2132+ shape_id ,
2133+ "sheet.xlsx" ,
2134+ PROG_ID .XLSX ,
2135+ x ,
2136+ y ,
2137+ cx ,
2138+ cy ,
2139+ "icon.png" ,
2140+ Inches (0.5 ),
2141+ Inches (0.75 ),
21012142 )
21022143 _graphicFrame_prop_ .assert_called_once_with ()
21032144 assert graphicFrame is graphicFrame_
@@ -2119,7 +2160,7 @@ def it_creates_the_graphicFrame_element(self, request):
21192160 property_mock (request , _OleObjectElementCreator , "_cx" , return_value = cx )
21202161 property_mock (request , _OleObjectElementCreator , "_cy" , return_value = cy )
21212162 element_creator = _OleObjectElementCreator (
2122- None , shape_id , None , None , x , y , cx , cy , None
2163+ None , shape_id , None , None , x , y , cx , cy , None , Inches ( 0.5 ), Inches ( 0.75 )
21232164 )
21242165
21252166 assert element_creator ._graphicFrame .xml == (
@@ -2183,9 +2224,9 @@ def it_creates_the_graphicFrame_element(self, request):
21832224 (None , "Foo.Bar.6" , Emu (965200 )),
21842225 ),
21852226 )
2186- def it_determines_the_icon_width_to_help (self , cx_arg , prog_id , expected_value ):
2227+ def it_determines_the_shape_width_to_help (self , cx_arg , prog_id , expected_value ):
21872228 element_creator = _OleObjectElementCreator (
2188- None , None , None , prog_id , None , None , cx_arg , None , None
2229+ None , None , None , prog_id , None , None , cx_arg , None , None , None , None
21892230 )
21902231 assert element_creator ._cx == expected_value
21912232
@@ -2199,9 +2240,9 @@ def it_determines_the_icon_width_to_help(self, cx_arg, prog_id, expected_value):
21992240 (None , "Foo.Bar.6" , Emu (609600 )),
22002241 ),
22012242 )
2202- def it_determines_the_icon_height_to_help (self , cy_arg , prog_id , expected_value ):
2243+ def it_determines_the_shape_height_to_help (self , cy_arg , prog_id , expected_value ):
22032244 element_creator = _OleObjectElementCreator (
2204- None , None , None , prog_id , None , None , None , cy_arg , None
2245+ None , None , None , prog_id , None , None , None , cy_arg , None , None , None
22052246 )
22062247 assert element_creator ._cy == expected_value
22072248
@@ -2219,7 +2260,7 @@ def it_resolves_the_icon_image_file_to_help(
22192260 self , icon_file_arg , prog_id , expected_value
22202261 ):
22212262 element_creator = _OleObjectElementCreator (
2222- None , None , None , prog_id , None , None , None , None , icon_file_arg
2263+ None , None , None , prog_id , None , None , None , None , icon_file_arg , None , None
22232264 )
22242265 assert element_creator ._icon_image_file .endswith (expected_value )
22252266
@@ -2235,7 +2276,7 @@ def it_adds_and_relates_the_icon_image_part_to_help(
22352276 slide_part_ .get_or_add_image_part .return_value = None , "rId16"
22362277 _slide_part_prop_ .return_value = slide_part_
22372278 element_creator = _OleObjectElementCreator (
2238- None , None , None , None , None , None , None , None , None
2279+ None , None , None , None , None , None , None , None , None , None , None
22392280 )
22402281
22412282 rId = element_creator ._icon_rId
@@ -2250,7 +2291,17 @@ def it_adds_and_relates_the_ole_object_part_to_help(
22502291 slide_part_ .add_embedded_ole_object_part .return_value = "rId14"
22512292 _slide_part_prop_ .return_value = slide_part_
22522293 element_creator = _OleObjectElementCreator (
2253- None , None , ole_object_file , PROG_ID .DOCX , None , None , None , None , None
2294+ None ,
2295+ None ,
2296+ ole_object_file ,
2297+ PROG_ID .DOCX ,
2298+ None ,
2299+ None ,
2300+ None ,
2301+ None ,
2302+ None ,
2303+ None ,
2304+ None ,
22542305 )
22552306
22562307 rId = element_creator ._ole_object_rId
@@ -2271,21 +2322,21 @@ def it_adds_and_relates_the_ole_object_part_to_help(
22712322 )
22722323 def it_resolves_the_progId_str_to_help (self , prog_id_arg , expected_value ):
22732324 element_creator = _OleObjectElementCreator (
2274- None , None , None , prog_id_arg , None , None , None , None , None
2325+ None , None , None , prog_id_arg , None , None , None , None , None , None , None
22752326 )
22762327 assert element_creator ._progId == expected_value
22772328
22782329 def it_computes_the_shape_name_to_help (self ):
22792330 shape_id = 42
22802331 element_creator = _OleObjectElementCreator (
2281- None , shape_id , None , None , None , None , None , None , None
2332+ None , shape_id , None , None , None , None , None , None , None , None , None
22822333 )
22832334 assert element_creator ._shape_name == "Object 41"
22842335
22852336 def it_provides_access_to_the_slide_part_to_help (self , shapes_ , slide_part_ ):
22862337 shapes_ .part = slide_part_
22872338 element_creator = _OleObjectElementCreator (
2288- shapes_ , None , None , None , None , None , None , None , None
2339+ shapes_ , None , None , None , None , None , None , None , None , None , None
22892340 )
22902341
22912342 assert element_creator ._slide_part is slide_part_
0 commit comments