Make Screen abstract (#20529)
This commit is contained in:
committed by
GitHub
parent
01a8042094
commit
3c88142694
@@ -175,6 +175,48 @@
|
||||
<Left>baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net10.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.#ctor(System.Double,Avalonia.PixelRect,Avalonia.PixelRect,System.Boolean)</Target>
|
||||
<Left>baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net10.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.set_Bounds(Avalonia.PixelRect)</Target>
|
||||
<Left>baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net10.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.set_CurrentOrientation(Avalonia.Platform.ScreenOrientation)</Target>
|
||||
<Left>baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net10.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.set_DisplayName(System.String)</Target>
|
||||
<Left>baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net10.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.set_IsPrimary(System.Boolean)</Target>
|
||||
<Left>baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net10.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.set_Scaling(System.Double)</Target>
|
||||
<Left>baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net10.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.set_WorkingArea(Avalonia.PixelRect)</Target>
|
||||
<Left>baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net10.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>F:Avalonia.Media.Fonts.FontCollectionBase._glyphTypefaceCache</Target>
|
||||
@@ -331,6 +373,48 @@
|
||||
<Left>baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net8.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.#ctor(System.Double,Avalonia.PixelRect,Avalonia.PixelRect,System.Boolean)</Target>
|
||||
<Left>baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net8.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.set_Bounds(Avalonia.PixelRect)</Target>
|
||||
<Left>baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net8.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.set_CurrentOrientation(Avalonia.Platform.ScreenOrientation)</Target>
|
||||
<Left>baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net8.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.set_DisplayName(System.String)</Target>
|
||||
<Left>baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net8.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.set_IsPrimary(System.Boolean)</Target>
|
||||
<Left>baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net8.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.set_Scaling(System.Double)</Target>
|
||||
<Left>baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net8.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.set_WorkingArea(Avalonia.PixelRect)</Target>
|
||||
<Left>baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net8.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0002</DiagnosticId>
|
||||
<Target>M:Avalonia.Dialogs.Internal.ManagedFileChooserFilterViewModel.#ctor(Avalonia.Platform.Storage.FilePickerFileType)</Target>
|
||||
@@ -601,6 +685,18 @@
|
||||
<Left>baseline/Avalonia/lib/netstandard2.0/Avalonia.OpenGL.dll</Left>
|
||||
<Right>current/Avalonia/lib/netstandard2.0/Avalonia.OpenGL.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0009</DiagnosticId>
|
||||
<Target>T:Avalonia.Platform.Screen</Target>
|
||||
<Left>baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net10.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0009</DiagnosticId>
|
||||
<Target>T:Avalonia.Platform.Screen</Target>
|
||||
<Left>baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net8.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0012</DiagnosticId>
|
||||
<Target>M:Avalonia.Media.Fonts.FontCollectionBase.get_Count</Target>
|
||||
@@ -631,6 +727,12 @@
|
||||
<Left>baseline/Avalonia/lib/net10.0/Avalonia.Base.dll</Left>
|
||||
<Right>current/Avalonia/lib/net10.0/Avalonia.Base.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0012</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.Equals(Avalonia.Platform.Screen)</Target>
|
||||
<Left>baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net10.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0012</DiagnosticId>
|
||||
<Target>M:Avalonia.Media.Fonts.FontCollectionBase.get_Count</Target>
|
||||
@@ -691,6 +793,12 @@
|
||||
<Left>baseline/Avalonia/lib/net8.0/Avalonia.Base.dll</Left>
|
||||
<Right>current/Avalonia/lib/net8.0/Avalonia.Base.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0012</DiagnosticId>
|
||||
<Target>M:Avalonia.Platform.Screen.Equals(Avalonia.Platform.Screen)</Target>
|
||||
<Left>baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll</Left>
|
||||
<Right>current/Avalonia/lib/net8.0/Avalonia.Controls.dll</Right>
|
||||
</Suppression>
|
||||
<Suppression>
|
||||
<DiagnosticId>CP0012</DiagnosticId>
|
||||
<Target>M:Avalonia.Media.Fonts.FontCollectionBase.get_Count</Target>
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Avalonia.Diagnostics;
|
||||
using Avalonia.Metadata;
|
||||
using Avalonia.Utilities;
|
||||
|
||||
namespace Avalonia.Platform
|
||||
@@ -45,7 +42,7 @@ namespace Avalonia.Platform
|
||||
/// <summary>
|
||||
/// Represents a single display screen.
|
||||
/// </summary>
|
||||
public class Screen : IEquatable<Screen>
|
||||
public abstract class Screen : IEquatable<Screen>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the device name associated with a display.
|
||||
@@ -96,22 +93,6 @@ namespace Avalonia.Platform
|
||||
[Obsolete("Use the IsPrimary property instead.", true), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool Primary => IsPrimary;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Screen"/> class.
|
||||
/// </summary>
|
||||
/// <param name="scaling">The scaling factor applied to the screen by the operating system.</param>
|
||||
/// <param name="bounds">The overall pixel-size of the screen.</param>
|
||||
/// <param name="workingArea">The actual working-area pixel-size of the screen.</param>
|
||||
/// <param name="isPrimary">Whether the screen is the primary one.</param>
|
||||
[Unstable(ObsoletionMessages.MayBeRemovedInAvalonia12)]
|
||||
public Screen(double scaling, PixelRect bounds, PixelRect workingArea, bool isPrimary)
|
||||
{
|
||||
Scaling = scaling;
|
||||
Bounds = bounds;
|
||||
WorkingArea = workingArea;
|
||||
IsPrimary = isPrimary;
|
||||
}
|
||||
|
||||
private protected Screen() { }
|
||||
|
||||
/// <summary>
|
||||
@@ -123,19 +104,15 @@ namespace Avalonia.Platform
|
||||
/// </returns>
|
||||
public virtual IPlatformHandle? TryGetPlatformHandle() => null;
|
||||
|
||||
// TODO12: make abstract
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode()
|
||||
=> RuntimeHelpers.GetHashCode(this);
|
||||
public abstract override int GetHashCode();
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object? obj)
|
||||
=> obj is Screen other && Equals(other);
|
||||
|
||||
// TODO12: make abstract
|
||||
/// <inheritdoc/>
|
||||
public virtual bool Equals(Screen? other)
|
||||
=> ReferenceEquals(this, other);
|
||||
public abstract bool Equals(Screen? other);
|
||||
|
||||
public static bool operator ==(Screen? left, Screen? right)
|
||||
{
|
||||
|
||||
@@ -54,9 +54,9 @@ public abstract class PointerTestsBase : ScopedTestBase
|
||||
impl.Setup(r => r.PointToScreen(It.IsAny<Point>())).Returns<Point>(p => new PixelPoint((int)p.X, (int)p.Y));
|
||||
impl.Setup(r => r.PointToClient(It.IsAny<PixelPoint>())).Returns<PixelPoint>(p => new Point(p.X, p.Y));
|
||||
|
||||
var screen1 = new Mock<Screen>(1.75, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 966)), true);
|
||||
var screen1 = new MockScreen(1.75, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 966)), true);
|
||||
var screens = new Mock<IScreenImpl>();
|
||||
screens.Setup(x => x.ScreenFromWindow(It.IsAny<IWindowBaseImpl>())).Returns(screen1.Object);
|
||||
screens.Setup(x => x.ScreenFromWindow(It.IsAny<IWindowBaseImpl>())).Returns(screen1);
|
||||
impl.Setup(x => x.TryGetFeature(It.Is<Type>(t => t == typeof(IScreenImpl)))).Returns(screens.Object);
|
||||
|
||||
return impl;
|
||||
|
||||
@@ -666,7 +666,7 @@ namespace Avalonia.Controls.UnitTests
|
||||
var screen = new PixelRect(new PixelPoint(), new PixelSize(100, 100));
|
||||
var screenImpl = new Mock<IScreenImpl>();
|
||||
screenImpl.Setup(x => x.ScreenCount).Returns(1);
|
||||
screenImpl.Setup(X => X.AllScreens).Returns( new[] { new Screen(1, screen, screen, true) });
|
||||
screenImpl.Setup(X => X.AllScreens).Returns( new[] { new MockScreen(1, screen, screen, true) });
|
||||
|
||||
var windowImpl = MockWindowingPlatform.CreateWindowMock();
|
||||
_popupImpl = MockWindowingPlatform.CreatePopupMock(windowImpl.Object);
|
||||
|
||||
@@ -300,9 +300,9 @@ namespace Avalonia.Controls.UnitTests
|
||||
windowImpl.Setup(x => x.DesktopScaling).Returns(1);
|
||||
windowImpl.Setup(x => x.RenderScaling).Returns(1);
|
||||
|
||||
var screen1 = new Mock<Screen>(1.75, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 966)), true);
|
||||
var screen1 = new MockScreen(1.75, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 966)), true);
|
||||
var screens = new Mock<IScreenImpl>();
|
||||
screens.Setup(x => x.ScreenFromWindow(It.IsAny<IWindowBaseImpl>())).Returns(screen1.Object);
|
||||
screens.Setup(x => x.ScreenFromWindow(It.IsAny<IWindowBaseImpl>())).Returns(screen1);
|
||||
windowImpl.Setup(x => x.TryGetFeature(It.Is<Type>(t => t == typeof(IScreenImpl)))).Returns(screens.Object);
|
||||
|
||||
var services = TestServices.StyledWindow.With(
|
||||
|
||||
@@ -848,7 +848,7 @@ namespace Avalonia.Controls.UnitTests
|
||||
var screen = new PixelRect(new PixelPoint(), new PixelSize(100, 100));
|
||||
var screenImpl = new Mock<IScreenImpl>();
|
||||
screenImpl.Setup(x => x.ScreenCount).Returns(1);
|
||||
screenImpl.Setup(X => X.AllScreens).Returns(new[] { new Screen(1, screen, screen, true) });
|
||||
screenImpl.Setup(X => X.AllScreens).Returns(new[] { new MockScreen(1, screen, screen, true) });
|
||||
|
||||
var windowImpl = MockWindowingPlatform.CreateWindowMock();
|
||||
_popupImpl = MockWindowingPlatform.CreatePopupMock(windowImpl.Object);
|
||||
|
||||
@@ -518,11 +518,11 @@ namespace Avalonia.Controls.UnitTests
|
||||
[Fact]
|
||||
public void Window_Should_Not_Be_Centered_When_WindowStartupLocation_Is_CenterScreen_And_Window_Is_Hidden_And_Shown()
|
||||
{
|
||||
var screen1 = new Mock<Screen>(1.0, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 1040)), true);
|
||||
var screen1 = new MockScreen(1.0, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 1040)), true);
|
||||
|
||||
var screens = new Mock<IScreenImpl>();
|
||||
screens.Setup(x => x.AllScreens).Returns(new Screen[] { screen1.Object });
|
||||
screens.Setup(x => x.ScreenFromPoint(It.IsAny<PixelPoint>())).Returns(screen1.Object);
|
||||
screens.Setup(x => x.AllScreens).Returns(new Screen[] { screen1 });
|
||||
screens.Setup(x => x.ScreenFromPoint(It.IsAny<PixelPoint>())).Returns(screen1);
|
||||
|
||||
|
||||
var windowImpl = MockWindowingPlatform.CreateWindowMock();
|
||||
@@ -553,12 +553,12 @@ namespace Avalonia.Controls.UnitTests
|
||||
[Fact]
|
||||
public void Window_Should_Be_Centered_When_WindowStartupLocation_Is_CenterScreen()
|
||||
{
|
||||
var screen1 = new Mock<Screen>(1.0, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 1040)), true);
|
||||
var screen2 = new Mock<Screen>(1.0, new PixelRect(new PixelSize(1366, 768)), new PixelRect(new PixelSize(1366, 728)), false);
|
||||
var screen1 = new MockScreen(1.0, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 1040)), true);
|
||||
var screen2 = new MockScreen(1.0, new PixelRect(new PixelSize(1366, 768)), new PixelRect(new PixelSize(1366, 728)), false);
|
||||
|
||||
var screens = new Mock<IScreenImpl>();
|
||||
screens.Setup(x => x.AllScreens).Returns(new Screen[] { screen1.Object, screen2.Object });
|
||||
screens.Setup(x => x.ScreenFromPoint(It.IsAny<PixelPoint>())).Returns(screen1.Object);
|
||||
screens.Setup(x => x.AllScreens).Returns(new Screen[] { screen1, screen2 });
|
||||
screens.Setup(x => x.ScreenFromPoint(It.IsAny<PixelPoint>())).Returns(screen1);
|
||||
|
||||
|
||||
var windowImpl = MockWindowingPlatform.CreateWindowMock();
|
||||
@@ -576,8 +576,8 @@ namespace Avalonia.Controls.UnitTests
|
||||
window.Show();
|
||||
|
||||
var expectedPosition = new PixelPoint(
|
||||
(int)(screen1.Object.WorkingArea.Size.Width / 2 - window.ClientSize.Width / 2),
|
||||
(int)(screen1.Object.WorkingArea.Size.Height / 2 - window.ClientSize.Height / 2));
|
||||
(int)(screen1.WorkingArea.Size.Width / 2 - window.ClientSize.Width / 2),
|
||||
(int)(screen1.WorkingArea.Size.Height / 2 - window.ClientSize.Height / 2));
|
||||
|
||||
Assert.Equal(window.Position, expectedPosition);
|
||||
}
|
||||
@@ -586,10 +586,10 @@ namespace Avalonia.Controls.UnitTests
|
||||
[Fact]
|
||||
public void Window_Should_Be_Sized_To_MinSize_If_InitialSize_Less_Than_MinSize()
|
||||
{
|
||||
var screen1 = new Mock<Screen>(1.75, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 966)), true);
|
||||
var screen1 = new MockScreen(1.75, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 966)), true);
|
||||
var screens = new Mock<IScreenImpl>();
|
||||
screens.Setup(x => x.AllScreens).Returns(new Screen[] { screen1.Object });
|
||||
screens.Setup(x => x.ScreenFromPoint(It.IsAny<PixelPoint>())).Returns(screen1.Object);
|
||||
screens.Setup(x => x.AllScreens).Returns(new Screen[] { screen1 });
|
||||
screens.Setup(x => x.ScreenFromPoint(It.IsAny<PixelPoint>())).Returns(screen1);
|
||||
|
||||
var windowImpl = MockWindowingPlatform.CreateWindowMock(400, 300);
|
||||
windowImpl.Setup(x => x.DesktopScaling).Returns(1.75);
|
||||
@@ -1146,9 +1146,9 @@ namespace Avalonia.Controls.UnitTests
|
||||
|
||||
private static Mock<IWindowImpl> CreateImpl()
|
||||
{
|
||||
var screen1 = new Mock<Screen>(1.75, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 966)), true);
|
||||
var screen1 = new MockScreen(1.75, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 966)), true);
|
||||
var screens = new Mock<IScreenImpl>();
|
||||
screens.Setup(x => x.ScreenFromWindow(It.IsAny<IWindowBaseImpl>())).Returns(screen1.Object);
|
||||
screens.Setup(x => x.ScreenFromWindow(It.IsAny<IWindowBaseImpl>())).Returns(screen1);
|
||||
|
||||
var windowImpl = new Mock<IWindowImpl>();
|
||||
windowImpl.Setup(r => r.Compositor).Returns(RendererMocks.CreateDummyCompositor());
|
||||
|
||||
@@ -402,9 +402,9 @@ namespace Avalonia.LeakTests
|
||||
{
|
||||
using (Start())
|
||||
{
|
||||
var screen1 = new Mock<Screen>(1.75, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 966)), true);
|
||||
var screen1 = new MockScreen(1.75, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 966)), true);
|
||||
var screens = new Mock<IScreenImpl>();
|
||||
screens.Setup(x => x.ScreenFromWindow(It.IsAny<IWindowBaseImpl>())).Returns(screen1.Object);
|
||||
screens.Setup(x => x.ScreenFromWindow(It.IsAny<IWindowBaseImpl>())).Returns(screen1);
|
||||
|
||||
var impl = new Mock<IWindowImpl>();
|
||||
impl.Setup(r => r.TryGetFeature(It.IsAny<Type>())).Returns((object?)null);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace Avalonia.UnitTests;
|
||||
|
||||
internal class MockScreen : Screen
|
||||
{
|
||||
public MockScreen(double scaling, PixelRect bounds, PixelRect workingArea, bool isPrimary)
|
||||
{
|
||||
Scaling = scaling;
|
||||
Bounds = bounds;
|
||||
WorkingArea = workingArea;
|
||||
IsPrimary = isPrimary;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
=> RuntimeHelpers.GetHashCode(this);
|
||||
|
||||
public override bool Equals(Screen? other)
|
||||
=> ReferenceEquals(this, other);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ namespace Avalonia.UnitTests
|
||||
{
|
||||
var screenImpl = new Mock<IScreenImpl>();
|
||||
var bounds = new PixelRect(0, 0, (int)s_screenSize.Width, (int)s_screenSize.Height);
|
||||
var screen = new Screen(96, bounds, bounds, true);
|
||||
var screen = new MockScreen(96, bounds, bounds, true);
|
||||
screenImpl.Setup(x => x.AllScreens).Returns(new[] { screen });
|
||||
screenImpl.Setup(x => x.ScreenCount).Returns(1);
|
||||
return screenImpl;
|
||||
|
||||
Reference in New Issue
Block a user