summaryrefslogtreecommitdiffstats
path: root/sigcore
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-12-25 11:27:22 -0500
committerBen Boeckel <MathStuf@gmail.com>2008-12-25 11:27:22 -0500
commit63fdacbc25fbec6c44a9cd099273c74406b99de0 (patch)
treec7e75a10b20067f811e234d69505b294b9fad36d /sigcore
parent1a95f514ee0ca435cb0c7ebaff22748cd3eba276 (diff)
downloadsigen-63fdacbc25fbec6c44a9cd099273c74406b99de0.tar.gz
sigen-63fdacbc25fbec6c44a9cd099273c74406b99de0.tar.xz
sigen-63fdacbc25fbec6c44a9cd099273c74406b99de0.zip
Added qtscript as a language for Kross in Script
Diffstat (limited to 'sigcore')
-rw-r--r--sigcore/Script.h1
-rw-r--r--sigcore/test/TestScript.cpp25
-rw-r--r--sigcore/test/TestScript.h1
3 files changed, 27 insertions, 0 deletions
diff --git a/sigcore/Script.h b/sigcore/Script.h
index a3f3e63e..b5e2f6a5 100644
--- a/sigcore/Script.h
+++ b/sigcore/Script.h
@@ -52,6 +52,7 @@ class SIGCORE_EXPORT Script
* - \b mono -- C# <http://www.mono-project.com/Main_Page>
* - \b falcon -- Falcon <http://www.falconpl.org/>
* - \b kjs -- KDE JavaScript <http://api.kde.org/4.x-api/kdelibs-apidocs/kjs/html/index.html>
+ * - \b qtscript -- QtScript <http://doc.trolltech.com/latest/qtscript.html>
* - \b java -- Java <http://www.java.com/en/>
* - \b lua -- Lua <http://www.lua.org/>
* - \b php -- PHP <http://www.php.net/>
diff --git a/sigcore/test/TestScript.cpp b/sigcore/test/TestScript.cpp
index 251adbf9..8498c499 100644
--- a/sigcore/test/TestScript.cpp
+++ b/sigcore/test/TestScript.cpp
@@ -182,6 +182,31 @@ connect(object, \"signal2()\", object, \"slot2()\")\n\
QCOMPARE(m_value, QString("set"));
}
+void TestScript::qtscript()
+{
+ Sigcore::Script script("qtscript", "object.value = \"set\"\n\
+function slot()\n\
+{\n\
+ object.slot1()\n\
+}\n\
+connect(object, \"signal1()\", this, slot)\n\
+connect(object, \"signal2()\", object, \"slot2()\")\n\
+");
+
+ m_action = new Kross::Action(this, "test-script");
+ m_action->setInterpreter(script.interpreter());
+ m_action->setCode(script.script().toUtf8());
+ m_action->addObject(this, "object");
+ m_action->trigger();
+
+ emit(signal1());
+ emit(signal2());
+
+ QCOMPARE(m_foo, true);
+ QCOMPARE(m_bar, true);
+ QCOMPARE(m_value, QString("set"));
+}
+
void java()
{
Sigcore::Script script("python", "import object\n\
diff --git a/sigcore/test/TestScript.h b/sigcore/test/TestScript.h
index 9a2d3e10..dd4c5a48 100644
--- a/sigcore/test/TestScript.h
+++ b/sigcore/test/TestScript.h
@@ -58,6 +58,7 @@ class TestScript : public QObject
void python();
// void falcon();
// void kjs();
+// void qtscript();
// void java();
// void lua();
// void ruby();