-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix loading nested include with custom attributes #789
Conversation
Signed-off-by: Jenn Nguyen <[email protected]>
Codecov Report
@@ Coverage Diff @@
## sdf9 #789 +/- ##
==========================================
+ Coverage 87.46% 87.56% +0.10%
==========================================
Files 63 63
Lines 9893 9894 +1
==========================================
+ Hits 8653 8664 +11
+ Misses 1240 1230 -10
Continue to review full report at Codecov.
|
test/integration/sdf_custom.cc
Outdated
world2->Element()->FindElement("mysim:description"); | ||
ASSERT_NE(nullptr, customDesc1); | ||
ASSERT_NE(nullptr, customDesc2); | ||
EXPECT_EQ(customDesc1->ToString(""), customDesc2->ToString("")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we compare the result of customDesc2->ToString
with the expected string literal instead of trusting customDesc1->ToString
is working properly? Here and below. Not to make to verbose, I would only do it on the comparisons that involve custom elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Jenn Nguyen <[email protected]>
This pull request has been mentioned on Gazebo Community. There might be relevant details there: https://community.gazebosim.org/t/new-ignition-releases-2022-01-10/1228/1 |
This pull request has been mentioned on Gazebo Community. There might be relevant details there: https://community.gazebosim.org/t/new-ignition-releases-2022-03-25-fortress-edifice-citadel/1343/1 |
This pull request has been mentioned on Gazebo Community. There might be relevant details there: https://community.gazebosim.org/t/new-ignition-releases-2022-04-13-fortress-edifice/1367/1 |
🦟 Bug fix
Closes #502
Summary
When working on tests for #502 , I found a bug with nested includes where the included file contained custom attributes. In the parser's
addNestedModel
call, after the string replacement for flattening, the_includeSDF
element was cleared but not it's attributes. This resulted in the custom attribute being added twice and the duplicate attribute would be left with an empty value. This PR fixes the issue by clearing the attributes before callingreadString
and adds tests to ensure custom elements/attributes are preserved when loading a sdformat file and reloading the string output.Before PR
Check out this PR and comment out
_includeSDF->RemoveAllAttributes()
from:https://github.com/ignitionrobotics/sdformat/blob/1c6c0a55d07cc75057f8cc44c5a25b85f155ee8e/src/parser.cc#L1375-L1377
Then run:
The error is:
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.