Skip to content

Test that a node style set on a delegate model reaches the style role - #550

Merged
paceholder merged 1 commit into
masterfrom
node-style-role-test
Nov 23, 2026
Merged

paceholder merged 1 commit into
masterfrom
node-style-role-test

Conversation

@paceholder

Copy link
Copy Markdown
Owner

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation/refactoring (test only)

Description

Add a regression test for #377: a style set with NodeDelegateModel::setNodeStyle() must reach NodeRole::Style.

The code was fixed in 3.1.5 by 163ed49. Before that, DataFlowGraphModel::nodeData(NodeRole::Style) returned the global style, so a per-node style had no effect. No test covered it.

The tests (tag [style]):

  • The role returns the style set on the node's delegate model, not the global one.
  • Two nodes of the same type keep their own styles.
  • A node that never sets a style keeps the global style from the time it was created.
  • setNodeStyle() alone emits no nodeUpdated. After requestNodeUpdate() the model emits it once, and the role shows the new style. The test checks the signal, not pixels.

There is no library change.

Testing

  • Qt version tested: Qt 6.12.0, macOS (Apple Clang)
  • Existing tests still pass (756 assertions in 68 test cases, offscreen)
  • Added tests for new functionality. With the old line auto style = StyleCollection::nodeStyle(); in DataFlowGraphModel.cpp, all four cases fail.
  • Not tested: Qt 5, Windows, Linux (CI will).

Breaking changes?

No.

Related issue

Related to #377.

Covers #377. Before 163ed49 the style role returned the global style, so setNodeStyle() had no effect. The test fails without that change.
@paceholder
paceholder merged commit 7f30d47 into master Nov 23, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant