diff --git a/scripts/generate_test_mask_image.py b/scripts/generate_test_mask_image.py index 441adfc3c45..369442a9267 100644 --- a/scripts/generate_test_mask_image.py +++ b/scripts/generate_test_mask_image.py @@ -72,11 +72,14 @@ def updateMask(control_image_path, rendered_image_path, mask_image_path): if not rendered_image: error('Could not read rendered image {}'.format(rendered_image_path)) if not rendered_image.width() == control_image.width() or not rendered_image.height() == control_image.height(): - error('Size mismatch - control image is {}x{}, rendered image is {}x{}'.format(control_image.width(), + print ('Size mismatch - control image is {}x{}, rendered image is {}x{}'.format(control_image.width(), control_image.height(), rendered_image.width(), rendered_image.height())) + max_width = min( rendered_image.width(), control_image.width() ) + max_height = min( rendered_image.height(), control_image.height() ) + #read current mask, if it exist mask_image = imageFromPath( mask_image_path ) if mask_image.isNull(): @@ -86,15 +89,13 @@ def updateMask(control_image_path, rendered_image_path, mask_image_path): #loop through pixels in rendered image and compare mismatch_count = 0 - width = control_image.width() - height = control_image.height() - linebytes = width * 4 - for y in xrange( height ): + linebytes = max_width * 4 + for y in xrange( max_height ): control_scanline = control_image.constScanLine( y ).asstring(linebytes) rendered_scanline = rendered_image.constScanLine( y ).asstring(linebytes) mask_scanline = mask_image.scanLine( y ).asstring(linebytes) - for x in xrange( width ): + for x in xrange( max_width ): currentTolerance = qRed( struct.unpack('I', mask_scanline[ x*4:x*4+4 ] )[0] ) if currentTolerance == 255: diff --git a/tests/testdata/control_images/expected_legend_basic/expected_legend_basic_mask.png b/tests/testdata/control_images/expected_legend_basic/expected_legend_basic_mask.png new file mode 100644 index 00000000000..af1bc5be8ad Binary files /dev/null and b/tests/testdata/control_images/expected_legend_basic/expected_legend_basic_mask.png differ diff --git a/tests/testdata/control_images/expected_legend_big_marker/expected_legend_big_marker_mask.png b/tests/testdata/control_images/expected_legend_big_marker/expected_legend_big_marker_mask.png new file mode 100644 index 00000000000..0e0d70d1b25 Binary files /dev/null and b/tests/testdata/control_images/expected_legend_big_marker/expected_legend_big_marker_mask.png differ diff --git a/tests/testdata/control_images/expected_legend_filter_by_map/expected_legend_filter_by_map_mask.png b/tests/testdata/control_images/expected_legend_filter_by_map/expected_legend_filter_by_map_mask.png new file mode 100644 index 00000000000..1413d526f7e Binary files /dev/null and b/tests/testdata/control_images/expected_legend_filter_by_map/expected_legend_filter_by_map_mask.png differ diff --git a/tests/testdata/control_images/expected_legend_long_symbol_text/expected_legend_long_symbol_text_mask.png b/tests/testdata/control_images/expected_legend_long_symbol_text/expected_legend_long_symbol_text_mask.png new file mode 100644 index 00000000000..12c15656795 Binary files /dev/null and b/tests/testdata/control_images/expected_legend_long_symbol_text/expected_legend_long_symbol_text_mask.png differ diff --git a/tests/testdata/control_images/expected_legend_three_columns/expected_legend_three_columns_mask.png b/tests/testdata/control_images/expected_legend_three_columns/expected_legend_three_columns_mask.png index 21b6d8495f7..bece5987c1d 100644 Binary files a/tests/testdata/control_images/expected_legend_three_columns/expected_legend_three_columns_mask.png and b/tests/testdata/control_images/expected_legend_three_columns/expected_legend_three_columns_mask.png differ