/// <summary/> public override object ModifyContentDelegate(object test) { RenderingTest renderingTest = (RenderingTest)test; renderingTest.ModifyWindowContent(rootVisual.Visual); return(null); }
private object InitRenderingTest(object renderingTest) { RenderingTest test = renderingTest as RenderingTest; if (test == null) { throw new ApplicationException("Don't create Application and Dispatcher for non-rendering tests"); } test.Init(this); return(null); }
/// <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/> protected RenderingWindow(Variation v) { variation = v; photographer = new Photographer(); RenderingTest.Invoke(DispatcherPriority.Normal, CreateWindow, null); // If the window position is not valid, that means the system placed it somewhere on the primary display. // (0,0) will get us the primary display. Point windowPosition = v.IsWindowPositionValid ? v.WindowPosition : new Point(0, 0); ColorOperations.DiscoverBitDepth(windowPosition); if (v.RenderingMode != null) { RenderingTest.Invoke(DispatcherPriority.Normal, SetRenderingMode, v.RenderingMode); } }
internal CoreGraphicsTest CreateTest() { CoreGraphicsTest test = (CoreGraphicsTest)Activator.CreateInstance(testType, null); if (test == null) { throw new ApplicationException("Could not create test class: " + testClass); } if (test is RenderingTest) { RenderingTest.Invoke(DispatcherPriority.Send, InitRenderingTest, test); } else { test.Init(this); } return(test); }
/// <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); }
/// <summary/> public override void Dispose() { RenderingTest.Invoke(DispatcherPriority.Normal, Dispose, null); }
/// <summary/> public void SetBackgroundColor(Color c) { RenderingTest.Invoke(DispatcherPriority.Normal, SetBackgroundDelegate, c); }