mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-22 09:14:25 +08:00
feat.动画优化与更新界面
This commit is contained in:
38
LanMountainDesktop.Tests/DesktopEditOverlayPresenterTests.cs
Normal file
38
LanMountainDesktop.Tests/DesktopEditOverlayPresenterTests.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Linq;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using LanMountainDesktop.DesktopEditing;
|
||||
using Xunit;
|
||||
|
||||
namespace LanMountainDesktop.Tests;
|
||||
|
||||
public sealed class DesktopEditOverlayPresenterTests
|
||||
{
|
||||
[Fact]
|
||||
public void CompositionOffsetHelperFallsBackWhenVisualIsUnavailable()
|
||||
{
|
||||
var service = new CompositionVisualAnimationService(_ => null);
|
||||
var target = new Border();
|
||||
|
||||
var result = service.TrySetOffset(target, new Point(12, 34));
|
||||
|
||||
Assert.False(result);
|
||||
Assert.False(service.TrySetOpacity(target, 0.5));
|
||||
Assert.False(service.TrySetUniformScale(target, 1.05));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PreviewRectUsesCanvasPlacementWhenCompositionIsUnavailable()
|
||||
{
|
||||
var presenter = new DesktopEditOverlayPresenter(new CompositionVisualAnimationService(_ => null));
|
||||
var root = Assert.IsType<Canvas>(presenter.Root);
|
||||
|
||||
presenter.SetPreviewRect(new Rect(12, 34, 180, 120));
|
||||
|
||||
var ghost = root.Children.OfType<DesktopEditGhostView>().Single();
|
||||
Assert.Equal(12, Canvas.GetLeft(ghost));
|
||||
Assert.Equal(34, Canvas.GetTop(ghost));
|
||||
Assert.Equal(180, ghost.Width);
|
||||
Assert.Equal(120, ghost.Height);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user