Class ImageAssert | Graphics Tests Framework | 7.7.1-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

    Fields

    kBackBufferHeight

    Declaration
    public const int kBackBufferHeight = 1080
    Field Value
    Type Description
    Int32

    kBackBufferWidth

    Declaration
    public const int kBackBufferWidth = 1920
    Field Value
    Type Description
    Int32

    onAllCamerasRendered

    Declaration
    public static Action<RenderTexture> onAllCamerasRendered
    Field Value
    Type Description
    Action<RenderTexture>

    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 = 0)
    Parameters
    Type Name Description
    Camera camera

    The camera to render from.

    ImageComparisonSettings settings
    Int32 gcAllocThreshold

    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, 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, 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.

    GetImageResolution(ImageComparisonSettings, out Int32, out Int32)

    Declaration
    public static void GetImageResolution(ImageComparisonSettings settings, out int width, out int height)
    Parameters
    Type Name Description
    ImageComparisonSettings settings
    Int32 width
    Int32 height

    ResizeInto(Texture2D, Texture2D)

    Resize a source texture to match the dimensions of the destination texture

    Declaration
    public static Texture2D ResizeInto(Texture2D source, Texture2D dest)
    Parameters
    Type Name Description
    Texture2D source
    Texture2D dest
    Returns
    Type Description
    Texture2D
    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