robotframework-doctestlibrary 0.23.0.dev0__py3-none-any.whl → 0.23.0.dev2__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,21 @@ 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")
448
+ if resize or blur:
451
449
  for i in range(len(images_with_placeholders)):
452
- images_with_placeholders[i] = cv2.resize(images_with_placeholders[i], dimensions[i])
450
+ if resize:
451
+ if dimensions is None:
452
+ raise AssertionError("Dimensions must be defined for resizing")
453
+ images_with_placeholders[i] = cv2.resize(images_with_placeholders[i], dimensions[i])
454
+ if blur:
455
+ kernel_size = int(images_with_placeholders[i].shape[1]/50)
456
+ # must be odd if median
457
+ kernel_size += kernel_size%2-1
458
+ images_with_placeholders[i] = cv2.GaussianBlur(images_with_placeholders[i], (kernel_size, kernel_size), 1.5)
453
459
  for placeholder in placeholders:
454
460
  if placeholder['page'] == 'all':
455
461
  for i in range(len(images_with_placeholders)):
DocTest/VisualTest.py CHANGED
@@ -189,12 +189,9 @@ 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)
194
- logging.debug("OCR Data: {}".format(reference_compare_image.text_content))
195
- else:
196
- reference_collection = reference_compare_image.opencv_images
197
- compare_collection = candidate_compare_image.opencv_images
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
+ logging.debug("OCR Data: {}".format(reference_compare_image.text_content))
198
195
 
199
196
  if len(reference_collection) != len(compare_collection):
200
197
  print("Pages in reference file:{}. Pages in candidate file:{}".format(
@@ -478,13 +475,16 @@ class VisualTest(object):
478
475
  grayA = cv2.cvtColor(reference, cv2.COLOR_BGR2GRAY)
479
476
  grayB = cv2.cvtColor(candidate, cv2.COLOR_BGR2GRAY)
480
477
 
478
+ # Blur is now in get_images_with_placeholders
479
+ # This is now a double blur, which is not necessary
480
+ # ToDo: Think about a better solution of blurring
481
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)
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)
488
488
 
489
489
  if self.take_screenshots:
490
490
  # Not necessary to take screenshots for every successful comparison
@@ -815,6 +815,8 @@ class VisualTest(object):
815
815
  self.add_screenshot_to_log(self.overlay_two_images(
816
816
  diff_area_reference, diff_area_candidate), "_diff_area_blended")
817
817
  if images_are_equal is not True:
818
+ logging.info(
819
+ f'The compared images are different with a score of {score}')
818
820
  raise AssertionError('The compared images are different.')
819
821
 
820
822
  @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.dev2
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=gclvHLfaee5Cdwk9gjqUoeKcQ1B4QFL0nJAt4dr-pyo,32761
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=5EBupb3fH5Hc85mBFO4ADyLmKFGWTxrV5Xw0d8nQ3Is,62646
9
+ robotframework_doctestlibrary-0.23.0.dev2.dist-info/LICENSE,sha256=1-hnhyZ0wFfHRVpZUuyrqu75iBVVe8--GD-V5898FIU,10443
10
+ robotframework_doctestlibrary-0.23.0.dev2.dist-info/METADATA,sha256=xfkftUAnHM-T3T_1kKnhMATLHTQkAymu7NErwZgekJ0,14381
11
+ robotframework_doctestlibrary-0.23.0.dev2.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
12
+ robotframework_doctestlibrary-0.23.0.dev2.dist-info/RECORD,,