Atom Tools: Bind exit function for python tests

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
monroegm-disable-blank-issue-2
Guthrie Adams 4 years ago
parent 76ff7aec29
commit ced7d1ef54

@ -111,6 +111,7 @@ namespace AtomToolsFramework
virtual void ProcessCommandLine(const AZ::CommandLine& commandLine); virtual void ProcessCommandLine(const AZ::CommandLine& commandLine);
static void PyIdleWaitFrames(uint32_t frames); static void PyIdleWaitFrames(uint32_t frames);
static void PyExit();
AzToolsFramework::TraceLogger m_traceLogger; AzToolsFramework::TraceLogger m_traceLogger;

@ -130,10 +130,13 @@ namespace AtomToolsFramework
->Attribute(AZ::Script::Attributes::Category, "Editor") ->Attribute(AZ::Script::Attributes::Category, "Editor")
->Attribute(AZ::Script::Attributes::Module, "atomtools.general"); ->Attribute(AZ::Script::Attributes::Module, "atomtools.general");
}; };
// The reflection here is based on patterns in CryEditPythonHandler::Reflect
addGeneral(behaviorContext->Method( addGeneral(behaviorContext->Method(
"idle_wait_frames", &AtomToolsApplication::PyIdleWaitFrames, nullptr, "idle_wait_frames", &AtomToolsApplication::PyIdleWaitFrames, nullptr,
"Waits idling for a frames. Primarily used for auto-testing.")); "Waits idling for a frames. Primarily used for auto-testing."));
addGeneral(behaviorContext->Method(
"exit", &AtomToolsApplication::PyExit, nullptr,
"Exit application. Primarily used for auto-testing."));
} }
} }
@ -564,4 +567,9 @@ namespace AtomToolsFramework
Ticker ticker(&loop, frames); Ticker ticker(&loop, frames);
loop.exec(); loop.exec();
} }
void AtomToolsApplication::PyExit()
{
AzFramework::ApplicationRequests::Bus::Broadcast(&AzFramework::ApplicationRequests::ExitMainLoop);
}
} // namespace AtomToolsFramework } // namespace AtomToolsFramework

Loading…
Cancel
Save