2b43ad8029
* Add comparison operator for use from unit tests. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com> * First version of FastNoise benchmarks. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com> * Simplified unit tests and added initial benchmarks. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com> * Add GetValue vs GetValues unit test. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com> * Moved Gradient test code into helper files for use from FastNoise. Also added benchmarks for each type of FastNoise so that we can have some comparative values handy. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com> * Specialization for GetValues(). Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
45 lines
1.7 KiB
C++
45 lines
1.7 KiB
C++
/*
|
|
* 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 <AzTest/AzTest.h>
|
|
|
|
#include <AzCore/Component/Entity.h>
|
|
#include <AzCore/UnitTest/TestTypes.h>
|
|
#include <EditorFastNoiseGradientComponent.h>
|
|
#include <FastNoiseTest.h>
|
|
|
|
|
|
class FastNoiseEditorTestApp : public ::testing::Test
|
|
{
|
|
};
|
|
|
|
TEST_F(FastNoiseEditorTestApp, FastNoise_EditorCreateGameEntity)
|
|
{
|
|
AZStd::unique_ptr<AZ::Entity> noiseEntity(aznew AZ::Entity("editor_noise_entity"));
|
|
ASSERT_TRUE(noiseEntity != nullptr);
|
|
|
|
FastNoiseGem::EditorFastNoiseGradientComponent editor;
|
|
auto* editorBase = static_cast<AzToolsFramework::Components::EditorComponentBase*>(&editor);
|
|
editorBase->BuildGameEntity(noiseEntity.get());
|
|
|
|
// the new game entity's FastNoise component should look like the default one
|
|
FastNoiseGem::FastNoiseGradientConfig defaultConfig;
|
|
FastNoiseGem::FastNoiseGradientConfig gameComponentConfig;
|
|
|
|
FastNoiseGem::FastNoiseGradientComponent* noiseComp = noiseEntity->FindComponent<FastNoiseGem::FastNoiseGradientComponent>();
|
|
ASSERT_TRUE(noiseComp != nullptr);
|
|
|
|
// Change a value in the gameComponentConfig just to verify that it got overwritten instead of simply matching the default.
|
|
gameComponentConfig.m_seed++;
|
|
noiseComp->WriteOutConfig(&gameComponentConfig);
|
|
ASSERT_EQ(defaultConfig, gameComponentConfig);
|
|
}
|
|
|
|
// This uses custom test / benchmark hooks so that we can load LmbrCentral and GradientSignal Gems.
|
|
AZ_UNIT_TEST_HOOK(new UnitTest::FastNoiseTestEnvironment, UnitTest::FastNoiseBenchmarkEnvironment);
|