summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
authorAndrew Christian <andrew.christian@nokia.com>2012-03-05 12:09:58 -0500
committerLasse Holmstedt <lasse.holmstedt@nokia.com>2012-03-05 18:22:53 +0100
commitea7d7e8cf0bc03c80c46051ce19d69bafa59504f (patch)
treed59022d8db77344b6b78e8b75eef26c22dbf05de /tests/auto/declarative
parent7c5c9b19c32255164b991d3840f92d88b86fbed5 (diff)
Update prelaunch to copy processinfo record.
* Added declarative test cases for Prelaunch factory * Copy ProcessInfo record into prelaunch factory to avoid memory management issues Change-Id: I3303286f34c7ee9c491a82726e4e4b50892625e4 Reviewed-by: Lasse Holmstedt <lasse.holmstedt@nokia.com>
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r--tests/auto/declarative/data/testprelaunch.qml42
-rw-r--r--tests/auto/declarative/tst_declarative.cpp9
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/auto/declarative/data/testprelaunch.qml b/tests/auto/declarative/data/testprelaunch.qml
new file mode 100644
index 0000000..a06cbbf
--- /dev/null
+++ b/tests/auto/declarative/data/testprelaunch.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+import Test 1.0
+
+DeclarativeProcessManager {
+ id: foo
+
+ factories: [
+ PrelaunchProcessBackendFactory {
+ id: foo3
+ processInfo: ProcessInfo {
+ program: "testDeclarative/testDeclarative"
+ }
+ }
+ ]
+
+ onProcessStarted: console.log("Process started "+name)
+ onProcessStateChanged: {
+ function stateToString(s) {
+ if (s == Process.NotRunning) return "Not running";
+ if (s == Process.Running) return "Running";
+ if (s == Process.Starting) return "Starting";
+ return "Unknown";
+ }
+ console.log("state changed for "+name+" to "+stateToString(state));
+ }
+
+ function makeProcess() {
+ var a = create({"program": "testDeclarative/testDeclarative","name": "test-client"});
+ return a.name;
+ }
+
+ function startProcess(name) {
+ var p = processForName(name);
+ console.log("Starting process '"+name+"' ="+p);
+ p.start();
+ }
+
+ function stopProcess(name) {
+ var p = processForName(name);
+ p.stop();
+ }
+}
diff --git a/tests/auto/declarative/tst_declarative.cpp b/tests/auto/declarative/tst_declarative.cpp
index f5b9167..68e5e6c 100644
--- a/tests/auto/declarative/tst_declarative.cpp
+++ b/tests/auto/declarative/tst_declarative.cpp
@@ -53,6 +53,7 @@
#include "declarativematchdelegate.h"
#include "declarativerewritedelegate.h"
#include "standardprocessbackendfactory.h"
+#include "prelaunchprocessbackendfactory.h"
#include "socketprocessbackendfactory.h"
#include "processfrontend.h"
#include "processbackend.h"
@@ -72,6 +73,7 @@ private slots:
void initTestCase();
void basic();
+ void prelaunch();
void matchDelegate();
void socketLauncher();
void socketRangeLauncher();
@@ -92,6 +94,8 @@ void tst_DeclarativeProcessManager::initTestCase()
qmlRegisterType<ProcessFrontend>();
qmlRegisterType<StandardProcessBackendFactory>(uri, 1, 0, "StandardProcessBackendFactory");
+ qmlRegisterType<PrelaunchProcessBackendFactory>(uri, 1, 0, "PrelaunchProcessBackendFactory");
+ qmlRegisterType<ProcessInfo>(uri, 1, 0, "ProcessInfo");
qmlRegisterType<SocketProcessBackendFactory>(uri, 1, 0, "SocketProcessBackendFactory");
qmlRegisterType<DeclarativeProcessManager>(uri, 1, 0, "DeclarativeProcessManager");
qmlRegisterType<DeclarativeMatchDelegate>(uri, 1, 0, "DeclarativeMatchDelegate");
@@ -246,6 +250,11 @@ void tst_DeclarativeProcessManager::basic()
_frontendTest("data/testfrontend.qml");
}
+void tst_DeclarativeProcessManager::prelaunch()
+{
+ _frontendTest("data/testprelaunch.qml");
+}
+
void tst_DeclarativeProcessManager::matchDelegate()
{
_frontendTest("data/testmatch.qml");