From cde82b55fc00bf3f2d245d690b91c8683ceec8da Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Mon, 11 May 2020 09:24:14 -0700 Subject: [PATCH] Add comments to a test case in LayoutableShadowNodeTest Summary: Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D21500371 fbshipit-source-id: daec07f82f43aae9cdc31f67599e30873ca108b9 --- .../fabric/core/tests/LayoutableShadowNodeTest.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ReactCommon/fabric/core/tests/LayoutableShadowNodeTest.cpp b/ReactCommon/fabric/core/tests/LayoutableShadowNodeTest.cpp index 9c13ae700f1..8b352952bb5 100644 --- a/ReactCommon/fabric/core/tests/LayoutableShadowNodeTest.cpp +++ b/ReactCommon/fabric/core/tests/LayoutableShadowNodeTest.cpp @@ -192,15 +192,21 @@ TEST_F(LayoutableShadowNodeTest, relativeLayourMetricsOnClonedNode) { EXPECT_EQ(newRelativeLayoutMetrics.frame.size.height, 600); } -TEST_F(LayoutableShadowNodeTest, relativeLayoutMetricsOnSameNode2) { +TEST_F( + LayoutableShadowNodeTest, + relativeLayoutMetricsOnNodesCrossingRootKindNode) { auto layoutMetrics = EmptyLayoutMetrics; nodeA_->setLayoutMetrics(layoutMetrics); layoutMetrics.frame.origin = {10, 10}; + // nodeAA_ is a RootKindNode. Please check + // ShadowNodeTraits::Traits::RootNodeKind for details. nodeAA_->setLayoutMetrics(layoutMetrics); nodeAAA_->setLayoutMetrics(layoutMetrics); auto relativeLayoutMetrics = nodeAAA_->getRelativeLayoutMetrics(*nodeA_, {}); + // relativeLayoutMetrics do not include offsset of nodeAA_ because it is a + // RootKindNode. EXPECT_EQ(relativeLayoutMetrics.frame.origin.x, 10); EXPECT_EQ(relativeLayoutMetrics.frame.origin.y, 10); }