Files
StarterNG/StarterNG.Tests/SliderStepsTests.cs
maj00r 93f914c868 feat(settings): a standard mode as the old starter's panel, the rest behind a warning
The settings keep only the keys master reads, Vulkan left out. The standard
mode is the old starter's panel; the advanced mode opens behind a warning
whose yes takes a click only after 20 seconds in front of the player.

- Sliders go by fixed steps (SliderRanges), held to the standard ranges there:
  fpslimit up to 240, sleeperdistance up to 1000 m.
- On the first start everyone is moved to the standard mode once: what is
  outside it goes back to its default, the sliders' values to their ranges,
  and a copy of eu07.ini is kept as eu07.ini.before-standard.
- "Restore defaults" puts every setting back, the language, the simulator,
  the UART port and the control keys kept.
- Monitors and renderers are found anew (Monitors, Renderers), Displays and
  SettingReach gone.
- mousescale writes its second number as the old starter did, 0.5 or -0.5
  for an inverted vertical axis; an axis that would not move gets the default.
- Depot, in the standard mode: no AI or drivable-only filters, empty consists
  not listed, the crew shown but not changed.
- Randomizing the textures of a whole scenery no longer rebuilds the view per
  consist, and finds its candidates by mini, so the window keeps answering.
- A long operator in the vehicle list is cut short instead of over the name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:02:29 +01:00

55 lines
1.8 KiB
C#

using StarterNG.Domain.Settings;
using StarterNG.Views;
namespace StarterNG.Tests;
[Collection(AvaloniaControls.Name)]
public class SliderStepsTests
{
[Fact]
public void The_old_starters_steps_are_offered_and_a_value_outside_them_stays()
{
var slider = new Avalonia.Controls.Slider();
var steps = new SliderSteps(slider, SliderRanges.ReflectionUpdates) { Value = 1 / 300.0 };
// The simulator's own once in five minutes, shown before the old starter's 1 to 60.
Assert.Equal(1 / 300.0, steps.Value);
Assert.Equal(SliderRanges.ReflectionUpdates.Length, slider.Maximum);
slider.Value = slider.Maximum;
Assert.Equal(60, steps.Value);
}
[Fact]
public void A_frame_limit_above_the_list_stays_as_the_file_has_it()
{
var slider = new Avalonia.Controls.Slider();
var steps = new SliderSteps(slider, SliderRanges.FrameRateLimits) { Value = 300 };
Assert.Equal(300, steps.Value);
Assert.Equal(SliderRanges.FrameRateLimits.Length, slider.Maximum);
}
[Fact]
public void Clamping_puts_a_value_past_either_end_at_that_end()
{
var slider = new Avalonia.Controls.Slider();
var steps = new SliderSteps(slider, SliderRanges.FrameRateLimits) { Clamps = true, Value = 300 };
Assert.Equal(240, steps.Value);
Assert.Equal(SliderRanges.FrameRateLimits.Length - 1, slider.Maximum);
}
[Fact]
public void Clamping_leaves_a_value_between_two_steps_where_it_is()
{
var slider = new Avalonia.Controls.Slider();
var steps = new SliderSteps(slider, SliderRanges.CabShadowRanges) { Clamps = true, Value = 15 };
Assert.Equal(15, steps.Value);
steps.Value = -5;
Assert.Equal(0, steps.Value);
}
}