mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-22 00:54:26 +08:00
change.重做天气,为回到系统提供自定义功能。
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Avalonia.Controls;
|
||||
using LanMountainDesktop.ComponentSystem;
|
||||
using LanMountainDesktop.Services;
|
||||
@@ -73,6 +75,48 @@ public sealed class DesktopComponentRenderModeTests
|
||||
Assert.Null(probe.RuntimeContext?.PlacementId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DefaultRuntimeRegistrations_IncludeMaterialWeatherComponents()
|
||||
{
|
||||
var componentIds = DesktopComponentRuntimeRegistry.GetDefaultRegistrations()
|
||||
.Select(registration => registration.ComponentId)
|
||||
.ToHashSet(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
Assert.Contains(BuiltInComponentIds.DesktopWeatherClock, componentIds);
|
||||
Assert.Contains(BuiltInComponentIds.DesktopWeather, componentIds);
|
||||
Assert.Contains(BuiltInComponentIds.DesktopHourlyWeather, componentIds);
|
||||
Assert.Contains(BuiltInComponentIds.DesktopMultiDayWeather, componentIds);
|
||||
Assert.Contains(BuiltInComponentIds.DesktopExtendedWeather, componentIds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WeatherVisualStyleCatalog_NormalizesLegacyAndSupportedIds()
|
||||
{
|
||||
Assert.Equal(WeatherVisualStyleId.GoogleWeatherV4, WeatherVisualStyleCatalog.Normalize(null));
|
||||
Assert.Equal(WeatherVisualStyleId.GoogleWeatherV4, WeatherVisualStyleCatalog.Normalize("DefaultWeather"));
|
||||
Assert.Equal(WeatherVisualStyleId.GoogleWeatherV4, WeatherVisualStyleCatalog.Normalize("HyperOS3"));
|
||||
Assert.Equal(WeatherVisualStyleId.Geometric, WeatherVisualStyleCatalog.Normalize("Geometric"));
|
||||
Assert.Equal(WeatherVisualStyleId.Breezy, WeatherVisualStyleCatalog.Normalize("Breezy"));
|
||||
Assert.Equal(WeatherVisualStyleId.LemonFlutter, WeatherVisualStyleCatalog.Normalize("LemonFlutter"));
|
||||
Assert.Equal(WeatherVisualStyleId.GoogleWeatherV4, WeatherVisualStyleCatalog.Normalize("MissingPack"));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(WeatherVisualStyleId.GoogleWeatherV4)]
|
||||
[InlineData(WeatherVisualStyleId.Geometric)]
|
||||
[InlineData(WeatherVisualStyleId.Breezy)]
|
||||
[InlineData(WeatherVisualStyleId.LemonFlutter)]
|
||||
public void WeatherIconAssetResolver_ResolvesCoreWeatherStates(string styleId)
|
||||
{
|
||||
Assert.NotNull(WeatherIconAssetResolver.ResolveAssetUri(styleId, 0, "Clear", isDaylight: true));
|
||||
Assert.NotNull(WeatherIconAssetResolver.ResolveAssetUri(styleId, 1, "Partly cloudy", isDaylight: false));
|
||||
Assert.NotNull(WeatherIconAssetResolver.ResolveAssetUri(styleId, 7, "Rain", isDaylight: true));
|
||||
Assert.NotNull(WeatherIconAssetResolver.ResolveAssetUri(styleId, 4, "Thunderstorm", isDaylight: true));
|
||||
Assert.NotNull(WeatherIconAssetResolver.ResolveAssetUri(styleId, 13, "Snow", isDaylight: true));
|
||||
Assert.NotNull(WeatherIconAssetResolver.ResolveAssetUri(styleId, 18, "Fog", isDaylight: true));
|
||||
Assert.NotNull(WeatherIconAssetResolver.ResolveAssetUri(styleId, 999, "Unknown", isDaylight: true));
|
||||
}
|
||||
|
||||
private static DesktopComponentRuntimeDescriptor CreateDescriptor()
|
||||
{
|
||||
Assert.True(CreateRuntimeRegistry().TryGetDescriptor(ComponentId, out var descriptor));
|
||||
|
||||
Reference in New Issue
Block a user