omni.kit.test_helpers_gfx¶
Testing system helpers for graphics.
Module that provides helpers that simplify writing tests, e.g. capture and compare screenshots, create windows, etc.
-
exception
omni.kit.test_helpers_gfx.
CompareError
¶ Bases:
Exception
-
class
omni.kit.test_helpers_gfx.
ComparisonMetric
(value)¶ Bases:
enum.Enum
An enumeration.
-
MAX_DIFFERENCE
= 0¶
-
MEAN_ERROR_SQUARED
= 2¶
-
PEAK_SIGNAL_TO_NOISE_RATIO
= 3¶
-
PIXEL_COUNT
= 1¶
-
-
class
omni.kit.test_helpers_gfx.
Enum
(value)¶ Bases:
object
Generic enumeration.
Derive from this class to define new enumerations.
-
name
¶ The name of the Enum member.
-
value
¶ The value of the Enum member.
-
-
omni.kit.test_helpers_gfx.
capture
(image_name: str, output_img_dir: str, app_window: Optional[omni.appwindow._appwindow.IAppWindow] = None, use_log: bool = True)¶ Captures frame.
- Parameters
image_name – the image name of the image and golden image.
output_img_dir – the directory path that the capture will be saved to.
golden_img_dir – the directory path that stores the golden image. Leave it to None to use default dir.
-
async
omni.kit.test_helpers_gfx.
capture_and_compare
(image_name: str, threshold, output_img_dir: str, golden_img_dir: str, app_window: Optional[omni.appwindow._appwindow.IAppWindow] = None, use_log: bool = True, metric: omni.kit.test_helpers_gfx.compare_utils.ComparisonMetric = <ComparisonMetric.MAX_DIFFERENCE: 0>)¶ Captures frame and compares it with the golden image.
- Parameters
image_name – the image name of the image and golden image.
threshold – the max threshold to collect TC artifacts.
golden_img_dir – the directory path that stores the golden image. Leave it to None to use default dir.
- Returns
A value that indicates the maximum difference between pixels. 0 is no difference in the range [0-255].
-
omni.kit.test_helpers_gfx.
compare
(image1: pathlib.Path, image2: pathlib.Path, image_diffmap: pathlib.Path, metric: omni.kit.test_helpers_gfx.compare_utils.ComparisonMetric = <ComparisonMetric.MAX_DIFFERENCE: 0>)¶ Compares two images and return a value that indicates the maximum differrence between pixels. 0 is no difference in the range [0-255].
It uses Pillow for image read.
- Parameters
image1 – images to compare
image2 – images to compare
image_diffmap – the difference map image will be saved if there is any difference between given images
-
omni.kit.test_helpers_gfx.
computeMSE
(difference)¶
-
omni.kit.test_helpers_gfx.
finalize_capture_and_compare
(image_name: str, threshold: float, output_img_dir: str, golden_img_dir: str, app_window: Optional[omni.appwindow._appwindow.IAppWindow] = None, metric: omni.kit.test_helpers_gfx.compare_utils.ComparisonMetric = <ComparisonMetric.MAX_DIFFERENCE: 0>)¶ Finalizes capture and compares it with the golden image.
- Parameters
image_name – the image name of the image and golden image.
threshold – the max threshold to collect TC artifacts.
output_img_dir – the directory path that the capture will be saved to.
golden_img_dir – the directory path that stores the golden image. Leave it to None to use default dir.
app_window – IAppWindow instance for which the capture will happen, use None to capture default app window.
- Returns
A value that indicates the maximum difference between pixels. 0 is no difference in the range [0-255].
-
omni.kit.test_helpers_gfx.
teamcity_publish_image_artifact
(src_path: str, dest_path: str, inline_image_label: Optional[str] = None, stream=<colorama.ansitowin32.StreamWrapper object>)¶