mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-27 13:51:06 -04:00
Help > OpenNest Help (F1) and context F1 in Auto Nest and the CAD Converter open the bundled opennest-help site in a single WebView2 window on its own UI thread. Both packaging scripts install the opennest-help release pinned in scripts/help.json, verified by SHA-256. The missing lead-in finding now says the contour is missing lead-in geometry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using OpenNest.Help;
|
|
|
|
namespace OpenNest.WinForms.Tests;
|
|
|
|
public class HelpTopicsTests : IDisposable
|
|
{
|
|
private readonly string directory = Directory.CreateTempSubdirectory("opennest-help-").FullName;
|
|
|
|
public void Dispose() => Directory.Delete(directory, recursive: true);
|
|
|
|
private void WriteTopics(string json) => File.WriteAllText(Path.Combine(directory, "topics.json"), json);
|
|
|
|
[Fact]
|
|
public void MapsTopicToItsPageAndAnchor()
|
|
{
|
|
WriteTopics("""{ "topics": { "home": "index.html", "auto-nest": "first-nest.html#run-auto-nest" } }""");
|
|
|
|
Assert.Equal("first-nest.html#run-auto-nest", HelpTopics.ResolvePage(directory, HelpTopics.AutoNest));
|
|
}
|
|
|
|
[Fact]
|
|
public void UnknownTopicOpensTheHomeTopic()
|
|
{
|
|
WriteTopics("""{ "topics": { "home": "welcome.html" } }""");
|
|
|
|
Assert.Equal("welcome.html", HelpTopics.ResolvePage(directory, "not-a-topic"));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(null)]
|
|
[InlineData("not json")]
|
|
[InlineData("""{ "pages": {} }""")]
|
|
public void MissingOrUnreadableTopicsFallBackToIndex(string json)
|
|
{
|
|
if (json != null)
|
|
WriteTopics(json);
|
|
|
|
Assert.Equal("index.html", HelpTopics.ResolvePage(directory, HelpTopics.Post));
|
|
}
|
|
}
|