fix: first native launch since refactor crashed — 3 stacked faults, all closed; RoundClip 'known failure' root-caused and green
User launch (2026-09-01 19:07) NRE'd in MainViewModel ctor:
1. SceneGraph (TASK 31) was 'null!'-declared, assigned mid-ctor, but Scenes is touched
~120 lines earlier — field-initialized now.
2. LeftPanel extraction (c9fd1bd) moved StaticResource users (EyeButton/EyeIconStyle)
into a UserControl while the styles stayed window-scope — invisible at parse time;
moved to Themes/Controls.xaml (app scope, the existing rule). Full audit: these were
the only two offenders (grep of Controls/*.xaml StaticResource keys vs app dictionary).
3. RoundClipInteractionTests — the second 'known failure' the map never explained: it
was two stale-test layers (window.FindName across the new UserControl namescope +
VisualTreeHelper.HitTest, which returned the IsHitTestVisible=False WebViewHostPanel
overlay for EVERY point; UIElement.InputHitTest — the real input pipeline — shows the
corner IS grabbable in both Traditional and Round). Test fixed, no product bug.
Verified: clean rebuild 0 warnings; app boots (log shows full MainWindow loaded; user
clicked + closed, zero new exceptions; real DB Webcam row = the genuine C920, untouched);
RoundClip + 6 RealApp classes pass natively per-class.
Docs: ai.md known-failure note → 246/247 (audio only); TASK 31 verification paragraph
corrected ('cannot run headless' overstated — per-class Windows-host vstest runs them);
MyMistakes: InputHitTest-vs-VTH recipe + namescope/app-style + shared-log facts.
Spin-guard citations: WPF Visual Tree Overview (InputHitTest vs VisualTreeHelper hit
semantics) + XAML namescope docs, learn.microsoft.com.
This commit is contained in:
@@ -34,6 +34,7 @@ public sealed class RoundClipInteractionTests
|
||||
_app.Run(Run);
|
||||
}
|
||||
|
||||
|
||||
private void Run()
|
||||
{
|
||||
// Never let the real MainWindow read/write the user's actual layout DB —
|
||||
@@ -62,8 +63,12 @@ public sealed class RoundClipInteractionTests
|
||||
vm.SelectedElement = webcam;
|
||||
window.UpdateLayout();
|
||||
|
||||
var previewGrid = (Grid)window.FindName("PreviewGrid")!;
|
||||
var canvasGrid = (Grid)window.FindName("CanvasGrid")!;
|
||||
// PreviewGrid/CanvasGrid moved into Controls/PreviewPane.xaml during the
|
||||
// component refactor — a UserControl owns its own namescope, so window.FindName
|
||||
// returns null for them. Resolve through the pane (found by its window-level name).
|
||||
var pane = (System.Windows.Controls.UserControl)window.FindName("PreviewPane")!;
|
||||
var previewGrid = (Grid)pane.FindName("PreviewGrid")!;
|
||||
var canvasGrid = (Grid)pane.FindName("CanvasGrid")!;
|
||||
var toWindow = canvasGrid.TransformToVisual(window);
|
||||
|
||||
var corner = new Point(webcam.X + webcam.Width, webcam.Y + webcam.Height);
|
||||
@@ -78,11 +83,16 @@ public sealed class RoundClipInteractionTests
|
||||
// A click on the corner must land inside the preview (descendant
|
||||
// of PreviewGrid); otherwise Window_PreviewMouseLeftButtonDown
|
||||
// deselects the source and the handle can never be grabbed.
|
||||
var hit = VisualTreeHelper.HitTest(window, cornerInWindow);
|
||||
var grabbable = hit != null && IsDescendantOf(hit.VisualHit, previewGrid);
|
||||
// UIElement.InputHitTest IS the input pipeline — what Mouse uses.
|
||||
// Do NOT use VisualTreeHelper.HitTest here: it returned the window's
|
||||
// non-hit-testable WebViewHostPanel overlay for EVERY point (it does
|
||||
// not model IsHitTestVisible input semantics) — the bug this test
|
||||
// "found" for months was this wrong API (root-caused 2026-09-01).
|
||||
var hit = window.InputHitTest(cornerInWindow) as DependencyObject;
|
||||
var grabbable = hit != null && IsDescendantOf(hit, previewGrid);
|
||||
|
||||
Assert.True(grabbable,
|
||||
$"{shape}: corner click fell through to '{hit?.VisualHit.GetType().Name ?? "null"}' " +
|
||||
$"{shape}: corner click fell through to '{hit?.GetType().Name ?? "null"}' " +
|
||||
"so the source gets deselected before the resize handler runs");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user