guardia-messenger/node_modules/react-native/ReactCommon/react/renderer/attributedstring/tests/AttributedStringBoxTest.cpp
DESKTOP-TKLFCPRython f29f525c77 refactor: 101.79.17.164 → zioinfo.co.kr 전체 도메인 변환 + Manager UI 배포
- 37개 파일 IP → zioinfo.co.kr 치환 (소스/매뉴얼/설정/하네스)
- Manager DrConsole/NetworkConsole/CsapConsole 빌드 + /var/www/manager/ 배포
- 테스트: Manager HTTP 200, ITSM 신규 API 7개 전체 200

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 10:09:17 +09:00

104 lines
3.5 KiB
C++

/*
* Copyright (c) Meta Platforms, Inc. and 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/attributedstring/AttributedStringBox.h>
namespace facebook::react {
TEST(AttributedStringBoxTest, testDefaultConstructor) {
auto attributedStringBox = AttributedStringBox{};
EXPECT_EQ(attributedStringBox.getMode(), AttributedStringBox::Mode::Value);
EXPECT_EQ(attributedStringBox.getValue(), AttributedString{});
}
TEST(AttributedStringBoxTest, testValueConstructor) {
auto attributedString = AttributedString{};
auto fragment = AttributedString::Fragment{};
fragment.string = "test string";
attributedString.appendFragment(fragment);
auto attributedStringBox = AttributedStringBox{attributedString};
EXPECT_EQ(attributedStringBox.getMode(), AttributedStringBox::Mode::Value);
EXPECT_EQ(attributedStringBox.getValue(), attributedString);
}
TEST(AttributedStringBoxTest, testOpaquePointerConstructor) {
auto string = std::make_shared<std::string>("test string");
auto attributedStringBox = AttributedStringBox{string};
EXPECT_EQ(
attributedStringBox.getMode(), AttributedStringBox::Mode::OpaquePointer);
EXPECT_EQ(attributedStringBox.getOpaquePointer(), string);
EXPECT_EQ(string.use_count(), 2);
}
TEST(AttributedStringBoxTest, testMoveConstructor) {
{
auto string = std::make_shared<std::string>("test string");
auto movedFromAttributedStringBox = AttributedStringBox{string};
auto moveToAttributedStringBox =
AttributedStringBox{std::move(movedFromAttributedStringBox)};
EXPECT_EQ(
moveToAttributedStringBox.getMode(),
AttributedStringBox::Mode::OpaquePointer);
EXPECT_EQ(moveToAttributedStringBox.getOpaquePointer(), string);
EXPECT_EQ(string.use_count(), 2);
}
{
auto attributedString = AttributedString{};
auto fragment = AttributedString::Fragment{};
fragment.string = "test string";
attributedString.appendFragment(fragment);
auto movedFromAttributedStringBox = AttributedStringBox{attributedString};
auto moveToAttributedStringBox =
AttributedStringBox{std::move(movedFromAttributedStringBox)};
EXPECT_EQ(
moveToAttributedStringBox.getMode(), AttributedStringBox::Mode::Value);
EXPECT_EQ(moveToAttributedStringBox.getValue(), attributedString);
}
}
TEST(AttributedStringBoxTest, testMoveAssignment) {
{
auto string = std::make_shared<std::string>("test string");
auto movedFromAttributedStringBox = AttributedStringBox{string};
auto movedToAttributedStringBox = AttributedStringBox{};
movedToAttributedStringBox = std::move(movedFromAttributedStringBox);
EXPECT_EQ(
movedToAttributedStringBox.getMode(),
AttributedStringBox::Mode::OpaquePointer);
EXPECT_EQ(movedToAttributedStringBox.getOpaquePointer(), string);
EXPECT_EQ(string.use_count(), 2);
}
{
auto attributedString = AttributedString{};
auto fragment = AttributedString::Fragment{};
fragment.string = "test string";
attributedString.appendFragment(fragment);
auto movedFromAttributedStringBox = AttributedStringBox{attributedString};
auto moveToAttributedStringBox = AttributedStringBox{};
moveToAttributedStringBox = std::move(movedFromAttributedStringBox);
EXPECT_EQ(
moveToAttributedStringBox.getMode(), AttributedStringBox::Mode::Value);
EXPECT_EQ(moveToAttributedStringBox.getValue(), attributedString);
}
}
} // namespace facebook::react