Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,32 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzTest/AzTest.h>
#include <SceneAPI/SceneCore/Containers/Scene.h>
namespace AZ {
namespace SceneAPI {
namespace Containers {
class MockScene
: public Scene
{
public:
MockScene(const char* name)
: Scene(name)
{}
};
} // namespace Containers
} // namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,61 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzTest/AzTest.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshData.h>
namespace AZ
{
namespace SceneAPI
{
namespace DataTypes
{
class MockIMeshData
: public IMeshData
{
public:
AZ_RTTI(MockIMeshData, "{83BB2FDC-5B57-4334-B8D1-3D328F31AE7F}", IMeshData)
virtual ~MockIMeshData() = default;
MOCK_CONST_METHOD0(GetVertexCount,
unsigned int());
MOCK_CONST_METHOD0(HasNormalData,
bool());
MOCK_CONST_METHOD0(HasTextureCoordinates,
bool());
MOCK_CONST_METHOD1(GetPosition,
const AZ::Vector3 & (unsigned int index));
MOCK_CONST_METHOD1(GetNormal,
const AZ::Vector3 & (unsigned int index));
MOCK_CONST_METHOD1(GetTextureCoordinates,
const AZ::Vector2 & (unsigned int index));
MOCK_CONST_METHOD0(GetFaceCount,
unsigned int());
MOCK_CONST_METHOD1(GetFaceInfo,
const Face&(unsigned int index));
MOCK_CONST_METHOD1(GetFaceMaterialId,
unsigned int(unsigned int index));
MOCK_CONST_METHOD1(GetControlPointIndex,
int(int index));
MOCK_CONST_METHOD0(GetUsedControlPointCount,
size_t());
MOCK_CONST_METHOD2(GetVertexIndex,
unsigned int(int faceIndex, int vertexIndexInFace));
MOCK_CONST_METHOD1(GetUsedPointIndexForControlPoint,
int(int controlPointIndex));
};
} // namespace DataTypes
} //namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,42 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzTest/AzTest.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshVertexColorData.h>
namespace AZ
{
namespace SceneAPI
{
namespace DataTypes
{
class MockIMeshVertexColorData
: public IMeshVertexColorData
{
public:
AZ_RTTI(MockIMeshVertexColorData, "{15AD4D4A-BFCC-41C3-B9BB-F7EFBA0AE0CC}", IMeshVertexColorData)
virtual ~MockIMeshVertexColorData() = default;
MOCK_CONST_METHOD0(GetCustomName,
const AZ::Name& ());
MOCK_CONST_METHOD0(GetCount,
size_t());
MOCK_CONST_METHOD1(GetColor,
const Color&(size_t index));
};
} // namespace DataTypes
} //namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,43 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <gmock/gmock.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshVertexUVData.h>
#include <AzCore/Name/Name.h>
namespace AZ
{
namespace SceneAPI
{
namespace DataTypes
{
class MockIMeshVertexUVData
: public IMeshVertexUVData
{
public:
AZ_RTTI(MockIMeshVertexUVData, "{34528E85-2EE0-4999-B838-113BEDB1A258}", IMeshVertexUVData);
~MockIMeshVertexUVData() override = default;
MOCK_CONST_METHOD0(GetCustomName,
const AZ::Name& ());
MOCK_CONST_METHOD0(GetCount,
size_t());
MOCK_CONST_METHOD1(GetUV,
const AZ::Vector2&(size_t index));
};
} // DataTypes
} // SceneAPI
} // AZ
@@ -0,0 +1,40 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/RTTI/RTTI.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/ITransform.h>
namespace AZ
{
class Transform;
namespace SceneAPI
{
namespace DataTypes
{
class MockITransform
: public ITransform
{
public:
AZ_RTTI(MockITransform, "{1D4A832F-823C-4A80-97E1-A95D1B2BF18F}", ITransform);
virtual ~MockITransform() override = default;
MOCK_METHOD0(GetMatrix,
AZ::SceneAPI::DataTypes::MatrixType&());
MOCK_CONST_METHOD0(GetMatrix,
const AZ::SceneAPI::DataTypes::MatrixType&());
};
} // DataTypes
} // SceneAPI
} // AZ
@@ -0,0 +1,38 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzTest/AzTest.h>
#include <SceneAPI/SceneCore/DataTypes/Groups/IGroup.h>
namespace AZ
{
namespace SceneAPI
{
namespace DataTypes
{
class MockIGroup
: public IGroup
{
public:
AZ_RTTI(MockIGroup, "{533C7569-78CC-4012-A846-8FD232413F42}", IGroup);
MOCK_METHOD0(GetRuleContainer, Containers::RuleContainer&());
MOCK_CONST_METHOD0(GetRuleContainerConst, const Containers::RuleContainer&());
MOCK_CONST_METHOD0(GetName, AZStd::string&());
MOCK_CONST_METHOD0(GetId, Uuid&());
};
} // namespace DataTypes
} // namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,52 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzTest/AzTest.h>
#include <SceneAPI/SceneCore/DataTypes/Groups/IMeshGroup.h>
#include <SceneAPI/SceneCore/DataTypes/ManifestBase/ISceneNodeSelectionList.h>
namespace AZ
{
namespace SceneAPI
{
namespace DataTypes
{
class MockIMeshGroup
: public IMeshGroup
{
public:
AZ_RTTI(MockIMeshGroup, "{AB119B84-E6D8-4CF3-9456-E44B23EDCDFE}", IMeshGroup);
// IMeshGroup
MOCK_METHOD0(GetSceneNodeSelectionList,
ISceneNodeSelectionList&());
MOCK_CONST_METHOD0(GetSceneNodeSelectionList,
const ISceneNodeSelectionList&());
MOCK_CONST_METHOD0(GetId,
const Uuid&());
MOCK_METHOD1(SetName,
void(AZStd::string&&));
MOCK_METHOD1(OverrideId,
void(const Uuid&));
// IGroup
MOCK_CONST_METHOD0(GetName,
const AZStd::string&());
MOCK_METHOD0(GetRuleContainer, Containers::RuleContainer&());
MOCK_CONST_METHOD0(GetRuleContainerConst, const Containers::RuleContainer&());
};
} // namespace DataTypes
} // namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,66 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <gmock/gmock.h>
#include <SceneAPI/SceneCore/DataTypes/ManifestBase/ISceneNodeSelectionList.h>
namespace AZ
{
namespace SceneAPI
{
namespace DataTypes
{
class MockISceneNodeSelectionList
: public ISceneNodeSelectionList
{
public:
AZ_RTTI(MockISceneNodeSelectionList, "{6054C5D9-4719-4483-9E45-94F8BF7E614C}", ISceneNodeSelectionList);
// IMeshGroup
MOCK_CONST_METHOD0(GetSelectedNodeCount,
size_t());
MOCK_CONST_METHOD1(GetSelectedNode,
const AZStd::string & (size_t index));
MOCK_METHOD1(AddSelectedNode,
size_t(const AZStd::string & name));
size_t AddSelectedNode(AZStd::string&& name)
{
return AddSelectedNode(name);
}
MOCK_METHOD1(RemoveSelectedNode,
void(size_t index));
MOCK_METHOD1(RemoveSelectedNode,
void(const AZStd::string & name));
MOCK_METHOD0(ClearSelectedNodes,
void());
MOCK_CONST_METHOD0(GetUnselectedNodeCount,
size_t());
MOCK_CONST_METHOD1(GetUnselectedNode,
const AZStd::string & (size_t index));
MOCK_METHOD0(ClearUnselectedNodes,
void());
MOCK_CONST_METHOD0(CopyProxy,
ISceneNodeSelectionList*());
AZStd::unique_ptr<ISceneNodeSelectionList> Copy() const
{
return AZStd::unique_ptr<ISceneNodeSelectionList>(CopyProxy());
}
MOCK_CONST_METHOD1(CopyTo,
void(ISceneNodeSelectionList& other));
};
} // namespace DataTypes
} // namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,62 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzTest/AzTest.h>
#include <SceneAPI/SceneCore/DataTypes/IGraphObject.h>
namespace AZ
{
namespace SceneAPI
{
namespace DataTypes
{
class MockIGraphObject
: public DataTypes::IGraphObject
{
public:
AZ_RTTI(MockIGraphObject, "{66A082CC-851D-4E1F-ABBD-45B58A216CFA}", DataTypes::IGraphObject);
MockIGraphObject()
: m_id(0)
{}
explicit MockIGraphObject(int id)
: m_id(id)
{}
~MockIGraphObject() override = default;
int m_id;
};
class MockIGraphObjectAlt
: public DataTypes::IGraphObject
{
public:
AZ_RTTI(MockIGraphObjectAlt, "{9DABB454-C60F-4718-8325-E8A95B15DAF5}", DataTypes::IGraphObject);
MockIGraphObjectAlt()
: m_id(0)
{}
explicit MockIGraphObjectAlt(int id)
: m_id(id)
{}
~MockIGraphObjectAlt() override = default;
int m_id;
};
} // namespace DataTypes
} //namespace SceneAPI
} // namespace AZ
@@ -0,0 +1,52 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/std/string/string.h>
#include <AzCore/RTTI/RTTI.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IMeshAdvancedRule.h>
namespace AZ
{
namespace SceneAPI
{
namespace DataTypes
{
class MockIMeshAdvancedRule
: public IMeshAdvancedRule
{
public:
AZ_RTTI(MockIMeshAdvancedRule, "{6F67873D-778C-4D11-8818-B1906E60B67D}", IMeshAdvancedRule);
virtual ~MockIMeshAdvancedRule() override = default;
MOCK_CONST_METHOD0(Use32bitVertices,
bool());
MOCK_CONST_METHOD0(MergeMeshes,
bool());
MOCK_CONST_METHOD0(GetVertexColorStreamName,
const AZStd::string&());
MOCK_CONST_METHOD0(IsVertexColorStreamDisabled,
bool());
MOCK_CONST_METHOD1(GetUVStreamName,
AZStd::string&(size_t index));
MOCK_CONST_METHOD1(IsUVStreamDisabled,
bool(size_t index));
MOCK_CONST_METHOD0(GetUVStreamCount,
size_t());
MOCK_CONST_METHOD0(UseCustomNormals,
bool());
};
} // DataTypes
} // SceneAPI
} // AZ
@@ -0,0 +1,95 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzTest/AzTest.h>
#include <SceneAPI/SceneCore/Events/AssetImportRequest.h>
namespace AZ
{
namespace SceneAPI
{
namespace Events
{
using ::testing::Invoke;
using ::testing::Return;
using ::testing::Matcher;
using ::testing::_;
class MockAssetImportRequestHandler
: public AssetImportRequestBus::Handler
{
public:
MockAssetImportRequestHandler()
{
BusConnect();
}
~MockAssetImportRequestHandler() override
{
BusDisconnect();
}
MOCK_METHOD1(GetSupportedFileExtensions,
void(AZStd::unordered_set<AZStd::string>& extensions));
MOCK_METHOD1(GetManifestExtension,
void(AZStd::string& result));
MOCK_METHOD2(PrepareForAssetLoading,
ProcessingResult(Containers::Scene& scene, RequestingApplication requester));
MOCK_METHOD4(LoadAsset,
LoadingResult(Containers::Scene& scene, const AZStd::string& path, const Uuid& guid, RequestingApplication requester));
MOCK_METHOD2(FinalizeAssetLoading,
void(Containers::Scene& scene, RequestingApplication requester));
MOCK_METHOD3(UpdateManifest,
ProcessingResult(Containers::Scene& scene, ManifestAction action, RequestingApplication requester));
void DefaultGetSupportedFileExtensions(AZStd::unordered_set<AZStd::string>& extensions)
{
extensions.insert(".asset");
}
void DefaultGetManifestExtension(AZStd::string& result)
{
result = ".manifest";
}
void SetDefaultExtensions()
{
ON_CALL(*this, GetSupportedFileExtensions(Matcher<AZStd::unordered_set<AZStd::string>&>(_)))
.WillByDefault(Invoke(this, &MockAssetImportRequestHandler::DefaultGetSupportedFileExtensions));
ON_CALL(*this, GetManifestExtension(Matcher<AZStd::string&>(_)))
.WillByDefault(Invoke(this, &MockAssetImportRequestHandler::DefaultGetManifestExtension));
}
void SetDefaultProcessingResults(bool forManifest)
{
ON_CALL(*this, PrepareForAssetLoading(Matcher<Containers::Scene&>(_), Matcher<RequestingApplication>(_)))
.WillByDefault(Return(ProcessingResult::Ignored));
if (forManifest)
{
ON_CALL(*this, LoadAsset(Matcher<Containers::Scene&>(_), Matcher<const AZStd::string&>(_), Matcher<const Uuid&>(_), Matcher<RequestingApplication>(_)))
.WillByDefault(Return(LoadingResult::ManifestLoaded));
}
else
{
ON_CALL(*this, LoadAsset(Matcher<Containers::Scene&>(_), Matcher<const AZStd::string&>(_), Matcher<const Uuid&>(_), Matcher<RequestingApplication>(_)))
.WillByDefault(Return(LoadingResult::AssetLoaded));
}
ON_CALL(*this, UpdateManifest(Matcher<Containers::Scene&>(_), Matcher<ManifestAction>(_), Matcher<RequestingApplication>(_)))
.WillByDefault(Return(ProcessingResult::Ignored));
}
};
} // Events
} // SceneAPI
} // AZ