FemCAD5 GUI Test Cases
These are key GUI scenarios verified via the Inspector tool (tools/FemCAD5.Inspector).
All tests use TestData/test-temelin3/temelin3.fcs unless stated otherwise.
Each test must pass same or better in future regressions.
How to run the Inspector
# Start FemCAD5 with a file
Start-Process dotnet -ArgumentList "run --project FemCAD5/FemCAD5.csproj -- `"TestData/test-temelin3/temelin3.fcs`"" -WorkingDirectory "D:\GitHub\...\fcs-histruct"
# Run the inspector
dotnet run --project tools/FemCAD5.Inspector/FemCAD5.Inspector.csproj -- inspect
Inspector commands: focus, wait:Nms, keys:F5, click:X,Y, inspect
Screenshot is saved to D:\tmp\femcad5_screenshot.png.
TC-01: Tab System Renders Correctly on Launch
Steps:
- Launch FemCAD5 with
temelin3.fcs - Run inspector immediately
Expected:
- Window title:
FemCAD5 — temelin3.fcs - Tab strip: 2 tabs:
Script(icon{}) and3D View(icon⬡), each with×close button - Add-tab buttons
⊞ 3Dand⊞ Scriptvisible at top-right of tab strip - Center pixel grid: light blue gradient (
#476EE2background) = 3D viewport active - Model tree: shows
Document→Geometry,Mesh,Model→Mechanical
Inspector check (key lines):
DataItem ... Text "Script"
DataItem ... Text "3D View"
Button "⊞ 3D"
Button "⊞ Script"
Custom [ViewportView]
Pane [WindowsFormsHost]
center=#829AEB (light)
TC-02: Tab Switching Works
Steps:
- With FemCAD5 open (TC-01 state), click the Script tab header (approx
x=341, y=50) - Inspector check pixel grid
- Click the 3D View tab header (approx
x=426, y=50) - Inspector check pixel grid again
Expected:
- After clicking Script tab: center pixel =
#1E1E2E(dark editor background),ScriptEditorViewat full size in tree - After clicking 3D View tab: center pixel =
#476EE2(blue 3D background),ViewportViewat full size in tree - Result toolbar (
Result:, ComboBox, Mesh, ComboBox) hidden on Script tab, visible on 3D tab
Root-cause note: WPF visibility must be on a wrapper Grid, not on the ViewportView/ScriptEditorView element directly, because DataContext reassignment causes the binding to resolve against the wrong VM.
TC-03: Add and Close Tab
Steps:
- Click
⊞ 3Dbutton - Inspector: confirm 3 tabs
- Click
×on the 3rd tab - Inspector: confirm 2 tabs remain
Expected:
- After add: tabs =
["Script", "3D View", "3D View 2"] - After close: tabs =
["Script", "3D View"] - Minimum 1 tab always enforced (cannot close last tab)
TC-04: Analysis Workflow — F5 Script + F6 Solve + Result Toolbar Visible
Steps:
- Launch FemCAD5 with
temelin3.fcs - Press F5 (Run Script) — wait ~10s
- Press F6 (Run Linear Static Analysis) — wait ~25s (temelin3 is a larger model)
- Switch to 3D View tab if not already there
Expected:
- After F5: status bar =
Script completed - After F6: status bar =
Analysis complete - Center pixel grid: multi-color (FEM colormap — greens
#67FF11, blues#3311FF, purples#A721F6) - Result toolbar visible as a distinct row above the viewport (not overlaid):
Result:label- ComboBox #1 (170px wide) — lists result objects (e.g. linear static result)
Meshcheckbox — toggles mesh visibility- ComboBox #2 (150px wide) — lists quantity options (Displacement, Stress, etc.)
- Toolbar hidden when Script tab is active
Key bug history: The result toolbar was originally an overlaid WPF Border inside the ContentControl.ContentTemplate. Because WindowsFormsHost creates a real Win32 HWND, WPF elements in the same Z-plane are hidden behind it (WPF airspace problem). Fix: moved toolbar to a dedicated RowDefinition Height="Auto" row (Grid.Row="1") above the ContentControl (Grid.Row="2"), bound directly to ViewTabs.ActiveTab.ViewportVisibility and Results.* from MainViewModel.
Key bindings (MainWindow.xaml):
<!-- CORRECT: In own Grid row, outside WinForms airspace -->
<Border Grid.Row="1"
Visibility="{Binding ViewTabs.ActiveTab.ViewportVisibility, FallbackValue=Collapsed}">
<ComboBox ItemsSource="{Binding Results.Results}"
SelectedItem="{Binding Results.SelectedResult}"
DisplayMemberPath="Name"/>
<ComboBox ItemsSource="{Binding ViewTabs.ActiveTab.Viewport.AvailableQuantities}"
SelectedItem="{Binding ViewTabs.ActiveTab.Viewport.SelectedQuantity}"
DisplayMemberPath="Name"/>
</Border>
<!-- WRONG (old): toolbar inside DataTemplate overlaying WindowsFormsHost -->
TC-05: Second 3D Tab Shows Model After Analysis
Steps:
- Complete TC-04 (analysis run)
- Click
⊞ 3Dto add a second 3D tab - Wait 2 seconds (deferred
ReattachFEMmasterviaDispatcherPriority.Loaded) - Inspector pixel grid check
Expected:
- New tab
3D View 2appears in tab strip - Center pixel grid:
#8297D1(grey-blue = model geometry, no colormap since no result selected yet) - Viewport is independent — can select different result quantities per tab
- Result toolbar QuantityComboBox (
ViewTabs.ActiveTab.Viewport.AvailableQuantities) updates to the new tab's quantities when tab is switched
Key bug history: ReattachFEMmaster was called before the tab was added to Tabs and made active, so the WinForms rendering pipeline wasn't ready. Fix: deferred via Dispatcher.BeginInvoke(DispatcherPriority.Loaded, ...) in ViewTabsViewModel.AddTab().
TC-06: Toolbar Hides on Script Tab
Automated check sequence:
# Click Script tab → toolbar should disappear
dotnet run --project tools/FemCAD5.Inspector/FemCAD5.Inspector.csproj -- click:341,50 wait:400 inspect 2>&1 | Select-String "Result:|ComboBox"
# Expected: NO matches
# Click 3D View tab → toolbar should reappear
dotnet run --project tools/FemCAD5.Inspector/FemCAD5.Inspector.csproj -- click:426,50 wait:400 inspect 2>&1 | Select-String "Result:|ComboBox"
# Expected: "Result:" and 2x ComboBox found
TC-07: Split View — Two Panes Side by Side
Steps:
- Launch FemCAD5 with
temelin3.fcs(2 tabs: Script + 3D View) - Inspector: confirm single-pane layout — one
ContentControlcontent area - Click the ⧉ split-toggle button (rightmost in tab strip)
- Inspector: confirm two
ContentControlelements visible,GridSplitterpresent - Check pixel columns — left half and right half both showing 3D viewport color
- Click ⧉ again to close split
- Inspector: confirm single pane restored
Expected:
- After split ON:
GridSplitter (4×1044)visible in content area between the two panes- Left pane: active tab content (
ViewportView 986×1044for 3D tab) - Right pane: first non-active tab content — Script tab shows
ScriptEditorView 986×1044, another 3D tab showsViewportView 986×1044 - Both panes are equal width (50/50)
- "⧉" button highlighted in AccentBrush (
#89B4FA)
- After split OFF:
ViewportView (1976×1044)full width restored — primary pane hasColumnSpan=3- Content-area GridSplitter gone
Verified pixel observations (single pane IsSplit=False):
- All center columns:
#426AE1→#D7DAF8gradient — full-width 3D viewport
Verified tree observations (split IsSplit=True):
Custom [ViewportView] (986x1044 @301,103) ← left pane (3D active tab)
Pane [WindowsFormsHost] (986x1043 @301,103)
Thumb [GridSplitter] (4x1044 @1287,103) ← content splitter
Custom [ScriptEditorView] (986x1044 @1291,103) ← right pane (Script secondary tab)
Automated check sequence:
# 1. Start app
Start-Process dotnet -ArgumentList "run --project FemCAD5/FemCAD5.csproj -- TestData/test-temelin3/temelin3.fcs" -WorkingDirectory "D:\GitHub\fcs-histruct-e4-claude\fcs-histruct"
Start-Sleep 7
# 2. Baseline — full-width single pane, no content GridSplitter
dotnet run --project tools/FemCAD5.Inspector/FemCAD5.Inspector.csproj -- focus inspect 2>&1 | Select-String "ViewportView"
# Expected: ViewportView (1976x1044 @301,103)
# 3. Click ⧉ split button (@2257,52)
dotnet run --project tools/FemCAD5.Inspector/FemCAD5.Inspector.csproj -- focus click:2257,52 wait:600 inspect 2>&1 | Select-String "ViewportView|ScriptEditorView|GridSplitter" | Where-Object { $_ -match "1287|1291|103" -or $_ -match "View" }
# Expected:
# Custom [ViewportView] (986x1044 @301,103)
# Thumb [GridSplitter] (4x1044 @1287,103)
# Custom [ScriptEditorView] (986x1044 @1291,103)
# 4. Click ⧉ again to close split
dotnet run --project tools/FemCAD5.Inspector/FemCAD5.Inspector.csproj -- focus click:2257,52 wait:400 inspect 2>&1 | Select-String "ViewportView"
# Expected: ViewportView (1976x1044 @301,103) — full width restored
Key implementation notes:
ViewTabsViewModel.IsSplitdrivesGridSplitter+ secondaryContentControlvisibility viaBoolToVisibilityConverterViewTabsViewModel.SecondaryTabbound to secondContentControl.Content- Both panes share
TabContentTemplateinWindow.Resourcesto avoid XAML duplication CloseTab()automatically turns off split if the closed tab was the secondary- The
GridSplitteris a draggable WPF element (not over WindowsFormsHost) so airspace is not an issue
Key Bindings Reference
| Key | Action |
|---|---|
| F5 | Run Script (builds geometry, mesh, model in FEMmaster) |
| F6 | Run Linear Static Analysis |
| Ctrl+O | Open file |
| Ctrl+S | Save file |
| Ctrl+N | New document |
Inspector Pixel Grid Color Legend
| Color (approx) | Meaning |
|---|---|
#476EE2 / #829AEB |
3D viewport sky gradient (empty/no geometry) |
#8297D1 / #92A2D5 |
Model geometry rendered (grey-blue structural model) |
#67FF11, #13FEA8 |
FEM colormap — high displacement / positive stress |
#3311FF, #6F11FF |
FEM colormap — low displacement / negative stress |
#1E1E2E |
Dark editor background (ScriptEditorView active) |
#CDD6F4 |
Script editor text/content |