mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 23:54:26 +08:00
Convert the settings window into an independent top-level window with its own taskbar icon and open-or-focus semantics. Removed Owner/anchor/toggle semantics from SettingsWindowService and added ScreenReferenceWindow for centering; settings windows now ShowInTaskbar = true and are truly destroyed on close. Added SettingsWindowPlacementHelper and tests for placement/centering. Main window now respects an AppSettingsSnapshot.ShowInTaskbar flag (new setting exposed in GeneralSettings UI) and slide/visibility animations and "back to Windows" behavior no longer affect the independent settings window. Updated various callers to use OpenIndependentSettingsModule, adjusted window transitions/X offsets, and added/updated spec files documenting the feature and animation boundary.
51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
using Avalonia;
|
|
using LanMountainDesktop.Services.Settings;
|
|
using Xunit;
|
|
|
|
namespace LanMountainDesktop.Tests;
|
|
|
|
public sealed class SettingsWindowPlacementHelperTests
|
|
{
|
|
[Fact]
|
|
public void ResolveWorkingArea_PrefersReferenceScreen()
|
|
{
|
|
var referenceArea = new PixelRect(1920, 0, 2560, 1440);
|
|
var primaryArea = new PixelRect(0, 0, 1920, 1080);
|
|
|
|
var result = SettingsWindowPlacementHelper.ResolveWorkingArea(
|
|
referenceArea,
|
|
primaryArea,
|
|
fallbackWindowWidth: 1120,
|
|
fallbackWindowHeight: 760);
|
|
|
|
Assert.Equal(referenceArea, result);
|
|
}
|
|
|
|
[Fact]
|
|
public void ResolveWorkingArea_FallsBackToPrimaryScreenWhenReferenceIsMissing()
|
|
{
|
|
var primaryArea = new PixelRect(0, 0, 1920, 1080);
|
|
|
|
var result = SettingsWindowPlacementHelper.ResolveWorkingArea(
|
|
referenceWorkingArea: null,
|
|
primaryWorkingArea: primaryArea,
|
|
fallbackWindowWidth: 1120,
|
|
fallbackWindowHeight: 760);
|
|
|
|
Assert.Equal(primaryArea, result);
|
|
}
|
|
|
|
[Fact]
|
|
public void CalculateCenteredPosition_ReturnsCenteredPointInsideWorkingArea()
|
|
{
|
|
var workingArea = new PixelRect(1920, 40, 2560, 1400);
|
|
|
|
var result = SettingsWindowPlacementHelper.CalculateCenteredPosition(
|
|
workingArea,
|
|
windowWidth: 1120,
|
|
windowHeight: 760);
|
|
|
|
Assert.Equal(new PixelPoint(2640, 360), result);
|
|
}
|
|
}
|