Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp
TEST_F(ModelTests, AddStreamBufferNoBeginNoBeginMesh)
    {
        using namespace AZ;

        RPI::ModelLodAssetCreator creator;

        const uint32_t vertexCount = 36;
        const uint32_t vertexSize = sizeof(float) * 3;

        RHI::BufferViewDescriptor validStreamBufferViewDescriptor =
            RHI::BufferViewDescriptor::CreateStructured(0, vertexCount, vertexSize);

        Data::Asset<RPI::BufferAsset> validStreamBuffer = BuildTestBuffer(vertexCount, vertexSize);

        {
            ErrorMessageFinder messageFinder("Begin() was not called");
            creator.AddMeshStreamBuffer(GetPositionSemantic(), AZ::Name(), { AZStd::move(validStreamBuffer), validStreamBufferViewDescriptor });
        }

        creator.Begin(Data::AssetId(AZ::Uuid::CreateRandom()));

        //This should still fail even if we call Begin but not BeginMesh
        validStreamBuffer = BuildTestBuffer(vertexCount, vertexSize);

        {
            ErrorMessageFinder messageFinder("BeginMesh() was not called");
            creator.AddMeshStreamBuffer(GetPositionSemantic(), AZ::Name(), { AZStd::move(validStreamBuffer), validStreamBufferViewDescriptor });
        }
    }
// Tests that if we try to add a stream buffer on a mesh
// without calling Begin or BeginMesh that it fails
// as expected. Also tests the case that Begin *is*
// called but BeginMesh is not.
Tests that if we try to add a stream buffer on a mesh
without calling Begin or BeginMesh that it fails
as expected. Also tests the case that Begin *is
called but BeginMesh is not.
Tests that if we try to add a stream buffer on a mesh without calling Begin or BeginMesh that it fails as expected . Also tests the case that Begin * is called but BeginMesh is not .
TEST_F(ModelTests, AddStreamBufferNoBeginNoBeginMesh)
    {
        using namespace AZ;
        RPI::ModelLodAssetCreator creator;
        const uint32_t vertexCount = 36;
        const uint32_t vertexSize = sizeof(float) * 3;
        RHI::BufferViewDescriptor validStreamBufferViewDescriptor =
            RHI::BufferViewDescriptor::CreateStructured(0, vertexCount, vertexSize);
        Data::Asset<RPI::BufferAsset> validStreamBuffer = BuildTestBuffer(vertexCount, vertexSize);
        {
            ErrorMessageFinder messageFinder("Begin() was not called");
            creator.AddMeshStreamBuffer(GetPositionSemantic(), AZ::Name(), { AZStd::move(validStreamBuffer), validStreamBufferViewDescriptor });
        }
        creator.Begin(Data::AssetId(AZ::Uuid::CreateRandom()));
        validStreamBuffer = BuildTestBuffer(vertexCount, vertexSize);
        {
            ErrorMessageFinder messageFinder("BeginMesh() was not called");
            creator.AddMeshStreamBuffer(GetPositionSemantic(), AZ::Name(), { AZStd::move(validStreamBuffer), validStreamBufferViewDescriptor });
        }
    }
TEST_F ( ModelTests , AddStreamBufferNoBeginNoBeginMesh ) { using namespace AZ ; RPI :: ModelLodAssetCreator creator ; const uint32_t vertexCount = 36 ; const uint32_t vertexSize = sizeof ( float ) * 3 ; RHI :: BufferViewDescriptor validStreamBufferViewDescriptor = RHI :: BufferViewDescriptor :: CreateStructured ( 0 , vertexCount , vertexSize ) ; Data :: Asset < RPI :: BufferAsset > validStreamBuffer = BuildTestBuffer ( vertexCount , vertexSize ) ; { ErrorMessageFinder messageFinder ( " " ) ; creator . AddMeshStreamBuffer ( GetPositionSemantic ( ) , AZ :: Name ( ) , { AZStd :: move ( validStreamBuffer ) , validStreamBufferViewDescriptor } ) ; } creator . Begin ( Data :: AssetId ( AZ :: Uuid :: CreateRandom ( ) ) ) ; validStreamBuffer = BuildTestBuffer ( vertexCount , vertexSize ) ; { ErrorMessageFinder messageFinder ( " " ) ; creator . AddMeshStreamBuffer ( GetPositionSemantic ( ) , AZ :: Name ( ) , { AZStd :: move ( validStreamBuffer ) , validStreamBufferViewDescriptor } ) ; } }
Tests that if we try to add a stream buffer on a mesh
without calling Begin or BeginMesh that it fails
as expected.
Tests that if we try to add a stream buffer on a mesh without calling Begin or BeginMesh that it fails as expected .
//This should still fail even if we call Begin but not BeginMesh