Fabric: Changes in LayoutableShadowNodeTest

Summary:
One small test was added.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21480201

fbshipit-source-id: fd6c050143fcdf27d345ee62e74c4368266e6ce0
This commit is contained in:
Valentin Shergin 2020-05-18 14:04:10 -07:00 коммит произвёл Facebook GitHub Bot
Родитель b4f4f2d33e
Коммит 656db7823c
1 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -113,6 +113,8 @@ TEST_F(LayoutableShadowNodeTest, relativeLayoutMetrics) {
// A is a parent to B, A has origin {10, 10}, B has origin {10, 10}.
// B's relative origin to A should be {10, 10}.
// D19447900 has more about the issue.
EXPECT_EQ(relativeLayoutMetrics.frame.size.width, 100);
EXPECT_EQ(relativeLayoutMetrics.frame.size.height, 200);
EXPECT_EQ(relativeLayoutMetrics.frame.origin.x, 10);
EXPECT_EQ(relativeLayoutMetrics.frame.origin.y, 20);
}
@ -131,7 +133,6 @@ TEST_F(LayoutableShadowNodeTest, relativeLayoutMetricsOnTransformedNode) {
EXPECT_EQ(relativeLayoutMetrics.frame.origin.x, 35);
EXPECT_EQ(relativeLayoutMetrics.frame.origin.y, 70);
EXPECT_EQ(relativeLayoutMetrics.frame.size.width, 50);
EXPECT_EQ(relativeLayoutMetrics.frame.size.height, 100);
}
@ -175,6 +176,21 @@ TEST_F(LayoutableShadowNodeTest, relativeLayoutMetricsOnSameNode) {
EXPECT_EQ(relativeLayoutMetrics.frame.size.height, 200);
}
TEST_F(LayoutableShadowNodeTest, relativeLayoutMetricsOnSameTransformedNode) {
auto layoutMetrics = EmptyLayoutMetrics;
layoutMetrics.frame.origin = {10, 20};
layoutMetrics.frame.size = {100, 200};
nodeA_->setLayoutMetrics(layoutMetrics);
nodeA_->_transform = Transform::Scale(2, 2, 1);
auto relativeLayoutMetrics = nodeA_->getRelativeLayoutMetrics(*nodeA_, {});
EXPECT_EQ(relativeLayoutMetrics.frame.origin.x, 0);
EXPECT_EQ(relativeLayoutMetrics.frame.origin.y, 0);
EXPECT_EQ(relativeLayoutMetrics.frame.size.width, 200);
EXPECT_EQ(relativeLayoutMetrics.frame.size.height, 400);
}
TEST_F(LayoutableShadowNodeTest, relativeLayourMetricsOnClonedNode) {
// B is cloned and mutated.
auto nodeBRevision2 = std::static_pointer_cast<TestShadowNode>(