| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…omponent utilities with tests
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: fb06fae3-9458-480c-94b3-c1704f856344 📥 CommitsReviewing files that changed from the base of the PR and between 50d9542 and 8ebf66f. 📒 Files selected for processing (3)
📝 Walkthrough WalkthroughAdds header-only templates GetChildComponents<TComponent>(Engine::Entity parent) to collect matching child component references and TryGetParentComponent<TComponent>(Engine::Entity child) to fetch a parent's component pointer; updates unit tests and an example usage to exercise these utilities. ChangesRelationship component access utilities
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labelsenhancement Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2 ❌ Failed checks (2 warnings)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches 🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment @coderabbitai help to get the list of available commands and usage tips. |
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)src/plugin/relationship/tests/Relationship.cpp (1)🤖 Prompt for all review comments with AI agents204-221: ⚡ Quick win
Add nullopt-path assertions for TryGetParentComponent.
This test only validates the happy path. Please add cases for “child has no parent” and “parent exists but lacks TestComponent” to lock in the API contract.
✅ Suggested additions🤖 Prompt for AI AgentsTEST(Relationship, try_get_parent_component) { Engine::Core core; @@ auto parentComponent = Relationship::Utils::TryGetParentComponent<TestComponent>(child); ASSERT_TRUE(parentComponent.has_value()); ASSERT_EQ(parentComponent->value, 42); + + auto orphan = core.CreateEntity(); + orphan.AddComponent<Relationship::Component::Relationship>(); + ASSERT_EQ(Relationship::Utils::TryGetParentComponent<TestComponent>(orphan), std::nullopt); + + auto parentWithoutTest = core.CreateEntity(); + auto childWithoutParentTest = core.CreateEntity(); + parentWithoutTest.AddComponent<Relationship::Component::Relationship>(); + childWithoutParentTest.AddComponent<Relationship::Component::Relationship>(); + Relationship::Utils::SetChildOf(childWithoutParentTest, parentWithoutTest); + ASSERT_EQ(Relationship::Utils::TryGetParentComponent<TestComponent>(childWithoutParentTest), std::nullopt); }Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/plugin/relationship/tests/Relationship.cpp` around lines 204 - 221, Add two negative-path assertions to the Relationship.try_get_parent_component test: (1) create a child entity without calling Relationship::Utils::SetChildOf and assert Relationship::Utils::TryGetParentComponent<TestComponent>(child).has_value() is false; (2) create a child and parent, attach Relationship::Component::Relationship to both and call Relationship::Utils::SetChildOf(child, parent) but do not add TestComponent to parent, then assert TryGetParentComponent<TestComponent>(child).has_value() is false—use the same entities and helpers (SetChildOf, TryGetParentComponent, TestComponent) used in the existing test to validate the nullopt paths.
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Inline comments: In `@src/plugin/relationship/src/utils/Utils.hpp`: - Around line 67-70: Forward-declare the ForEachChild function before the TryGetChildComponents template so the template can find it during instantiation; add a declaration matching the actual signature used (e.g., a function taking Engine::Entity and a callable/lambda) above the TryGetChildComponents definition, then keep the full ForEachChild definition later in the header so TryGetChildComponents can call it without lookup/instantiation issues. --- Nitpick comments: In `@src/plugin/relationship/tests/Relationship.cpp`: - Around line 204-221: Add two negative-path assertions to the Relationship.try_get_parent_component test: (1) create a child entity without calling Relationship::Utils::SetChildOf and assert Relationship::Utils::TryGetParentComponent<TestComponent>(child).has_value() is false; (2) create a child and parent, attach Relationship::Component::Relationship to both and call Relationship::Utils::SetChildOf(child, parent) but do not add TestComponent to parent, then assert TryGetParentComponent<TestComponent>(child).has_value() is false—use the same entities and helpers (SetChildOf, TryGetParentComponent, TestComponent) used in the existing test to validate the nullopt paths.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6b41502f-ef21-4b37-9d36-ac60f070e72e
📥 CommitsReviewing files that changed from the base of the PR and between c7a6de6 and 0766e3b.
📒 Files selected for processing (3)
Sorry, something went wrong.
…nent to return pointers and ajust tests accordingly
|
Actionable comments posted: 0 |
Sorry, something went wrong.
…ponents and TryGetParentComponent functions
…ce_back and removing unnecessary checks
| if (childComponent) | ||
| { | ||
| childComponents.emplace_back(childComponent); | ||
| } |
There was a problem hiding this comment.
This if is maybe useless as TryGet... function return something incertains which should (by name) be checked after calling it
Sorry, something went wrong.
…onents who return references of found components
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Pull Request
Description
Related Issues (Optional, put "None" if there are no related issues)
Fixes #609
Relates to #609
Type of Change
Changes Made
List of the main changes in this PR:
Testing (Optional, put "None" if you didn't have to test anything)
Test Environment
Documentation
Checklist (Don't delete any options)
Time Spent (Optional, put "None" if you don't know)
1 hour (including understanding the fork and creating the pull request): 30 minutes of actual coding
Screenshots/Videos (Optional, put "None" if it's not relevant)
None
Breaking Changes (Optional, Put "None" if there are no breaking changes)
None
Additional Notes (Optional, Put "None" if there are no additional notes)
None
Summary by CodeRabbit
New Features
Examples
Tests