/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include #include #include #include #include class GraphCanvasTranslationTests : public ::testing::Test { protected: void SetUp() override { AZ::ComponentApplication::Descriptor appDesc; appDesc.m_memoryBlocksByteSize = 20 * 1024 * 1024; appDesc.m_recordingMode = AZ::Debug::AllocationRecords::Mode::RECORD_NO_RECORDS; AZ::ComponentApplication::StartupParameters startupParameters; startupParameters.m_loadSettingsRegistry = false; m_app.Create(appDesc, startupParameters); } void TearDown() override { m_app.Destroy(); } AZ::ComponentApplication m_app; }; TEST_F(GraphCanvasTranslationTests, TranslationKey) { GraphCanvas::TranslationKey key1("Constructed"); EXPECT_STRCASEEQ(key1.ToString().c_str(), "Constructed"); GraphCanvas::TranslationKey key2; // Test key assignment key2 = "START"; EXPECT_EQ(key2, "START"); // Test key concatenation with const char* key2 << "TEST"; EXPECT_EQ(key2, "START.TEST"); // Test key concatenation with AZStd::string AZStd::string test1 = "STRING"; key2 << test1; EXPECT_EQ(key2, "START.TEST.STRING"); // Test clear key2.clear(); EXPECT_EQ(key2, ""); // Test Key assignment into AZStd::string key2 << "NEW"; AZStd::string test2 = key2; EXPECT_STRCASEEQ(test2.c_str(), key2.ToString().c_str()); GraphCanvas::TranslationKey key3 = key2; // Compare Key to Key EXPECT_EQ(key2, key3); // Compare Key to const char* EXPECT_EQ(key3, "NEW"); }