Skip to content

Commit

Permalink
Tests: make sure Trays are not shown when samples are run as Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Mar 4, 2024
1 parent 934950f commit a248176
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Samples/Common/include/SdkSample.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace OgreBites

bool frameRenderingQueued(const Ogre::FrameEvent& evt) override
{
if (mTrayMgr->isDialogVisible())
if (mTrayMgr && mTrayMgr->isDialogVisible())
return true;

mInputListenerChain.frameRendered(evt);
Expand Down Expand Up @@ -185,6 +185,13 @@ namespace OgreBites
mContext->addInputListener(&mInputListenerChain);
}

void _removeTrays()
{
mControls.reset();
mTrayMgr.reset();
mInputListenerChain = TouchAgnosticInputListenerChain(mWindow, {});
}

void _shutdown() override
{
if(mContext)
Expand Down
6 changes: 6 additions & 0 deletions Tests/VisualTests/Context/src/TestContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ THE SOFTWARE.
#include "OgreConfigFile.h"
#include "OgrePlatform.h"
#include "OgreBitesConfigDialog.h"
#include <SdkSample.h>

#include <iostream>

Expand Down Expand Up @@ -317,6 +318,11 @@ void TestContext::runSample(OgreBites::Sample* sampleToRun)
if(sampleToRun)
LogManager::getSingleton().logMessage("----- Running Visual Test " + sampleToRun->getInfo()["Title"] + " -----");
SampleContext::runSample(sampleToRun);

if(auto sdkSample = dynamic_cast<OgreBites::SdkSample*>(sampleToRun))
{
sdkSample->_removeTrays();
}
}
//-----------------------------------------------------------------------

Expand Down

0 comments on commit a248176

Please sign in to comment.