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
9// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html9// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10//10//
11 11
12#include <ScriptEngines.h>12#include "ScriptEngines.h"
13 13
14#include "ui/TestingDialog.h"14#include "ui/TestingDialog.h"
15#include "Application.h"15#include "Application.h"
@@ -17,19 +17,23 @@ · 1 unmodified line
17TestingDialog::TestingDialog(QWidget* parent) :17TestingDialog::TestingDialog(QWidget* parent) :
18 QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint)18 QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint)
19{19{
20 DependencyManager::get<ScriptEngines>()->loadOneScript(qApp->applicationDirPath() + testRunnerRelativePath);20 setAttribute(Qt::WA_DeleteOnClose);
21 this->setWindowTitle(windowLabel);21 setWindowTitle(windowLabel);
22}
23 22
24TestingDialog::~TestingDialog() {23 _console = new JSConsole(this);
25 // TODO: Clean up here?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);
26}30}
27 31
28void TestingDialog::reject() {32TestingDialog::~TestingDialog() {
29 this->QDialog::close();33 delete _console;
30}34}
31 35
32void TestingDialog::closeEvent(QCloseEvent* event) {36void TestingDialog::onTestingFinished(const QString& scriptPath) {
33 this->QDialog::closeEvent(event);37 _engine = NULL;
34 emit closed();38 _console->setScriptEngine(NULL);
35}39}