Esempio n. 1
0
        /// <summary/>
        protected void VerifyWithSceneRenderer(SceneRenderer sceneRenderer)
        {
            Color[,] screenCapture = GetScreenCapture();

            this.sceneRenderer = sceneRenderer;

            Log("Invoking SceneRenderer...");
            if (variation["LogRendererPerformance"] != null &&
                StringConverter.ToBool(variation["LogRendererPerformance"]) == true)
            {
                RenderAndLogPerf();
            }
            else
            {
                RenderWithSceneRenderer();
            }

            Log(RenderVerifier.GetErrorStatistics(renderBuffer));
            Log("Verifying using SceneRenderer error metric.");

            int differences = RenderVerifier.VerifyRender(screenCapture, renderBuffer, numAllowableMismatches, VScanToleranceFile);

            if (differences > 0)
            {
                AddFailure("{0} pixels did not meet the tolerance criteria", differences);
                if (saveXamlRepro)
                {
                    Point[] failPoints = RenderVerifier.GetPointsWithFailures(screenCapture, renderBuffer);
                    sceneRenderer.SaveSelectedSubSceneAsXaml(failPoints, logPrefix + "_Repro.xaml");
                    Log("Failing triangles repro saved as: " + logPrefix + "_Repro.xaml");
                }
            }
            else if (saveXamlRepro && forceSave)
            {
                sceneRenderer.SaveSelectedSubSceneAsXaml(null, logPrefix + "_Serialized.xaml");
                Log("Current variation serialized as: " + logPrefix + "_Serialized.xaml");
            }

            if (differences > 0 || forceSave)
            {
                PhotoConverter.SaveImageAs(screenCapture, logPrefix + "_Rendered.png", true);
                LogImageSaved("Rendered Image:", logPrefix + "_Rendered.png");
                SaveBuffers(screenCapture);
            }
        }