robotframework-doctestlibrary 0.23.0.dev0__py3-none-any.whl → 0.23.0.dev1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
DocTest/CompareImage.py CHANGED
@@ -441,15 +441,20 @@ class CompareImage(object):
441
441
  dimensions.append((self.opencv_images[i].shape[1], self.opencv_images[i].shape[0]))
442
442
  return dimensions
443
443
 
444
- def get_image_with_placeholders(self, placeholders=None, resize=False, dimensions=None):
444
+ def get_image_with_placeholders(self, placeholders=None, resize=False, dimensions=None, blur=False):
445
445
  if placeholders is None:
446
446
  placeholders = self.placeholders
447
447
  images_with_placeholders = self.opencv_images
448
- if resize:
449
- if dimensions is None:
450
- raise AssertionError("Dimensions must be defined for resizing")
451
- for i in range(len(images_with_placeholders)):
452
- images_with_placeholders[i] = cv2.resize(images_with_placeholders[i], dimensions[i])
448
+ for i in range(len(images_with_placeholders)):
449
+ if resize:
450
+ if dimensions is None:
451
+ raise AssertionError("Dimensions must be defined for resizing")
452
+ images_with_placeholders[i] = cv2.resize(images_with_placeholders[i], dimensions[i])
453
+ if blur:
454
+ kernel_size = int(images_with_placeholders[i].shape[1]/50)
455
+ # must be odd if median
456
+ kernel_size += kernel_size%2-1
457
+ images_with_placeholders[i] = cv2.GaussianBlur(images_with_placeholders[i], (kernel_size, kernel_size), 1.5)
453
458
  for placeholder in placeholders:
454
459
  if placeholder['page'] == 'all':
455
460
  for i in range(len(images_with_placeholders)):
DocTest/VisualTest.py CHANGED
@@ -189,8 +189,8 @@ class VisualTest(object):
189
189
  tic = time.perf_counter()
190
190
  if reference_compare_image.placeholders != []:
191
191
  candidate_compare_image.placeholders = reference_compare_image.placeholders
192
- reference_collection = reference_compare_image.get_image_with_placeholders()
193
- compare_collection = candidate_compare_image.get_image_with_placeholders(resize=resize_candidate, dimensions=reference_image_dimensions)
192
+ reference_collection = reference_compare_image.get_image_with_placeholders(blur=blur)
193
+ compare_collection = candidate_compare_image.get_image_with_placeholders(resize=resize_candidate, dimensions=reference_image_dimensions, blur=blur)
194
194
  logging.debug("OCR Data: {}".format(reference_compare_image.text_content))
195
195
  else:
196
196
  reference_collection = reference_compare_image.opencv_images
@@ -478,13 +478,14 @@ class VisualTest(object):
478
478
  grayA = cv2.cvtColor(reference, cv2.COLOR_BGR2GRAY)
479
479
  grayB = cv2.cvtColor(candidate, cv2.COLOR_BGR2GRAY)
480
480
 
481
- # Blur images if blur=True
482
- if compare_options['blur']:
483
- kernel_size = int(grayA.shape[1]/50)
484
- # must be odd if median
485
- kernel_size += kernel_size%2-1
486
- grayA = cv2.GaussianBlur(grayA, (kernel_size, kernel_size), 1.5)
487
- grayB = cv2.GaussianBlur(grayB, (kernel_size, kernel_size), 1.5)
481
+ # Blur is now in get_images_with_placeholders
482
+ # # Blur images if blur=True
483
+ # if compare_options['blur']:
484
+ # kernel_size = int(grayA.shape[1]/50)
485
+ # # must be odd if median
486
+ # kernel_size += kernel_size%2-1
487
+ # grayA = cv2.GaussianBlur(grayA, (kernel_size, kernel_size), 1.5)
488
+ # grayB = cv2.GaussianBlur(grayB, (kernel_size, kernel_size), 1.5)
488
489
 
489
490
  if self.take_screenshots:
490
491
  # Not necessary to take screenshots for every successful comparison
@@ -815,6 +816,8 @@ class VisualTest(object):
815
816
  self.add_screenshot_to_log(self.overlay_two_images(
816
817
  diff_area_reference, diff_area_candidate), "_diff_area_blended")
817
818
  if images_are_equal is not True:
819
+ logging.info(
820
+ f'The compared images are different with a score of {score}')
818
821
  raise AssertionError('The compared images are different.')
819
822
 
820
823
  @keyword
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: robotframework-doctestlibrary
3
- Version: 0.23.0.dev0
3
+ Version: 0.23.0.dev1
4
4
  Summary: A library for Visual Document Testing
5
5
  Home-page: https://github.com/manykarim/robotframework-doctestlibrary
6
6
  License: Apache-2.0
@@ -1,12 +1,12 @@
1
1
  DocTest/__init__.py,sha256=7i6KhOs4WYLHQAOhem84gdg7vDK1TncVugnHZkvoA9w,13105
2
- DocTest/CompareImage.py,sha256=hBGgBJHdzEDImKr380E-oe1MWxmeGdNy6PUzoR7y2eA,32348
2
+ DocTest/CompareImage.py,sha256=UN8qPU-a2LjjXFbmMDGVv0Yciv4bCgsBDbjMJyzCwxg,32693
3
3
  DocTest/Downloader.py,sha256=97y361WOQ2bn1vXsMcqLPXj_FFKmhQz3FkR9FSRThAo,1462
4
4
  DocTest/Ocr.py,sha256=TKdH_r0M4XXPwMIcmgSQfnozcXw-iFVontGCzAayMag,8235
5
5
  DocTest/PdfTest.py,sha256=u8EEu0zgiNy_TE0P26zCzgUbUYSO2WyF5SwhQikhF4c,12592
6
6
  DocTest/PrintJob.py,sha256=Vl9JZMjku1z2OMAqnzVhlCsKusKJr1HQpz8YAXLgPeY,147
7
7
  DocTest/PrintJobTests.py,sha256=w77y21c-CajSRSkKrx2PQwt7xYEwAxeKxq090OxmNDg,19270
8
- DocTest/VisualTest.py,sha256=RXfm6tu5F2Tq0fXQZrWN26qZqE5LM6J3nGDd1BqBKQI,62498
9
- robotframework_doctestlibrary-0.23.0.dev0.dist-info/LICENSE,sha256=1-hnhyZ0wFfHRVpZUuyrqu75iBVVe8--GD-V5898FIU,10443
10
- robotframework_doctestlibrary-0.23.0.dev0.dist-info/METADATA,sha256=j3cJ7poRsgsMllSqNFXICJxy9sIs2OsnCNYWWGizNZU,14381
11
- robotframework_doctestlibrary-0.23.0.dev0.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
12
- robotframework_doctestlibrary-0.23.0.dev0.dist-info/RECORD,,
8
+ DocTest/VisualTest.py,sha256=tycGeZAleovhUc1zhH_yeqN2MvtwZc0GxxyWJQx19W4,62701
9
+ robotframework_doctestlibrary-0.23.0.dev1.dist-info/LICENSE,sha256=1-hnhyZ0wFfHRVpZUuyrqu75iBVVe8--GD-V5898FIU,10443
10
+ robotframework_doctestlibrary-0.23.0.dev1.dist-info/METADATA,sha256=sv9JXFJAN7WuBSqdJpwHw0RaPi9UwMNE_iwbhMs7Ya0,14381
11
+ robotframework_doctestlibrary-0.23.0.dev1.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
12
+ robotframework_doctestlibrary-0.23.0.dev1.dist-info/RECORD,,