Class ImageAssert | Graphics Tests Framework | 7.1.13-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Class ImageAssert

    Provides test assertion helpers for working with images.

    Inheritance
    Object
    ImageAssert
    Namespace: UnityEngine.TestTools.Graphics
    Syntax
    public class ImageAssert

    Methods

    AllocatesMemory(Camera, ImageComparisonSettings, Int32)

    Render an image from the given camera and check if it allocated memory while doing so.

    Declaration
    public static void AllocatesMemory(Camera camera, ImageComparisonSettings settings = null, int gcAllocThreshold = 2)
    Parameters
    Type Name Description
    Camera camera

    The camera to render from.

    ImageComparisonSettings settings
    Int32 gcAllocThreshold

    AreEqual(Texture2D, Camera, ImageComparisonSettings)

    Render an image from the given camera and compare it to the reference image.

    Declaration
    public static void AreEqual(Texture2D expected, Camera camera, ImageComparisonSettings settings = null)
    Parameters
    Type Name Description
    Texture2D expected

    The expected image that should be rendered by the camera.

    Camera camera

    The camera to render from.

    ImageComparisonSettings settings

    Optional settings that control how the image comparison is performed. Can be null, in which case the rendered image is required to be exactly identical to the reference.

    AreEqual(Texture2D, IEnumerable<Camera>, ImageComparisonSettings)

    Render an image from the given cameras and compare it to the reference image.

    Declaration
    public static void AreEqual(Texture2D expected, IEnumerable<Camera> cameras, ImageComparisonSettings settings = null)
    Parameters
    Type Name Description
    Texture2D expected

    The expected image that should be rendered by the camera.

    IEnumerable<Camera> cameras

    The cameras to render from.

    ImageComparisonSettings settings

    Optional settings that control how the image comparison is performed. Can be null, in which case the rendered image is required to be exactly identical to the reference.

    AreEqual(Texture2D, Texture2D, ImageComparisonSettings)

    Compares an image to a 'reference' image to see if it looks correct.

    Declaration
    public static void AreEqual(Texture2D expected, Texture2D actual, ImageComparisonSettings settings = null)
    Parameters
    Type Name Description
    Texture2D expected

    What the image is supposed to look like.

    Texture2D actual

    What the image actually looks like.

    ImageComparisonSettings settings

    Optional settings that control how the comparison is performed. Can be null, in which case the images are required to be exactly identical.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023