/// <summary/> public override object SetContentDelegate(object test) { RenderingTest renderingTest = (RenderingTest)test; Visual v = renderingTest.GetWindowContent(); if (RendersToImage) { ImageBrush brush = RenderToImage(v); Rectangle r = new Rectangle(new Rect(0, 0, WindowWidth, WindowHeight), brush); rootVisual.Visual = r.Visual; } else { rootVisual.Visual = v; } return(null); }
/// <summary/> public override object SetContentDelegate(object test) { RenderingTest renderingTest = (RenderingTest)test; content = (UIElement)renderingTest.GetWindowContent(); if (RendersToImage) { // Force a layout pass on the UIElement. // This will make sure that RenderToImage doesn't give us an empty ImageBrush. content.Arrange(new Rect(0, 0, WindowWidth, WindowHeight)); ImageBrush brush = RenderToImage(content); if (renderingTest is XamlTest) { // However, this will not work for XamlTest because that test grabs the Viewport3D from Xaml // and the Xaml parser sets the VisualFlags.IsLayoutSuspended on the Viewport3D. // Therefore, the Arrange is ignored. // // The best we can do is just ignore the whole thing so that /RunAll doesn't fail. RenderTolerance.DefaultColorTolerance = Colors.White; } System.Windows.Shapes.Rectangle r = new System.Windows.Shapes.Rectangle(); r.Width = WindowWidth; r.Height = WindowHeight; r.Fill = brush; window.Content = r; } else { window.Content = content; } return(null); }