fixed PPTC examples load
This commit is contained in:
@@ -146,7 +146,8 @@ def compare_pptx_files(file1_path, file2_path, **options):
|
||||
examine_font_underline = options.get("examine_font_underline", True)
|
||||
examine_strike_through = options.get("examine_strike_through", True)
|
||||
examine_alignment = options.get("examine_alignment", True)
|
||||
examine_bottom_position = options.get("examine_bottom_position", False)
|
||||
examine_title_bottom_position = options.get("examine_bottom_position", False)
|
||||
examine_table_bottom_position = options.get("examine_table_bottom_position", False)
|
||||
examine_right_position = options.get("examine_right_position", False)
|
||||
examine_top_position = options.get("examine_top_position", False)
|
||||
examine_shape_for_shift_size = options.get("examine_shape_for_shift_size", False)
|
||||
@@ -160,8 +161,10 @@ def compare_pptx_files(file1_path, file2_path, **options):
|
||||
if len(prs1.slides) != len(prs2.slides) and examine_number_of_slides:
|
||||
return 0
|
||||
|
||||
slide_idx = 0
|
||||
# compare the content of each slide
|
||||
for slide1, slide2 in zip(prs1.slides, prs2.slides):
|
||||
slide_idx += 1
|
||||
def get_slide_background_color(slide):
|
||||
background = slide.background
|
||||
if background.fill.background():
|
||||
@@ -183,19 +186,22 @@ def compare_pptx_files(file1_path, file2_path, **options):
|
||||
return 0
|
||||
# check if the shapes are the same
|
||||
for shape1, shape2 in zip(slide1.shapes, slide2.shapes):
|
||||
if examine_bottom_position and shape1.top != shape2.top:
|
||||
if examine_title_bottom_position:
|
||||
if hasattr(shape1, "text") and hasattr(shape2, "text") and shape1.text == shape2.text:
|
||||
if shape1.text == "Product Comparison" and shape1.top <= shape2.top:
|
||||
return 0
|
||||
elif not hasattr(shape1, "text") and not hasattr(shape2, "text"):
|
||||
elif shape1.left != shape2.left or shape1.top != shape2.top or shape1.width != shape2.width or shape1.height != shape2.height:
|
||||
return 0
|
||||
|
||||
if examine_table_bottom_position:
|
||||
if slide_idx == 3 and shape1.shape_type == 19 and shape2.shape_type == 19:
|
||||
if shape1.top <= shape2.top:
|
||||
return 0
|
||||
elif shape1.left != shape2.left or shape1.top != shape2.top or shape1.width != shape2.width or shape1.height != shape2.height:
|
||||
return 0
|
||||
|
||||
|
||||
if examine_right_position and shape1.left != shape2.left:
|
||||
if not hasattr(shape1, "text") and not hasattr(shape2, "text"):
|
||||
if examine_right_position:
|
||||
if slide_idx == 2 and not hasattr(shape1, "text") and not hasattr(shape2, "text"):
|
||||
if shape1.left <= shape2.left:
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user