ACCESSIBILITY.md states WCAG 2.2 AA through WCAG2ICT as a goal and never a claim, what works with the keyboard alone, a screen reader, a contrast theme or Magnifier, how it is checked (the owner's pass of 2026-11-09 on beta.34 and alpha.3), the known limits with what to do instead, and how a barrier is reported and handled - by severity, no promised times. Embedded and shown under Help > Accessibility and after Limitations in the guide's window; a wiki page of its own. The Accessibility problem issue form, a user-interface section in the PR template, and the labels accessibility, safety and priority-high - the last two named by the Safety gap form since 2026-08-02 and never existing. Documents corrected: charts take focus and ScottPlot's keys (ChartKeyboardTests measures it; 08_UI said neither); the database-maintenance live region announces nothing; the Narrator gap is the owner's pass now; 20_OPEN_QUESTIONS G's accessibility row closed; NFR-9 widened (D88-D91); LIMITATIONS gains an Accessibility section and loses its one struck sentence, which a screen reader reads as current. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
199 lines
9.2 KiB
C#
199 lines
9.2 KiB
C#
// SPDX-License-Identifier: GPL-3.0-only
|
|
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
|
|
|
using System.Windows;
|
|
using FluentAssertions;
|
|
using FrameLedger.App.Services;
|
|
using FrameLedger.App.Windows;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace FrameLedger.App.Tests;
|
|
|
|
/// <summary>
|
|
/// Help ▸ About and Help ▸ Limitations as windows of rendered documents (beta.12): About carries the program's legal
|
|
/// notices and opens the licence and NOTICE on its legal tab; its two document tabs hold every page they name; a page's
|
|
/// link to another page it holds opens that page rather than GitHub; Limitations is one page, with no page list.
|
|
/// </summary>
|
|
public sealed class DocumentWindowsTests
|
|
{
|
|
private sealed class NoTheme : IThemeApplier
|
|
{
|
|
public void Apply(AppTheme theme, Window? window)
|
|
{
|
|
}
|
|
}
|
|
|
|
[Fact]
|
|
public async Task AboutShowsTheLegalNoticesAndOpensTheLicenceAndNoticeOnItsLegalTab()
|
|
{
|
|
var urls = new NoUrlOpener();
|
|
var facts = await PagesLoadTests.OnStaAsync(() =>
|
|
{
|
|
var about = new AboutWindow(urls, new NoTheme(), new AppearanceSettings(new MemorySettings()));
|
|
try
|
|
{
|
|
string[] legal = [.. about.LegalPages.Pages.Select(static p => p.Path)];
|
|
string[] thirdParty = [.. about.ThirdPartyPages.Pages.Select(static p => p.Path)];
|
|
about.ShowLegal("NOTICE");
|
|
(int Tab, string? Page, bool Plain) notice = (about.TabView.SelectedIndex, about.LegalPages.SelectedPage?.Path, about.LegalPages.SelectedPage?.IsPlainText ?? false);
|
|
about.ShowLegal("LICENSE");
|
|
string? licence = about.LegalPages.SelectedPage?.Path;
|
|
bool linked = about.ThirdPartyPages.Show(EmbeddedDocuments.PackageIndex);
|
|
return new { legal, thirdParty, notice, licence, linked, Index = about.ThirdPartyPages.SelectedPage?.Path };
|
|
}
|
|
finally
|
|
{
|
|
about.Close();
|
|
}
|
|
});
|
|
|
|
facts.legal.Should().Equal("legal/EULA.md", "LICENSE", "legal/DISCLAIMER.md", "legal/PRIVACY_POLICY.md", "legal/ALPHA_NOTICE.md", "NOTICE", "legal/TRADEMARKS.md");
|
|
facts.thirdParty.Should().Equal(EmbeddedDocuments.ThirdPartyNotices, EmbeddedDocuments.PackageIndex);
|
|
facts.notice.Should().Be((AboutWindow.LegalTab, "NOTICE", true), "NOTICE is shown as written");
|
|
facts.licence.Should().Be("LICENSE");
|
|
facts.linked.Should().BeTrue();
|
|
facts.Index.Should().Be(EmbeddedDocuments.PackageIndex);
|
|
urls.Opened.Should().BeEmpty("nothing left the App");
|
|
AboutWindow.SourceCode.Should().Be(new Uri("https://github.com/poli0981/frameledger/tree/main"));
|
|
}
|
|
|
|
/// <summary>beta.12 (D44): Help ▸ User guide — the guide's pages with a list, Limitations last, a section link opening its page.</summary>
|
|
[Fact]
|
|
public async Task TheGuideListsItsPagesAndOpensAnotherPageAtItsSection()
|
|
{
|
|
var urls = new NoUrlOpener();
|
|
var facts = await PagesLoadTests.OnStaAsync(() =>
|
|
{
|
|
var window = new DocumentWindow(Strings.Guide_Title, EmbeddedDocuments.Guide(), urls, new NoTheme(), new AppearanceSettings(new MemorySettings()));
|
|
try
|
|
{
|
|
string? first = window.Pages.SelectedPage?.Path;
|
|
bool shown = window.Pages.Show("guide/01-install.md", "updates");
|
|
return new
|
|
{
|
|
Pages = window.Pages.Pages.Count,
|
|
First = first,
|
|
Shown = shown,
|
|
Now = window.Pages.SelectedPage?.Path,
|
|
ListShown = window.Pages.FindName("PageList") is UIElement { Visibility: Visibility.Visible },
|
|
Unknown = window.Pages.Show("docs/03_METRICS.md"),
|
|
};
|
|
}
|
|
finally
|
|
{
|
|
window.Close();
|
|
}
|
|
});
|
|
|
|
facts.Pages.Should().Be(EmbeddedDocuments.GuidePages.Count + 2, "the guide's pages, then Limitations and Accessibility");
|
|
facts.First.Should().Be("guide/README.md");
|
|
facts.Shown.Should().BeTrue();
|
|
facts.Now.Should().Be("guide/01-install.md");
|
|
facts.ListShown.Should().BeTrue();
|
|
facts.Unknown.Should().BeFalse("a file the window does not hold opens on GitHub instead");
|
|
urls.Opened.Should().BeEmpty();
|
|
}
|
|
|
|
/// <summary>D74: the alpha banner's button opens the Alpha notice in one window, and asking again brings that window forward.</summary>
|
|
[Fact]
|
|
public async Task TheAlphaNoticeOpensInOneWindowAndAskingAgainRevealsIt()
|
|
{
|
|
var facts = await PagesLoadTests.OnStaAsync(() =>
|
|
{
|
|
var shell = new ShellHost(new ServiceCollection().BuildServiceProvider(), null!, null!, new WindowClosePolicy());
|
|
var documents = new DocumentWindows(new NoUrlOpener(), new NoTheme(), new AppearanceSettings(new MemorySettings()), shell);
|
|
documents.ShowAlphaNotice();
|
|
documents.ShowAlphaNotice();
|
|
DocumentWindow[] open = [.. System.Windows.Application.Current.Windows.OfType<DocumentWindow>()];
|
|
try
|
|
{
|
|
return new { Count = open.Length, Title = open.Length > 0 ? open[0].Title : null, Path = open.Length > 0 ? open[0].Pages.SelectedPage?.Path : null };
|
|
}
|
|
finally
|
|
{
|
|
foreach (DocumentWindow window in open)
|
|
{
|
|
window.Close();
|
|
}
|
|
}
|
|
});
|
|
|
|
facts.Count.Should().Be(1, "asking again brings the open window forward rather than stacking a copy");
|
|
facts.Title.Should().Be(Strings.FirstRun_Doc_Alpha);
|
|
facts.Path.Should().Be("legal/ALPHA_NOTICE.md");
|
|
}
|
|
|
|
/// <summary>D88: Help ▸ Accessibility opens the statement in one window — one page, no list — and asking again brings it forward.</summary>
|
|
[Fact]
|
|
public async Task TheAccessibilityStatementOpensInOneWindowAndAskingAgainRevealsIt()
|
|
{
|
|
var facts = await PagesLoadTests.OnStaAsync(() =>
|
|
{
|
|
var shell = new ShellHost(new ServiceCollection().BuildServiceProvider(), null!, null!, new WindowClosePolicy());
|
|
var documents = new DocumentWindows(new NoUrlOpener(), new NoTheme(), new AppearanceSettings(new MemorySettings()), shell);
|
|
documents.ShowAccessibility();
|
|
documents.ShowAccessibility();
|
|
DocumentWindow[] open = [.. System.Windows.Application.Current.Windows.OfType<DocumentWindow>()];
|
|
try
|
|
{
|
|
return new
|
|
{
|
|
Count = open.Length,
|
|
Title = open.Length > 0 ? open[0].Title : null,
|
|
Pages = open.Length > 0 ? open[0].Pages.Pages.Count : 0,
|
|
Path = open.Length > 0 ? open[0].Pages.SelectedPage?.Path : null,
|
|
ListShown = open.Length > 0 && open[0].Pages.FindName("PageList") is UIElement { Visibility: Visibility.Visible },
|
|
Anchors = open.Length > 0 ? open[0].Pages.Viewer.Anchors.Count : 0,
|
|
};
|
|
}
|
|
finally
|
|
{
|
|
foreach (DocumentWindow window in open)
|
|
{
|
|
window.Close();
|
|
}
|
|
}
|
|
});
|
|
|
|
facts.Count.Should().Be(1, "asking again brings the open window forward rather than stacking a copy");
|
|
facts.Title.Should().Be(Strings.Accessibility_Title);
|
|
facts.Pages.Should().Be(1);
|
|
facts.Path.Should().Be(AccessibilityDocument.ResourceName);
|
|
facts.ListShown.Should().BeFalse("one page needs no list");
|
|
facts.Anchors.Should().BeGreaterThan(5, "every section of the statement is a heading a link can scroll to");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task LimitationsIsOnePageWithNoListAndOpensOnGitHubAtThisBuildsSource()
|
|
{
|
|
var urls = new NoUrlOpener();
|
|
var facts = await PagesLoadTests.OnStaAsync(() =>
|
|
{
|
|
var page = new DocumentPage(Strings.Limitations_Title, LimitationsDocument.Load(), LimitationsDocument.ResourceName);
|
|
var window = new DocumentWindow(Strings.Limitations_Title, [page], urls, new NoTheme(), new AppearanceSettings(new MemorySettings()));
|
|
try
|
|
{
|
|
return new
|
|
{
|
|
window.Title,
|
|
Pages = window.Pages.Pages.Count,
|
|
Selected = window.Pages.SelectedPage?.Path,
|
|
ListShown = window.Pages.FindName("PageList") is UIElement { Visibility: Visibility.Visible },
|
|
Anchors = window.Pages.Viewer.Anchors.Count,
|
|
};
|
|
}
|
|
finally
|
|
{
|
|
window.Close();
|
|
}
|
|
});
|
|
|
|
facts.Title.Should().Be(Strings.Limitations_Title);
|
|
facts.Pages.Should().Be(1);
|
|
facts.Selected.Should().Be("LIMITATIONS.md");
|
|
facts.ListShown.Should().BeFalse("one page needs no list");
|
|
facts.Anchors.Should().BeGreaterThan(3, "every section of LIMITATIONS is a heading a link can scroll to");
|
|
LimitationsDocument.OnGitHub.Should().Be(new Uri("https://github.com/poli0981/frameledger/blob/main/LIMITATIONS.md"));
|
|
}
|
|
}
|