diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-12-25 11:27:22 -0500 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-12-25 11:27:22 -0500 |
| commit | 63fdacbc25fbec6c44a9cd099273c74406b99de0 (patch) | |
| tree | c7e75a10b20067f811e234d69505b294b9fad36d | |
| parent | 1a95f514ee0ca435cb0c7ebaff22748cd3eba276 (diff) | |
Added qtscript as a language for Kross in Script
| -rw-r--r-- | sigcore/Script.h | 1 | ||||
| -rw-r--r-- | sigcore/test/TestScript.cpp | 25 | ||||
| -rw-r--r-- | sigcore/test/TestScript.h | 1 | ||||
| -rw-r--r-- | sigmodr/ScriptWidget.cpp | 1 |
4 files changed, 28 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(); diff --git a/sigmodr/ScriptWidget.cpp b/sigmodr/ScriptWidget.cpp index 0150008c..bab74833 100644 --- a/sigmodr/ScriptWidget.cpp +++ b/sigmodr/ScriptWidget.cpp @@ -45,6 +45,7 @@ Sigmodr::ScriptWidget::ScriptWidget(QWidget* parent, const Sigcore::Script& valu languages["Falcon"] = "falcon"; languages["Java"] = "java"; languages["JavaScript"] = "kjs"; + languages["QtScript"] = "qtscript"; languages["Lua"] = "lua"; languages["PHP"] = "php"; languages["Python"] = "python"; |
