internal static void CheckExpectedImage(PathPrimitive primitive, int width, int height, string expectedImageFilePath) { byte[] imageRawBytes; using (var context = new RenderContextForTest(width, height)) { BuiltinPrimitiveRenderer primitiveRenderer = new BuiltinPrimitiveRenderer(); var mesh = new Mesh(); primitiveRenderer.DrawPathPrimitive(mesh, primitive, Vector.Zero); context.Clear(); context.DrawShapeMesh(mesh); imageRawBytes = context.GetRenderedRawBytes(); } Util.CheckExpectedImage(imageRawBytes, width, height, expectedImageFilePath); }
internal static void CheckExpectedImage(PathPrimitive primitive, int width, int height, string expectedImageFilePath) { byte[] imageRawBytes; using (var context = new RenderContextForTest(width, height)) { BuiltinPrimitiveRenderer primitiveRenderer = new BuiltinPrimitiveRenderer(); var mesh = new Mesh(); mesh.CommandBuffer.Add(DrawCommand.Default); primitiveRenderer.DrawPathPrimitive(mesh, primitive, Vector.Zero); context.Clear(); context.DrawShapeMesh(mesh); imageRawBytes = context.GetRenderedRawBytes(); } var image = Util.CreateImage(imageRawBytes, width, height, flip: true); #if DEBUG var expectedImage = Util.LoadImage(expectedImageFilePath); Assert.True(Util.CompareImage(expectedImage, image)); #else Util.SaveImage(image, Util.UnitTestRootDir + expectedImageFilePath); //generate expected image #endif }