change to Test API

This commit is contained in:
luiscuenca 2018-08-24 11:59:46 -07:00
parent 5654acf5bf
commit ddbadf5a69
4 changed files with 28 additions and 12 deletions

View file

@ -311,6 +311,9 @@ public:
Q_INVOKABLE void copyToClipboard(const QString& text);
int getOtherAvatarsReplicaCount() { return DependencyManager::get<AvatarHashMap>()->getReplicaCount(); }
void setOtherAvatarsReplicaCount(int count) { DependencyManager::get<AvatarHashMap>()->setReplicaCount(count); }
#if defined(Q_OS_ANDROID)
void beforeEnterBackground();
void enterBackground();

View file

@ -190,4 +190,12 @@ void TestScriptingInterface::saveObject(QVariant variant, const QString& filenam
void TestScriptingInterface::showMaximized() {
qApp->getWindow()->showMaximized();
}
void TestScriptingInterface::setOtherAvatarsReplicaCount(int count) {
qApp->setOtherAvatarsReplicaCount(count);
}
int TestScriptingInterface::getOtherAvatarsReplicaCount() {
return qApp->getOtherAvatarsReplicaCount();
}

View file

@ -149,6 +149,20 @@ public slots:
*/
void showMaximized();
/**jsdoc
* Values higher than 0 will create replicas of other-avatars when entering a domain for testing purpouses
* @function Test.setOtherAvatarsReplicaCount
* @param {number} count - Number of replicas we want to create
*/
Q_INVOKABLE void setOtherAvatarsReplicaCount(int count);
/**jsdoc
* Return the number of replicas that are being created of other-avatars when entering a domain
* @function Test.getOtherAvatarsReplicaCount
* @returns {number} Current number of replicas of other-avatars.
*/
Q_INVOKABLE int getOtherAvatarsReplicaCount();
private:
bool waitForCondition(qint64 maxWaitMs, std::function<bool()> condition);
QString _testResultsLocation;

View file

@ -95,21 +95,12 @@ public:
// Null/Default-constructed QUuids will return MyAvatar
Q_INVOKABLE virtual ScriptAvatarData* getAvatar(QUuid avatarID) { return new ScriptAvatarData(getAvatarBySessionID(avatarID)); }
/**jsdoc
* @function AvatarList.setReplicaCount
* @param {number} count // The times an avatar will get replicated
*/
Q_INVOKABLE void setReplicaCount(int count);
/**jsdoc
* @function AvatarList.setReplicaCount
* @param {number} count // The times an avatar will get replicated
*/
Q_INVOKABLE int getReplicaCount() { return _replicas.getReplicaCount(); };
virtual AvatarSharedPointer getAvatarBySessionID(const QUuid& sessionID) const { return findAvatar(sessionID); }
int numberOfAvatarsInRange(const glm::vec3& position, float rangeMeters);
void setReplicaCount(int count);
int getReplicaCount() { return _replicas.getReplicaCount(); };
signals:
/**jsdoc