Skip to content

Commit

Permalink
Add tests for GetAvailableContentForNodeGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
desplesda committed Aug 14, 2024
1 parent 68a44f8 commit 4d3807d
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 3 deletions.
13 changes: 13 additions & 0 deletions Tests/Runtime/DialogueRunnerTests/DialogueRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -587,5 +587,18 @@ public IEnumerator DialogueRunner_OnDialogueStartAndStop_CallsEvents()

runner.Stop();
}

[Test]
public void DialogueRunner_CanQueryNodeGroupCandidates() {
runner.Dialogue.GetAvailableContentForNodeGroup("NodeGroups").Should().HaveCount(1);

runner.VariableStorage.SetValue("$nodeGroupCondition1", true);

runner.Dialogue.GetAvailableContentForNodeGroup("NodeGroups").Should().HaveCount(3);

runner.VariableStorage.SetValue("$nodeGroupCondition2", true);

runner.Dialogue.GetAvailableContentForNodeGroup("NodeGroups").Should().HaveCount(7);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@
}
},
"baseLanguage": "en",
"compilerOptions": {}
"compilerOptions": {
"allowPreviewFeatures": true
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions Tests/Runtime/DialogueRunnerTests/NodeGroups.yarn
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
title: NodeGroups
when: $nodeGroupCondition1
---
Candidate A
===
title: NodeGroups
when: $nodeGroupCondition1
---
Candidate B
===
title: NodeGroups
when: $nodeGroupCondition2
---
Candidate C
===
title: NodeGroups
when: $nodeGroupCondition2
---
Candidate D
===
title: NodeGroups
when: $nodeGroupCondition1 && $nodeGroupCondition2
---
Candidate E
===
title: NodeGroups
when: $nodeGroupCondition1 && $nodeGroupCondition2
---
Candidate F
===
title: NodeGroups
when: always
---
Candidate G
===
title: NodeGroups
when: false
---
Candidate G
===
10 changes: 10 additions & 0 deletions Tests/Runtime/DialogueRunnerTests/NodeGroups.yarn.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4d3807d

Please sign in to comment.