|
9 | 9 |
|
10 | 10 | #include <folly/dynamic.h> |
11 | 11 | #include <gtest/gtest.h> |
| 12 | +#include <react/renderer/animationbackend/AnimatedProps.h> |
12 | 13 | #include <react/renderer/components/view/ViewShadowNode.h> |
13 | 14 | #include <react/renderer/core/PropsParserContext.h> |
14 | 15 | #include <react/renderer/element/Element.h> |
@@ -101,6 +102,32 @@ TEST_F(SynchronousTransformOverlayTest, parsesTransformLikeProps) { |
101 | 102 | EXPECT_EQ(*transform, Transform::Translate(0, 100, 0)); |
102 | 103 | } |
103 | 104 |
|
| 105 | +TEST_F(SynchronousTransformOverlayTest, parsesAnimatedProps) { |
| 106 | + auto animatedProps = AnimatedProps{}; |
| 107 | + animatedProps.props.push_back( |
| 108 | + std::make_unique<AnimatedProp<Transform>>( |
| 109 | + TRANSFORM, Transform::Translate(0, 300, 0))); |
| 110 | + |
| 111 | + overlay_.update(2, animatedProps, propsParserContext_); |
| 112 | + |
| 113 | + auto transform = overlay_.getTransformOverride(*childShadowNode_); |
| 114 | + ASSERT_TRUE(transform.has_value()); |
| 115 | + EXPECT_EQ(*transform, Transform::Translate(0, 300, 0)); |
| 116 | +} |
| 117 | + |
| 118 | +TEST_F(SynchronousTransformOverlayTest, parsesUntypedAnimatedProps) { |
| 119 | + auto animatedProps = AnimatedProps{}; |
| 120 | + animatedProps.rawProps = std::make_unique<RawProps>(folly::dynamic::object( |
| 121 | + "transform", |
| 122 | + folly::dynamic::array(folly::dynamic::object("translateY", 300)))); |
| 123 | + |
| 124 | + overlay_.update(2, animatedProps, propsParserContext_); |
| 125 | + |
| 126 | + auto transform = overlay_.getTransformOverride(*childShadowNode_); |
| 127 | + ASSERT_TRUE(transform.has_value()); |
| 128 | + EXPECT_EQ(*transform, Transform::Translate(0, 300, 0)); |
| 129 | +} |
| 130 | + |
104 | 131 | TEST_F(SynchronousTransformOverlayTest, mergesTransformOriginUpdates) { |
105 | 132 | // The committed props have no transform origin; a synchronous update of |
106 | 133 | // the origin alone applies to the committed transform (5, 5). |
|
0 commit comments