Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
Public Member Functions | |
__init__ (self, build_dir, output_path, two_labels, num_workers, threshold_fraction) | |
Run (self, open_in_browser) | |
GenerateOneDiff (self, image) | |
Public Attributes | |
build_dir = build_dir | |
output_path = output_path | |
two_labels = two_labels | |
num_workers = num_workers | |
int | threshold = threshold_fraction * 100 |
img_diff_bin = finder.ExecutablePath('pdfium_diff') | |
diff_path = os.path.join(self.output_path, 'diff') | |
image_locations | |
Protected Member Functions | |
_GenerateDiffs (self) | |
_GetRelativePath (self, absolute_path) | |
_WriteImageRows (self, f, image, diff) | |
_WritePageTd (self, f, image_path) | |
_WritePageCompareTd (self, f, normal_image_path, hover_image_path) | |
_WriteSmallChanges (self, f, small_changes) | |
Compares pairs of page images and generates an HTML to look at differences. The images are all assumed to have the same name and be in two directories: [output_path]/[two_labels[0]] and [output_path]/[two_labels[1]]. For example, if output_path is "/tmp/images" and two_labels is ("before", "after"), images in /tmp/images/before will be compared to /tmp/images/after. The HTML produced will be in /tmp/images/compare.html and have relative links to these images, so /tmp/images is self-contained and can be moved around or shared.
Definition at line 23 of file safetynet_image.py.
testing.tools.safetynet_image.ImageComparison.__init__ | ( | self, | |
build_dir, | |||
output_path, | |||
two_labels, | |||
num_workers, | |||
threshold_fraction ) |
Constructor. Args: build_dir: Path to the build directory. output_path: Path with the pngs and where the html will be created. two_labels: Tuple of two strings that name the subdirectories in output_path containing the images. num_workers: Number of worker threads to start. threshold_fraction: Minimum percentage (0.0 to 1.0) of pixels below which an image is considered to have only small changes. They will not be displayed on the HTML, only listed.
Definition at line 34 of file safetynet_image.py.
|
protected |
Runs a diff over all pairs of page images, producing diff images. As a side effect, the diff images will be saved to [output_path]/diff with the same image name. Returns: A dict mapping image names to percentage of pixels changes.
Definition at line 104 of file safetynet_image.py.
References get(), testing.tools.safetynet_image.ImageComparison.image_locations, and testing.tools.safetynet_image.ImageComparison.num_workers.
|
protected |
Definition at line 175 of file safetynet_image.py.
References testing.tools.safetynet_image.ImageComparison.output_path, and testing.tools.safetynet_image.ImageLocations.output_path.
Referenced by testing.tools.safetynet_image.ImageComparison._WriteImageRows().
|
protected |
Write table rows for a page image comparing its two versions. Args: f: Open HTML file to write to. image: Image file name. diff: Percentage of different pixels.
Definition at line 178 of file safetynet_image.py.
References testing.tools.safetynet_image.ImageComparison._GetRelativePath(), testing.tools.safetynet_image.ImageComparison._WritePageCompareTd(), testing.tools.safetynet_image.ImageComparison._WritePageTd(), testing.tools.safetynet_image.ImageComparison.image_locations, Left, and Right.
|
protected |
Write table column for an image comparing its two versions. Args: f: Open HTML file to write to. normal_image_path: Path to image to be used in the "normal" state. hover_image_path: Path to image to be used in the "hover" state.
Definition at line 209 of file safetynet_image.py.
Referenced by testing.tools.safetynet_image.ImageComparison._WriteImageRows().
|
protected |
Write table column with a single image. Args: f: Open HTML file to write to. image_path: Path to image file.
Definition at line 198 of file safetynet_image.py.
Referenced by testing.tools.safetynet_image.ImageComparison._WriteImageRows().
|
protected |
Write table rows for all images considered to have only small changes. Args: f: Open HTML file to write to. small_changes: List of (image, change) tuples, where image is the page image and change is the percentage of pixels changed.
Definition at line 224 of file safetynet_image.py.
testing.tools.safetynet_image.ImageComparison.GenerateOneDiff | ( | self, | |
image ) |
Runs a diff over one pair of images, producing a diff image. As a side effect, the diff image will be saved to [output_path]/diff with the same image name. Args: image: Page image to compare. Returns: A tuple (image, diff), where image is the parameter and diff is the percentage of pixels changed.
Definition at line 138 of file safetynet_image.py.
References testing.tools.safetynet_image.ImageComparison.image_locations, testing.tools.safetynet_image.ImageComparison.img_diff_bin, Left, print(), and Right.
testing.tools.safetynet_image.ImageComparison.Run | ( | self, | |
open_in_browser ) |
Runs the comparison and generates an HTML with the results. Returns: Exit status.
Definition at line 54 of file safetynet_image.py.
References testing.tools.common.DirectoryFinder.build_dir, testing.tools.safetynet_image.ImageComparison.build_dir, print(), testing.tools.safetynet_image.ImageComparison.two_labels, and testing.tools.safetynet_image.ImageLocations.two_labels.
testing.tools.safetynet_image.ImageComparison.build_dir = build_dir |
Definition at line 48 of file safetynet_image.py.
Referenced by testing.tools.common.DirectoryFinder.ExecutablePath(), testing.tools.safetynet_image.ImageComparison.Run(), and testing.tools.common.DirectoryFinder.WorkingDir().
testing.tools.safetynet_image.ImageComparison.diff_path = os.path.join(self.output_path, 'diff') |
Definition at line 73 of file safetynet_image.py.
testing.tools.safetynet_image.ImageComparison.image_locations |
Definition at line 77 of file safetynet_image.py.
Referenced by testing.tools.safetynet_image.ImageComparison._GenerateDiffs(), testing.tools.safetynet_image.ImageComparison._WriteImageRows(), and testing.tools.safetynet_image.ImageComparison.GenerateOneDiff().
testing.tools.safetynet_image.ImageComparison.img_diff_bin = finder.ExecutablePath('pdfium_diff') |
Definition at line 69 of file safetynet_image.py.
Referenced by testing.tools.safetynet_image.ImageComparison.GenerateOneDiff().
testing.tools.safetynet_image.ImageComparison.num_workers = num_workers |
Definition at line 51 of file safetynet_image.py.
Referenced by testing.tools.safetynet_image.ImageComparison._GenerateDiffs().
testing.tools.safetynet_image.ImageComparison.output_path = output_path |
Definition at line 49 of file safetynet_image.py.
Referenced by testing.tools.safetynet_image.ImageLocations._FindImages(), and testing.tools.safetynet_image.ImageComparison._GetRelativePath().
int testing.tools.safetynet_image.ImageComparison.threshold = threshold_fraction * 100 |
Definition at line 52 of file safetynet_image.py.
testing.tools.safetynet_image.ImageComparison.two_labels = two_labels |
Definition at line 50 of file safetynet_image.py.
Referenced by testing.tools.safetynet_image.ImageComparison.Run().