feat: named case-result load combinations with full GUI support
Snapshots the current development tree, headlined by proper load combinations (user request): a reusable LoadCombination entity of weighted completed static-case results (e.g. 1.2xDead + 1.6xLive). - core: LoadCombination/LoadCombinationItem entities, Project integration (lookup, unique ids, reference validation) - services: combinations.py (linear superposition + envelope), exported via services __init__ - commands: undoable Add/Delete/Update for combinations - GUI: Load Combinations manager dialog, Run-dialog evaluation, envelope display in Results panel, Combinations tab in Table dock - tests: unit coverage (validation, math, error paths) + integration superposition check vs a single factored run
This commit is contained in:
commit
f361fee969
560 changed files with 178701 additions and 0 deletions
61
tests/gui/test_tree_multi_select.py
Normal file
61
tests/gui/test_tree_multi_select.py
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
"""Model Tree supports Ctrl+click multi-selection — regression guard."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
pytest.importorskip("PySide6")
|
||||
|
||||
from PySide6.QtCore import Qt # noqa: E402
|
||||
from PySide6.QtWidgets import QTreeWidget # noqa: E402
|
||||
|
||||
from otko.core import Node # noqa: E402
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_tree_is_in_extended_selection_mode(qtbot) -> None: # type: ignore[no-untyped-def]
|
||||
"""Default QTreeWidget is single-select; we need ExtendedSelection."""
|
||||
from otko.views.main_window import MainWindow
|
||||
|
||||
mw = MainWindow()
|
||||
qtbot.addWidget(mw)
|
||||
assert mw._tree.selectionMode() == QTreeWidget.SelectionMode.ExtendedSelection
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_tree_multi_select_syncs_canvas(qtbot) -> None: # type: ignore[no-untyped-def]
|
||||
"""Selecting two node rows in the tree must populate the canvas
|
||||
selection with both ids — the precondition for the Zero-Length
|
||||
Section dialog (exactly 2 joints)."""
|
||||
from otko.views.main_window import MainWindow
|
||||
|
||||
mw = MainWindow()
|
||||
qtbot.addWidget(mw)
|
||||
mw._vm.new_project(ndm=2, ndf=3)
|
||||
mw._vm.project.nodes.extend(
|
||||
[
|
||||
Node(id=1, coords=(0, 0, 0)),
|
||||
Node(id=2, coords=(0, 0, 0)),
|
||||
Node(id=3, coords=(1, 0, 0)),
|
||||
]
|
||||
)
|
||||
mw._refresh_tree(mw._vm.project)
|
||||
|
||||
nodes_cat = mw._tree_categories["Nodes"]
|
||||
nodes_cat.setExpanded(True)
|
||||
# Find the three child items and select rows 0 + 1.
|
||||
items = [nodes_cat.child(i) for i in range(nodes_cat.childCount())]
|
||||
assert len(items) == 3
|
||||
items[0].setSelected(True)
|
||||
items[1].setSelected(True)
|
||||
|
||||
assert mw._canvas.selection.nodes == frozenset({1, 2})
|
||||
assert mw._canvas.selection.elements == frozenset()
|
||||
|
||||
# Adding a third selection (row 2) keeps all three.
|
||||
items[2].setSelected(True)
|
||||
assert mw._canvas.selection.nodes == frozenset({1, 2, 3})
|
||||
|
||||
# Deselecting row 0 leaves rows 1 + 2.
|
||||
items[0].setSelected(False)
|
||||
assert mw._canvas.selection.nodes == frozenset({2, 3})
|
||||
Loading…
Reference in a new issue