internal static void CheckExpectedImage(ImagePrimitive primitive, int width, int height, Rect contentRect, StyleRuleSet style, string expectedImageFilePath) { byte[] imageRawBytes; using (var context = new RenderContextForTest(width, height)) { BuiltinPrimitiveRenderer primitiveRenderer = new BuiltinPrimitiveRenderer(); var mesh = new Mesh(); primitiveRenderer.DrawImagePrimitive(mesh, primitive, contentRect, style, Vector.Zero); context.Clear(); context.DrawImageMesh(mesh); imageRawBytes = context.GetRenderedRawBytes(); } Util.CheckExpectedImage(imageRawBytes, width, height, expectedImageFilePath); }