Skip to content

Commit

Permalink
#5912: Start creating unit tests covering the GeometryStore implement…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
codereader committed Mar 5, 2022
1 parent 52e15d1 commit e8d8a4c
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Expand Up @@ -10,6 +10,7 @@ add_executable(drtest
Entity.cpp
Favourites.cpp
FileTypes.cpp
GeometryStore.cpp
Grid.cpp
HeadlessOpenGLContext.cpp
ImageLoading.cpp
Expand Down
38 changes: 38 additions & 0 deletions test/GeometryStore.cpp
@@ -0,0 +1,38 @@
#include "gtest/gtest.h"

#include "render/GeometryStore.h"

namespace test
{

class NullSyncObjectProvider final :
public render::ISyncObjectProvider
{
public:
std::size_t invocationCount = 0;

render::ISyncObject::Ptr createSyncObject() override
{
++invocationCount;
return {};
}

static NullSyncObjectProvider& Instance()
{
static NullSyncObjectProvider _instance;
return _instance;
}
};

TEST(GeometryStore, SyncObjectAcquisition)
{
render::GeometryStore store(NullSyncObjectProvider::Instance());

store.onFrameStart();
store.onFrameFinished();

EXPECT_EQ(NullSyncObjectProvider::Instance().invocationCount, 1) <<
"GeometryStore should have acquired one sync object";
}

}
1 change: 1 addition & 0 deletions tools/msvc/Tests/Tests.vcxproj
Expand Up @@ -84,6 +84,7 @@
<ClCompile Include="..\..\..\test\EntityInspector.cpp" />
<ClCompile Include="..\..\..\test\Favourites.cpp" />
<ClCompile Include="..\..\..\test\FileTypes.cpp" />
<ClCompile Include="..\..\..\test\GeometryStore.cpp" />
<ClCompile Include="..\..\..\test\Grid.cpp" />
<ClCompile Include="..\..\..\test\HeadlessOpenGLContext.cpp" />
<ClCompile Include="..\..\..\test\ImageLoading.cpp" />
Expand Down
1 change: 1 addition & 0 deletions tools/msvc/Tests/Tests.vcxproj.filters
Expand Up @@ -56,6 +56,7 @@
<ClCompile Include="..\..\..\test\SceneNode.cpp" />
<ClCompile Include="..\..\..\test\ContinuousBuffer.cpp" />
<ClCompile Include="..\..\..\test\Particles.cpp" />
<ClCompile Include="..\..\..\test\GeometryStore.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\test\HeadlessOpenGLContext.h" />
Expand Down

0 comments on commit e8d8a4c

Please sign in to comment.