@@ -304,3 +304,38 @@ TEST(YogaTest, dirty_removed_child_nodes_when_removing_all) {
304304 YGNodeFree (child1);
305305 YGNodeFreeRecursive (root);
306306}
307+
308+ TEST (YogaTest, dirty_parent_when_child_freed) {
309+ YGNodeRef root = YGNodeNew ();
310+ YGNodeStyleSetWidth (root, 100 );
311+ YGNodeStyleSetHeight (root, 100 );
312+
313+ YGNodeRef child = YGNodeNew ();
314+ YGNodeStyleSetWidth (child, 50 );
315+ YGNodeStyleSetHeight (child, 50 );
316+ YGNodeInsertChild (root, child, 0 );
317+
318+ YGNodeCalculateLayout (root, YGUndefined, YGUndefined, YGDirectionLTR);
319+ EXPECT_FALSE (YGNodeIsDirty (root));
320+
321+ YGNodeFree (child);
322+
323+ EXPECT_TRUE (YGNodeIsDirty (root));
324+ YGNodeFree (root);
325+ }
326+
327+ TEST (YogaTest, dirty_parent_when_subtree_freed_recursive) {
328+ YGNodeRef root = YGNodeNew ();
329+ YGNodeRef child = YGNodeNew ();
330+ YGNodeRef grandchild = YGNodeNew ();
331+ YGNodeInsertChild (root, child, 0 );
332+ YGNodeInsertChild (child, grandchild, 0 );
333+
334+ YGNodeCalculateLayout (root, YGUndefined, YGUndefined, YGDirectionLTR);
335+ EXPECT_FALSE (YGNodeIsDirty (root));
336+
337+ YGNodeFreeRecursive (child);
338+
339+ EXPECT_TRUE (YGNodeIsDirty (root));
340+ YGNodeFree (root);
341+ }
0 commit comments