Skip to content

Cover the editor's menus, panels and diagnostics list - #148

Merged
matt-edmondson merged 2 commits into
mainfrom
claude/schema-issue-128-gr9is7
Sep 8, 2026
Merged

Cover the editor's menus, panels and diagnostics list#148
matt-edmondson merged 2 commits into
mainfrom
claude/schema-issue-128-gr9is7

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Closes #128.

What was left

The harness and SchemaEditor.Test already existed, and the Sonar coverage exclusion was already narrowed to SchemaEditor/Program.cs. What was still missing was the second acceptance item: the parts of the editor that only a click can start had no test, because none of those controls had a name a test could address. Editor line coverage sat at 73.5%, under the 80% SonarCloud asks of new code, and the gap was exactly the interactive code the issue lists — SchemaEditor.Files' menu paths and its save-through-the-browser sequence, and SchemaEditor.Diagnostics' panel.

What this adds

Marking is how this codebase makes a control addressable (ImGuiProbes.MarkItem, free when no probe is installed), so the controls that were missing it now have it: menu headers and items, every EditField (each is a hidden ## label, so there was no text to find it by), the class / array-key / language pickers, the member type button and description arrow, Browse and Generate, the diagnostics rows, and the enum value context menu.

New suites, all driven the way a user drives the editor — the menu is opened and the item clicked, the field is typed into and left, the picker is opened and an option chosen:

  • MenuTests — File and Edit, including the enabling rules that live only in the menu (Save with no document, Open Externally with no path, Undo with nothing to undo), the recent-files menu and opening from it.
  • ShortcutTests — Ctrl+N/O/S/Shift+S/Z/Shift+Z/Y, that Save As is recognised before Save, and that a shortcut does not fire while a field is being typed into.
  • DiagnosticsPanelTests — what the panel lists, that errors are listed above warnings, and that a row selects the element its issue is about.
  • ElementPanelTests — renaming from a panel (including a collision being refused with nothing left on the undo stack), descriptions, the data source's class picker, the member type picker, an array's container and key.
  • CodeGeneratorPanelTests — language, namespace, output path, Browse, and Generate: refused until the schema is saved, refused with a reason when the schema has errors, and writing its output when it can.
  • FileBrowserTests — saving a document with no path through the browser, and the continuation that whatever the save was guarding waits for.
  • SchemaFileTests — the load and save failures, and what each is reported as.

Two bugs this turned up

  • Open Externally was never disabled. It passed its flag to the two-argument ImGui.MenuItem overload, which takes it as the item's checked state rather than as whether the item is enabled. The item was drawn with a tick beside it once the schema had a path, and stayed clickable while it had none — handing the shell an empty path, which failed into an error popup.
  • Folded-open state was read off the singleton. ToggleVisibility and IsVisible reached for SchemaEditor.Instance rather than the editor drawing the row. The application has one editor so it worked, but a suite has one per test, and a row left open by one test came back open in the next. They are instance members now, and ButtonTree takes the editor it draws for.

Notes

ShowDiagnosticsPanel is internal so a test can draw it. The tab bar hosting it comes from a widget library that neither records its tabs for a probe nor takes a selection from outside, so there is no tab to click; it is driven through WidgetHarness the way the class graph already is.

Result

182 tests, up from 100, all passing. Editor line coverage 73.5% → 92.3%. What is left uncovered is the entry point (already excluded), the shell handoff inside OpenExternally, and ConfirmExit, whose ImGuiApp.Stop refuses to run outside a real application loop.

dotnet build is clean with this repo's warnings-as-errors analyzers, and Schema.Test still passes (304 tests on net10.0).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Pw1CwfGXb6yK6gLdnZYYZK


Generated by Claude Code

SchemaEditor's harness reached the trees and the member grid, but the parts
of the editor that only a click can start - the File and Edit menus, the
keyboard shortcuts, the property panels' fields and pickers, the diagnostics
list, and saving through the file browser - had no test, because none of
those controls had a name a test could address. Editor coverage sat at 73%,
below the 80% SonarCloud asks of new code, and the gap was exactly the
interactive code the issue lists.

Marking is how this codebase makes a control addressable, so the controls
that were missing it now have it: menu headers and items, every EditField
(each of which is a hidden label, so there was no text to find it by), the
class, array-key and language pickers, the member type button and
description arrow, the Browse and Generate buttons, the diagnostics rows,
and the enum value context menu. It costs nothing when no probe is
installed.

Two things this turned up, both fixed:

- Open Externally passed its flag to the two-argument ImGui overload, which
  takes it as the item's checked state rather than as whether the item is
  enabled. The item was drawn with a tick beside it once the schema had a
  path, and stayed clickable while it had none, handing the shell an empty
  path.
- ToggleVisibility and IsVisible read the folded state off SchemaEditor
  .Instance rather than the editor drawing the row. The application has one
  editor so it worked, but a suite has one per test, and a row left open by
  one test came back open in the next. They are instance members now, and
  ButtonTree takes the editor it is drawing for.

ShowDiagnosticsPanel is internal so a test can draw it: the tab bar hosting
it comes from a widget library that neither records its tabs for a probe nor
takes a selection from outside, so it is driven through WidgetHarness the
way the class graph already is.

182 tests, up from 100. Editor line coverage 73.5% -> 92.3%. What is left is
the entry point, the shell handoff in OpenExternally, and ConfirmExit, whose
ImGuiApp.Stop refuses to run outside a real application loop.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pw1CwfGXb6yK6gLdnZYYZK
The assertion spelt the expected value "data/users.json", which is what a
RelativeFilePath holds on Linux and not on Windows, where it normalises its
separators to backslashes. Building the expected value through the same
conversion the panel puts the typed text through asks what the test is
actually about - that the typed value reached the model - rather than how a
path is spelt on the runner.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pw1CwfGXb6yK6gLdnZYYZK
@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 271751b into main Sep 8, 2026
12 checks passed
@matt-edmondson
matt-edmondson deleted the claude/schema-issue-128-gr9is7 branch September 8, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SchemaEditor has no tests, and no harness to write them against

2 participants