Repository navigation
Description
Problem
SchemaEditor has never had a test. Every line of it is either an ImGui draw call or logic interleaved with one, so none of it executes without a live ImGui context.
This surfaced concretely in #125: that PR added a large amount of editor code and SonarCloud's quality gate failed on 19% coverage of new code against a required 80%. Nothing was wrong with the code — there is simply no way to execute it in a test. The immediate fix there was to exclude SchemaEditor/** from Sonar's coverage measurement (it is still analysed for bugs, smells and security). That is the right scoping for UI draw code, but it means editor regressions are caught only by running the editor.
What makes this tractable
ktsu.ImGui.App ships an ImGui.App.Testing package, and ImGuiAppConfig has TestMode and TestWindow for exactly this. So a headless harness is available rather than needing to be invented.
Scope
- A
SchemaEditor.Testproject. Note the editor targetsnet10.0only whileSchema.Testmulti-targets, so this cannot simply be folded into the existing test project. - A headless harness that can drive frames through
ImGuiAppin test mode. - Cover the logic that currently has none, in rough priority order:
AppData.RecordRecentFile- dedup, ordering, bounding. Pure logic, testable with no harness at all.EditField- that a value commits once on deactivate-after-edit and not per frame, and that buffers are keyed per widget so sibling rows do not share one (the bug found by review in Editor, code generation, data sources and format versioning (#112–#122) #125).SchemaEditor.Files- the unsaved-changes guard, and that Save-then-continue sequences correctly through the asynchronous file browser.SchemaEditor.Diagnostics- debounce timing,GetIssueFor, and thatNavigateToselects the right element for each issue kind.
- Once a harness exists, reconsider whether the Sonar coverage exclusion can be narrowed to just the draw-call files.
[assembly: InternalsVisibleTo("ktsu.Schema.Test")] already sits in SchemaEditor/AppData.cs, suggesting editor testing was intended at some point; the target assembly name will need revisiting.
Acceptance criteria
- A test project exists that can drive the editor headlessly.
- The logic listed above is covered.
- The Sonar coverage exclusion is narrowed to what genuinely cannot be executed, or removed.
Activity
Scope Sonar coverage measurement to the library
Merge pull request #139 from ktsu-dev/claude/project-continuation-qgaxsq
Merge pull request #140 from ktsu-dev/claude/project-continuation-qgaxsq
matt-edmondson commentedon Sep 8, 2026
Triage
Priority: High Effort: Medium
What needs to be done:
SchemaEditorhas zero tests and no way to write any, since its logic is interleaved with ImGui draw calls. This already caused concrete friction: PR #125 tripped SonarCloud's 80%-coverage-on-new-code gate at 19%, worked around with a blanket coverage exclusion rather than a real fix.ktsu.ImGui.App'sImGui.App.Testingpackage (TestMode/TestWindow) makes a headless harness tractable now.Suggested next steps / acceptance criteria:
SchemaEditor.Test(net10.0 only, per the editor's own single-TFM constraint) with a headlessImGuiApptest-mode harness.AppData.RecordRecentFile,EditField(the specific per-widget-buffer bug found in Editor, code generation, data sources and format versioning (#112–#122) #125 review),SchemaEditor.Files's unsaved-changes guard, andSchemaEditor.Diagnostics.InternalsVisibleTo("ktsu.Schema.Test")inSchemaEditor/AppData.csto point at the new test project.Blockers / dependencies: None identified — this can start immediately and doesn't require #126/#127. Recommend sequencing it before or alongside #126 (generated data editors), since establishing the headless-harness pattern here first avoids inventing it twice if that generator turns out to emit ImGui-based UI.
Generated by Claude Code