aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtScript
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-06-07 14:43:45 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-06-07 16:57:11 -0300
commitab918abc1e103e0ca86939f7d057e8a44ac8a4ef (patch)
tree53c6f57d089dcf5e145d766b1ceef704714046d8 /tests/QtScript
parent471486732b03cbb42b884158604a59d5a18e8a35 (diff)
Created new unittest model.
Separete unittest for module. Only run unittest for compiled modules. Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/QtScript')
-rw-r--r--tests/QtScript/CMakeLists.txt3
-rw-r--r--tests/QtScript/base_test.py4
-rw-r--r--tests/QtScript/engine_test.py13
-rw-r--r--tests/QtScript/test_base.py4
4 files changed, 24 insertions, 0 deletions
diff --git a/tests/QtScript/CMakeLists.txt b/tests/QtScript/CMakeLists.txt
new file mode 100644
index 000000000..b76a26299
--- /dev/null
+++ b/tests/QtScript/CMakeLists.txt
@@ -0,0 +1,3 @@
+PYSIDE_TEST(base_test.py)
+PYSIDE_TEST(engine_test.py)
+PYSIDE_TEST(test_base.py)
diff --git a/tests/QtScript/base_test.py b/tests/QtScript/base_test.py
new file mode 100644
index 000000000..6ad27e007
--- /dev/null
+++ b/tests/QtScript/base_test.py
@@ -0,0 +1,4 @@
+from PySide import QtScript
+
+
+#only test if the module import works fine bug #278
diff --git a/tests/QtScript/engine_test.py b/tests/QtScript/engine_test.py
new file mode 100644
index 000000000..074d3df40
--- /dev/null
+++ b/tests/QtScript/engine_test.py
@@ -0,0 +1,13 @@
+import unittest
+
+from PySide.QtCore import QObject
+from PySide.QtScript import QScriptEngine
+
+class QScriptEngineTest(unittest.TestCase):
+
+ def testQScriptEngine(self):
+ engine = QScriptEngine()
+ obj = engine.evaluate("({ unitName: 'Celsius', toKelvin: function(x) { return x + 273; } })")
+ toKelvin = obj.property("toKelvin")
+ result = toKelvin.call(obj, [100])
+ self.assertEqual(result.toNumber(), 373)
diff --git a/tests/QtScript/test_base.py b/tests/QtScript/test_base.py
new file mode 100644
index 000000000..6ad27e007
--- /dev/null
+++ b/tests/QtScript/test_base.py
@@ -0,0 +1,4 @@
+from PySide import QtScript
+
+
+#only test if the module import works fine bug #278