feat(ui): route locked tiers through About
Keep non-owner resolution choices visible but muted. Selecting one preserves the free tier and opens About; external navigation is only the explicit llamacasty.com link. Ref: https://streamlabs.com/desktop
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
using Xunit;
|
||||
using ytLive.Controls;
|
||||
using ytLive.Services.Entitlement;
|
||||
using ytLive.ViewModels;
|
||||
|
||||
namespace ytLive.Tests;
|
||||
@@ -41,11 +46,11 @@ public sealed class AboutHubTests
|
||||
Assert.True(vm.IsAboutOpen);
|
||||
Assert.False(vm.IsLicensesOpen);
|
||||
|
||||
// The hub links resolve to real destinations (channel + mastodon +
|
||||
// coffee are live; premium is the tabled billing seam).
|
||||
// The hub links resolve to real destinations.
|
||||
Assert.Equal("https://youtube.com/@llamachileshop", MainViewModel.ChannelUrl);
|
||||
Assert.Equal("https://mastodon.llamachile.tube/@gramps", MainViewModel.MastodonUrl);
|
||||
Assert.Equal("https://buymeacoffee.com/llamachiley", MainViewModel.CoffeeUrl);
|
||||
Assert.Equal("https://llamacasty.com", MainViewModel.PremiumUrl);
|
||||
|
||||
// The licensing panel loads the full shipped notices text in-app.
|
||||
vm.OpenLicensesCommand.Execute(null);
|
||||
@@ -67,4 +72,57 @@ public sealed class AboutHubTests
|
||||
try { System.IO.File.Delete(tempDb); } catch { /* best-effort cleanup */ }
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Selecting_a_locked_quality_opens_about_and_keeps_the_free_tier_selected()
|
||||
{
|
||||
_app.Run(() =>
|
||||
{
|
||||
var tempDb = System.IO.Path.Combine(System.IO.Path.GetTempPath(), $"llamacasty-upgrade-{Guid.NewGuid():N}.db");
|
||||
MainViewModel.LayoutPathOverride = tempDb;
|
||||
MainWindow? window = null;
|
||||
try
|
||||
{
|
||||
window = new MainWindow();
|
||||
var vm = (MainViewModel)window.DataContext;
|
||||
vm.EntitlementOverride = new FakeEntitlement(false);
|
||||
var freeTier = vm.QualityOptions.Single(option => !option.RequiresPro);
|
||||
var lockedTier = vm.QualityOptions.First(option => option.RequiresPro);
|
||||
vm.SelectedQuality = freeTier;
|
||||
window.Show();
|
||||
|
||||
var picker = (ComboBox)window.FindName("QualityPicker");
|
||||
picker.IsDropDownOpen = true;
|
||||
picker.UpdateLayout();
|
||||
Dispatcher.CurrentDispatcher.Invoke(() => { }, DispatcherPriority.Loaded);
|
||||
|
||||
var lockedItem = (ComboBoxItem)picker.ItemContainerGenerator.ContainerFromItem(lockedTier)!;
|
||||
Assert.True(lockedItem.IsEnabled);
|
||||
Assert.Equal(0.55, lockedItem.Opacity);
|
||||
Assert.Equal(Application.Current.Resources["Brush.OnSurfaceDisabled"], lockedItem.Foreground);
|
||||
|
||||
picker.SelectedItem = lockedTier;
|
||||
picker.UpdateLayout();
|
||||
|
||||
Assert.Same(freeTier, vm.SelectedQuality);
|
||||
Assert.True(vm.IsAboutOpen);
|
||||
|
||||
var about = (OverlayHost)window.FindName("AboutOverlay");
|
||||
var copy = (TextBlock)about.FindName("UpgradeCopy");
|
||||
var link = (Button)about.FindName("UpgradeLinkButton");
|
||||
Assert.Contains("720p30", copy.Text);
|
||||
Assert.Contains("one-time purchase", copy.Text, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Contains("no subscription", copy.Text, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Contains("llamacasty.com", link.Content!.ToString());
|
||||
Assert.Same(vm.OpenPremiumCommand, link.Command);
|
||||
}
|
||||
finally
|
||||
{
|
||||
window?.Close();
|
||||
MainViewModel.LayoutPathOverride = null;
|
||||
SqliteConnection.ClearAllPools();
|
||||
try { System.IO.File.Delete(tempDb); } catch { /* best-effort cleanup */ }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user