update PPTC examples into impress

This commit is contained in:
tsuky_chen
2024-02-20 19:58:09 +08:00
parent ad9d8f51c6
commit 0519b92396
38 changed files with 809 additions and 38 deletions

View File

@@ -148,6 +148,8 @@ def compare_pptx_files(file1_path, file2_path, **options):
examine_alignment = options.get("examine_alignment", True)
examine_bottom_position = options.get("examine_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)
examine_image_size = options.get("examine_image_size", False)
examine_modify_height = options.get("examine_modify_height", False)
examine_bullets = options.get("examine_bullets", True)
@@ -182,10 +184,10 @@ def compare_pptx_files(file1_path, file2_path, **options):
# 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 hasattr(shape1, "text") and hasattr(shape2, "text") and shape1.text == shape2.text and shape1.text == "Product Comparison":
if shape1.top <= shape2.top:
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 shape1.shape_type == 19 and shape2.shape_type == 19:
elif not hasattr(shape1, "text") and not hasattr(shape2, "text"):
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:
@@ -196,7 +198,19 @@ def compare_pptx_files(file1_path, file2_path, **options):
if not hasattr(shape1, "text") and not hasattr(shape2, "text"):
if shape1.left <= shape2.left:
return 0
if examine_top_position:
if shape1.top != shape2.top and not hasattr(shape1, "text") and not hasattr(shape2, "text"):
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_shape_for_shift_size:
if shape1.left != shape2.left or shape1.top != shape2.top or shape1.width != shape2.width or shape1.height != shape2.height:
if not (hasattr(shape1, "text") and hasattr(shape2, "text") and shape1.text == shape2.text and shape1.text == "Elaborate on what you want to discuss."):
return 0
if (shape1.left != shape2.left or shape1.top != shape2.top or shape1.width != shape2.width or shape1.height != shape2.height) and examine_shape:
return 0
@@ -208,9 +222,11 @@ def compare_pptx_files(file1_path, file2_path, **options):
return 0
if examine_modify_height:
if shape1.shape_type == 13 and shape2.shape_type == 13:
if not hasattr(shape1, "text") and not hasattr(shape2, "text") or shape1.shape_type == 5 and shape2.shape_type == 5:
if shape1.height != shape2.height:
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 hasattr(shape1, "text") and hasattr(shape2, "text"):
if shape1.text != shape2.text and examine_text: