Add automated test tool scripting interface

This commit is contained in:
Clement 2018-07-25 16:32:25 -07:00
parent f8e98d2c6a
commit 949c7f8c19
4 changed files with 65 additions and 1 deletions

View file

@ -365,7 +365,6 @@ void Agent::executeScript() {
// give scripts access to the Users object
_scriptEngine->registerGlobalObject("Users", DependencyManager::get<UsersScriptingInterface>().data());
auto player = DependencyManager::get<recording::Deck>();
connect(player.data(), &recording::Deck::playbackStateChanged, [=] {
if (player->isPlaying()) {

View file

@ -74,6 +74,7 @@
#include "WebSocketClass.h"
#include "RecordingScriptingInterface.h"
#include "ScriptEngines.h"
#include "StackTestScriptingInterface.h"
#include "ModelScriptingInterface.h"
@ -748,6 +749,10 @@ void ScriptEngine::init() {
qScriptRegisterMetaType(this, meshesToScriptValue, meshesFromScriptValue);
registerGlobalObject("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
#if DEV_BUILD || PR_BUILD
registerGlobalObject("StackTest", new StackTestScriptingInterface());
#endif
}
void ScriptEngine::registerValue(const QString& valueName, QScriptValue value) {

View file

@ -0,0 +1,31 @@
//
// StackTestScriptingInterface.cpp
// libraries/script-engine/src
//
// Created by Clement Brisset on 7/25/18.
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "StackTestScriptingInterface.h"
#include <QLoggingCategory>
#include <QCoreApplication>
Q_DECLARE_LOGGING_CATEGORY(stackTest)
Q_LOGGING_CATEGORY(stackTest, "hifi.tools.stack-test")
void StackTestScriptingInterface::pass(QString message) {
qCInfo(stackTest) << "PASS" << qPrintable(message);
}
void StackTestScriptingInterface::fail(QString message) {
qCInfo(stackTest) << "FAIL" << qPrintable(message);
}
void StackTestScriptingInterface::exit(QString message) {
qCInfo(stackTest) << "COMPLETE" << qPrintable(message);
qApp->exit();
}

View file

@ -0,0 +1,29 @@
//
// StackTestScriptingInterface.h
// libraries/script-engine/src
//
// Created by Clement Brisset on 7/25/18.
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#pragma once
#ifndef hifi_StackTestScriptingInterface_h
#define hifi_StackTestScriptingInterface_h
#include <QObject>
class StackTestScriptingInterface : public QObject {
Q_OBJECT
public:
Q_INVOKABLE void pass(QString message = QString());
Q_INVOKABLE void fail(QString message = QString());
Q_INVOKABLE void exit(QString message = QString());
};
#endif // hifi_StackTestScriptingInterface_h