Skip to content

Commit a248176

Browse files
committed
Tests: make sure Trays are not shown when samples are run as Tests
1 parent 934950f commit a248176

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Samples/Common/include/SdkSample.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ namespace OgreBites
116116

117117
bool frameRenderingQueued(const Ogre::FrameEvent& evt) override
118118
{
119-
if (mTrayMgr->isDialogVisible())
119+
if (mTrayMgr && mTrayMgr->isDialogVisible())
120120
return true;
121121

122122
mInputListenerChain.frameRendered(evt);
@@ -185,6 +185,13 @@ namespace OgreBites
185185
mContext->addInputListener(&mInputListenerChain);
186186
}
187187

188+
void _removeTrays()
189+
{
190+
mControls.reset();
191+
mTrayMgr.reset();
192+
mInputListenerChain = TouchAgnosticInputListenerChain(mWindow, {});
193+
}
194+
188195
void _shutdown() override
189196
{
190197
if(mContext)

Tests/VisualTests/Context/src/TestContext.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ THE SOFTWARE.
3333
#include "OgreConfigFile.h"
3434
#include "OgrePlatform.h"
3535
#include "OgreBitesConfigDialog.h"
36+
#include <SdkSample.h>
3637

3738
#include <iostream>
3839

@@ -317,6 +318,11 @@ void TestContext::runSample(OgreBites::Sample* sampleToRun)
317318
if(sampleToRun)
318319
LogManager::getSingleton().logMessage("----- Running Visual Test " + sampleToRun->getInfo()["Title"] + " -----");
319320
SampleContext::runSample(sampleToRun);
321+
322+
if(auto sdkSample = dynamic_cast<OgreBites::SdkSample*>(sampleToRun))
323+
{
324+
sdkSample->_removeTrays();
325+
}
320326
}
321327
//-----------------------------------------------------------------------
322328

0 commit comments

Comments
 (0)