changed settings saving (#3)

Reviewed-on: #3
Co-authored-by: Aleksandr Neychev <alexnejchev73@gmail.com>
This commit was merged in pull request #3.
This commit is contained in:
2026-08-12 17:15:12 +00:00
committed by alex
parent 68b3d544d2
commit 5e11b16758
19 changed files with 1169 additions and 150 deletions
@@ -43,7 +43,7 @@ public sealed class SettingsViewModelTests
var localization = new FakeLocalizationService();
using var viewModel = Create(settings, localization);
settings.FontSize = 30;
settings.Current.FontSize = 30;
Assert.Equal("en", localization.CurrentLanguage);
}
@@ -59,6 +59,18 @@ public sealed class SettingsViewModelTests
Assert.Equal(Enum.GetValues<ScreenPosition>(), viewModel.ScreenPositions.Select(option => option.Value));
}
// Next to the caret the popup only goes beside it: above or below is where the next
// line of the text is
[Fact]
public void The_caret_is_offered_two_sides_and_no_more()
{
using SettingsViewModel viewModel = Create();
Assert.Equal(
[CaretSide.Left, CaretSide.Right],
viewModel.CaretSides.Select(option => option.Value));
}
// A caption key is built from the type name and the value
[Fact]
public void The_option_captions_come_from_the_resources()
@@ -85,6 +97,7 @@ public sealed class SettingsViewModelTests
Assert.Same(first, viewModel.Themes[0]);
Assert.Equal("ru:AppTheme_System", first.Display);
Assert.Equal("ru:AnchorSide_TopLeft", viewModel.AnchorSides[0].Display);
Assert.Equal("ru:CaretSide_Left", viewModel.CaretSides[0].Display);
Assert.Equal("ru:ScreenPosition_TopLeft", viewModel.ScreenPositions[0].Display);
Assert.Equal("ru:PopupPlacementMode_AtCursor", viewModel.PlacementModes[0].Display);
}
@@ -114,8 +127,8 @@ public sealed class SettingsViewModelTests
var settings = new AppSettings();
using var viewModel = Create(settings);
Assert.Contains(settings.BackgroundColor, viewModel.BackgroundPalette);
Assert.Contains(settings.ForegroundColor, viewModel.TextPalette);
Assert.Contains(settings.Current.BackgroundColor, viewModel.BackgroundPalette);
Assert.Contains(settings.Current.ForegroundColor, viewModel.TextPalette);
}
[Fact]