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:

  1. Launch FemCAD5 with temelin3.fcs
  2. Run inspector immediately

Expected:

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:

  1. With FemCAD5 open (TC-01 state), click the Script tab header (approx x=341, y=50)
  2. Inspector check pixel grid
  3. Click the 3D View tab header (approx x=426, y=50)
  4. Inspector check pixel grid again

Expected:

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:

  1. Click ⊞ 3D button
  2. Inspector: confirm 3 tabs
  3. Click × on the 3rd tab
  4. Inspector: confirm 2 tabs remain

Expected:


TC-04: Analysis Workflow — F5 Script + F6 Solve + Result Toolbar Visible

Steps:

  1. Launch FemCAD5 with temelin3.fcs
  2. Press F5 (Run Script) — wait ~10s
  3. Press F6 (Run Linear Static Analysis) — wait ~25s (temelin3 is a larger model)
  4. Switch to 3D View tab if not already there

Expected:

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:

  1. Complete TC-04 (analysis run)
  2. Click ⊞ 3D to add a second 3D tab
  3. Wait 2 seconds (deferred ReattachFEMmaster via DispatcherPriority.Loaded)
  4. Inspector pixel grid check

Expected:

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:

  1. Launch FemCAD5 with temelin3.fcs (2 tabs: Script + 3D View)
  2. Inspector: confirm single-pane layout — one ContentControl content area
  3. Click the split-toggle button (rightmost in tab strip)
  4. Inspector: confirm two ContentControl elements visible, GridSplitter present
  5. Check pixel columns — left half and right half both showing 3D viewport color
  6. Click again to close split
  7. Inspector: confirm single pane restored

Expected:

Verified pixel observations (single pane IsSplit=False):

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:


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