History

add client-side test runner

Ryan Jones committed 9 years ago

Commit 39e1a3f1 parent 3eecba77 files · +145 −45Browse files

Showing the changes to interface/src/ui/TestingDialog.cpp (1 of 7 files). Show all

Unified · Split

interface/src/ui/TestingDialog.cpp+15−11
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
1010 //
1111
12−#include <ScriptEngines.h>
12+#include "ScriptEngines.h"
1313
1414 #include "ui/TestingDialog.h"
1515 #include "Application.h"
@@ -17,19 +17,23 @@ · 1 unmodified line
1717 TestingDialog::TestingDialog(QWidget* parent) :
1818 QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint)
1919 {
20− DependencyManager::get<ScriptEngines>()->loadOneScript(qApp->applicationDirPath() + testRunnerRelativePath);
21− this->setWindowTitle(windowLabel);
22−}
20+ setAttribute(Qt::WA_DeleteOnClose);
21+ setWindowTitle(windowLabel);
2322
24−TestingDialog::~TestingDialog() {
25− // TODO: Clean up here?
23+ _console = new JSConsole(this);
24+ _console->setFixedHeight(TESTING_CONSOLE_HEIGHT);
25+
26+ auto _engines = DependencyManager::get<ScriptEngines>();
27+ _engine = _engines->loadScript(qApp->applicationDirPath() + testRunnerRelativePath);
28+ _console->setScriptEngine(_engine);
29+ connect(_engine, &ScriptEngine::finished, this, &TestingDialog::onTestingFinished);
2630 }
2731
28−void TestingDialog::reject() {
29− this->QDialog::close();
32+TestingDialog::~TestingDialog() {
33+ delete _console;
3034 }
3135
32−void TestingDialog::closeEvent(QCloseEvent* event) {
33− this->QDialog::closeEvent(event);
34− emit closed();
36+void TestingDialog::onTestingFinished(const QString& scriptPath) {
37+ _engine = NULL;
38+ _console->setScriptEngine(NULL);
3539 }