mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
move fabric to ReactCommon/react/renderer
Summary: This diff moves fabric C++ code from ReactCommon/fabric to ReactCommon/react/renderer As part of this diff I also refactored components, codegen and callsites on CatalystApp, FB4A and venice Script: P137350694 changelog: [internal] internal refactor Reviewed By: fkgozali Differential Revision: D22852139 fbshipit-source-id: f85310ba858b6afd81abfd9cbe6d70b28eca7415
This commit is contained in:
committed by
Facebook GitHub Bot
parent
79d0a7d711
commit
3093010ea5
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <react/renderer/debug/DebugStringConvertibleItem.h>
|
||||
|
||||
using namespace facebook::react;
|
||||
|
||||
TEST(DebugStringConvertibleTest, handleSimpleNode) {
|
||||
SharedDebugStringConvertibleList empty;
|
||||
auto item = std::make_shared<DebugStringConvertibleItem>(
|
||||
"View", "hello", empty, empty);
|
||||
|
||||
ASSERT_STREQ(item->getDebugName().c_str(), "View");
|
||||
ASSERT_STREQ(item->getDebugValue().c_str(), "hello");
|
||||
ASSERT_STREQ(item->getDebugDescription().c_str(), "<View=hello/>");
|
||||
}
|
||||
|
||||
TEST(DebugStringConvertibleTest, handleSimpleNodeWithProps) {
|
||||
SharedDebugStringConvertibleList empty;
|
||||
SharedDebugStringConvertibleList props = {
|
||||
std::make_shared<DebugStringConvertibleItem>("x", "1", empty, empty)};
|
||||
auto item = std::make_shared<DebugStringConvertibleItem>(
|
||||
"View", "hello", props, empty);
|
||||
|
||||
ASSERT_STREQ(item->getDebugName().c_str(), "View");
|
||||
ASSERT_STREQ(item->getDebugValue().c_str(), "hello");
|
||||
ASSERT_STREQ(item->getDebugDescription().c_str(), "<View=hello x=1/>");
|
||||
}
|
||||
|
||||
TEST(DebugStringConvertibleTest, handleSimpleNodeWithChildren) {
|
||||
SharedDebugStringConvertibleList empty;
|
||||
SharedDebugStringConvertibleList children = {
|
||||
std::make_shared<DebugStringConvertibleItem>("Child", "a", empty, empty)};
|
||||
auto item = std::make_shared<DebugStringConvertibleItem>(
|
||||
"View", "hello", empty, children);
|
||||
|
||||
ASSERT_STREQ(item->getDebugName().c_str(), "View");
|
||||
ASSERT_STREQ(item->getDebugValue().c_str(), "hello");
|
||||
ASSERT_STREQ(
|
||||
item->getDebugDescription().c_str(),
|
||||
"<View=hello>\n <Child=a/>\n</View>");
|
||||
}
|
||||
|
||||
TEST(DebugStringConvertibleTest, handleNestedNode) {
|
||||
SharedDebugStringConvertibleList empty;
|
||||
SharedDebugStringConvertibleList props = {
|
||||
std::make_shared<DebugStringConvertibleItem>("x", "1", empty, empty)};
|
||||
SharedDebugStringConvertibleList children = {
|
||||
std::make_shared<DebugStringConvertibleItem>("Child", "a", props, empty)};
|
||||
auto item = std::make_shared<DebugStringConvertibleItem>(
|
||||
"View", "hello", props, children);
|
||||
|
||||
ASSERT_STREQ(item->getDebugName().c_str(), "View");
|
||||
ASSERT_STREQ(item->getDebugValue().c_str(), "hello");
|
||||
ASSERT_STREQ(
|
||||
item->getDebugDescription().c_str(),
|
||||
"<View=hello x=1>\n <Child=a x=1/>\n</View>");
|
||||
}
|
||||
|
||||
TEST(DebugStringConvertibleTest, handleNodeWithComplexProps) {
|
||||
SharedDebugStringConvertibleList empty;
|
||||
SharedDebugStringConvertibleList subProps = {
|
||||
std::make_shared<DebugStringConvertibleItem>(
|
||||
"height", "100", empty, empty),
|
||||
std::make_shared<DebugStringConvertibleItem>(
|
||||
"width", "200", empty, empty)};
|
||||
SharedDebugStringConvertibleList props = {
|
||||
std::make_shared<DebugStringConvertibleItem>("x", "1", subProps, empty)};
|
||||
auto item = std::make_shared<DebugStringConvertibleItem>(
|
||||
"View", "hello", props, empty);
|
||||
|
||||
ASSERT_STREQ(item->getDebugName().c_str(), "View");
|
||||
ASSERT_STREQ(item->getDebugValue().c_str(), "hello");
|
||||
ASSERT_STREQ(
|
||||
item->getDebugDescription().c_str(),
|
||||
"<View=hello x=1(height=100 width=200)/>");
|
||||
}
|
||||
Reference in New Issue
Block a user