Prototyped command object infrastructure to be used in regression tests of Octave scripts

p4#: 22387
This commit is contained in:
Magne Sjaastad
2013-09-12 08:11:56 +02:00
parent f928ef87e8
commit c3adfb7cb0
14 changed files with 312 additions and 30 deletions

View File

@@ -350,6 +350,14 @@ bool RiaApplication::loadProject(const QString& projectFileName)
caseProgress.incrementProgress();
}
// Loop over command objects and execute them
for (size_t i = 0; i < m_project->commandObjects.size(); i++)
{
m_commandQueue.push_back(m_project->commandObjects[i]);
}
executeCommandObjects();
onProjectOpenedOrClosed();
return true;
@@ -495,6 +503,8 @@ bool RiaApplication::closeProject(bool askToSaveIfDirty)
caf::EffectGenerator::clearEffectCache();
m_project->close();
m_commandQueue.clear();
onProjectOpenedOrClosed();
return true;
@@ -959,6 +969,10 @@ void RiaApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatu
return;
}
executeCommandObjects();
// Exit code != 0 means we have an error
if (exitCode != 0)
{
@@ -1678,3 +1692,27 @@ QVariant RiaApplication::cacheDataObject(const QString& key) const
return QVariant();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::addCommandObject(RimCommandObject* commandObject)
{
m_commandQueue.push_back(commandObject);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::executeCommandObjects()
{
if (m_commandQueue.size() > 0)
{
std::list< RimCommandObject* >::iterator it = m_commandQueue.begin();
RimCommandObject* first = *it;
first->redo();
m_commandQueue.pop_front();
}
}