Cut/Fade/Move and a 100-2000 ms length, bound to the view model; changes save with the layout. Test: TransitionPickerTests. Not pushed.
55 lines
1.7 KiB
C#
55 lines
1.7 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using Xunit;
|
|
using ytLive.Services;
|
|
using ytLive.ViewModels;
|
|
|
|
namespace ytLive.Tests;
|
|
|
|
/// <summary>
|
|
/// The App Settings transition picker drives the view model: type and length changes
|
|
/// notify the bound controls.
|
|
/// </summary>
|
|
[Collection("RealApp")]
|
|
public sealed class TransitionPickerTests
|
|
{
|
|
private readonly RealAppHost _app;
|
|
|
|
public TransitionPickerTests(RealAppHost app) => _app = app;
|
|
|
|
[Fact]
|
|
public void Transition_Type_And_Length_Notify_The_Settings_Picker()
|
|
{
|
|
_app.Run(Run);
|
|
}
|
|
|
|
private static void Run()
|
|
{
|
|
var tempDb = System.IO.Path.Combine(System.IO.Path.GetTempPath(), $"ytLlive-transition-{Guid.NewGuid():N}.db");
|
|
MainViewModel.LayoutPathOverride = tempDb;
|
|
try
|
|
{
|
|
using (var schema = new LayoutStore(tempDb)) { }
|
|
Microsoft.Data.Sqlite.SqliteConnection.ClearAllPools();
|
|
|
|
var vm = new MainViewModel();
|
|
var raised = new System.Collections.Generic.List<string>();
|
|
((INotifyPropertyChanged)vm).PropertyChanged += (_, e) => raised.Add(e.PropertyName ?? "");
|
|
|
|
vm.SelectedTransitionType = TransitionType.Move;
|
|
vm.TransitionDurationMs = 750;
|
|
|
|
Assert.Equal(TransitionType.Move, vm.SelectedTransitionType);
|
|
Assert.Equal(750, vm.TransitionDurationMs);
|
|
Assert.Contains(nameof(MainViewModel.SelectedTransitionType), raised);
|
|
Assert.Contains(nameof(MainViewModel.TransitionDurationMs), raised);
|
|
}
|
|
finally
|
|
{
|
|
MainViewModel.LayoutPathOverride = null;
|
|
Microsoft.Data.Sqlite.SqliteConnection.ClearAllPools();
|
|
try { System.IO.File.Delete(tempDb); } catch { }
|
|
}
|
|
}
|
|
}
|