Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions tests/YGPersistenceTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,16 @@ TEST(YogaTest, mixed_shared_and_owned_children) {
YGNodeInsertChild(root1, root1_child0, 0);
YGNodeInsertChild(root1, root1_child2, 1);

auto children = static_cast<yoga::Node*>(root1)->getChildren();
children.insert(children.begin() + 1, static_cast<yoga::Node*>(root0_child0));
static_cast<yoga::Node*>(root1)->setChildren(children);
// Build the child list without vector::insert. GCC 16 at -O2/-O3 reports a
// false array-bounds warning on insert(begin()+1, ...) and the test is
// compiled with -Werror.
auto* node1 = static_cast<yoga::Node*>(root1);
std::vector<yoga::Node*> children{
node1->getChild(0),
static_cast<yoga::Node*>(root0_child0),
node1->getChild(1),
};
node1->setChildren(children);

auto secondChild = YGNodeGetChild(root1, 1);
ASSERT_EQ(secondChild, YGNodeGetChild(root0, 0));
Expand Down