Cover the editor's menus, panels and diagnostics list - #148
Merged
Conversation
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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Closes #128.
What was left
The harness and
SchemaEditor.Testalready existed, and the Sonar coverage exclusion was already narrowed toSchemaEditor/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, andSchemaEditor.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, everyEditField(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
ImGui.MenuItemoverload, 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.ToggleVisibilityandIsVisiblereached forSchemaEditor.Instancerather 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, andButtonTreetakes the editor it draws for.Notes
ShowDiagnosticsPanelis 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 throughWidgetHarnessthe 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, andConfirmExit, whoseImGuiApp.Stoprefuses to run outside a real application loop.dotnet buildis clean with this repo's warnings-as-errors analyzers, andSchema.Teststill passes (304 tests on net10.0).🤖 Generated with Claude Code
https://claude.ai/code/session_01Pw1CwfGXb6yK6gLdnZYYZK
Generated by Claude Code