TestTemplatedRoot.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright (c) The Avalonia Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using System;
  4. using Avalonia.Controls;
  5. using Avalonia.Controls.Presenters;
  6. using Avalonia.Controls.Templates;
  7. using Avalonia.Layout;
  8. using Avalonia.LogicalTree;
  9. using Avalonia.Platform;
  10. using Avalonia.Rendering;
  11. using Avalonia.Styling;
  12. namespace Avalonia.UnitTests
  13. {
  14. public class TestTemplatedRoot : ContentControl, ILayoutRoot, IRenderRoot, ILogicalRoot
  15. {
  16. private readonly NameScope _nameScope = new NameScope();
  17. public TestTemplatedRoot()
  18. {
  19. Template = new FuncControlTemplate<TestTemplatedRoot>((x, scope) => new ContentPresenter
  20. {
  21. Name = "PART_ContentPresenter",
  22. }.RegisterInNameScope(scope));
  23. }
  24. public Size ClientSize => new Size(100, 100);
  25. public Size MaxClientSize => Size.Infinity;
  26. public double LayoutScaling => 1;
  27. public ILayoutManager LayoutManager { get; set; } = new LayoutManager();
  28. public double RenderScaling => 1;
  29. public IRenderTarget RenderTarget => null;
  30. public IRenderer Renderer => null;
  31. public IRenderTarget CreateRenderTarget()
  32. {
  33. throw new NotImplementedException();
  34. }
  35. public void Invalidate(Rect rect)
  36. {
  37. throw new NotImplementedException();
  38. }
  39. public Point PointToClient(PixelPoint p) => p.ToPoint(1);
  40. public PixelPoint PointToScreen(Point p) => PixelPoint.FromPoint(p, 1);
  41. }
  42. }