summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptengine
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-07-24 09:45:33 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-07-27 13:04:30 (GMT)
commit3643028959f0b38350e57e60ba4000435b75e592 (patch)
treec129e4dee11487abd437ab8ebd993ba261e06fa6 /tests/auto/qscriptengine
parentcf66c667a97c0079141eb3f2d9e997b7378ae792 (diff)
parentc36139c665e61866aff4bf8572890a735167a7d0 (diff)
downloadQt-3643028959f0b38350e57e60ba4000435b75e592.zip
Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.gz
Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.bz2
Merge commit 'qt/master-stable'
Conflicts: configure.exe qmake/Makefile.unix qmake/generators/makefile.cpp src/corelib/global/qglobal.h src/corelib/kernel/kernel.pri src/corelib/kernel/qcoreevent.cpp src/corelib/kernel/qsharedmemory_unix.cpp src/gui/graphicsview/qgraphicsscene.cpp src/gui/kernel/qaction.cpp src/gui/kernel/qaction.h src/gui/kernel/qaction_p.h src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication.h src/gui/kernel/qwidget.cpp src/gui/kernel/qwidget.h src/gui/kernel/qwidget_mac.mm src/gui/painting/qgraphicssystemfactory.cpp src/gui/styles/qwindowsstyle.cpp src/gui/text/qfontengine_qpf.cpp src/gui/widgets/qabstractscrollarea_p.h src/network/access/qnetworkaccessdebugpipebackend.cpp src/network/socket/qlocalsocket_unix.cpp src/network/socket/qnativesocketengine_p.h src/network/socket/qnativesocketengine_unix.cpp src/openvg/qpaintengine_vg.cpp tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp tests/auto/qcssparser/qcssparser.pro tests/auto/qdir/tst_qdir.cpp tests/auto/qfile/tst_qfile.cpp tests/auto/qobject/tst_qobject.cpp tests/auto/qpathclipper/qpathclipper.pro tests/auto/qprocess/tst_qprocess.cpp tests/auto/qsettings/tst_qsettings.cpp tests/auto/qsharedpointer/qsharedpointer.pro tests/auto/qsqlquerymodel/qsqlquerymodel.pro tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro tests/auto/qsqltablemodel/qsqltablemodel.pro tests/auto/qsqlthread/qsqlthread.pro tests/auto/qwidget/tst_qwidget.cpp
Diffstat (limited to 'tests/auto/qscriptengine')
-rw-r--r--tests/auto/qscriptengine/script/com/__init__.js4
-rw-r--r--tests/auto/qscriptengine/script/com/trolltech/__init__.js4
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp7
3 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qscriptengine/script/com/__init__.js b/tests/auto/qscriptengine/script/com/__init__.js
index 381816a..7db3ee4 100644
--- a/tests/auto/qscriptengine/script/com/__init__.js
+++ b/tests/auto/qscriptengine/script/com/__init__.js
@@ -3,3 +3,7 @@ __setupPackage__("com");
com.wasDefinedAlready = wasDefinedAlready;
com.name = __extension__;
com.level = 1;
+
+com.postInitCallCount = 0;
+com.originalPostInit = __postInit__;
+__postInit__ = function() { ++com.postInitCallCount; };
diff --git a/tests/auto/qscriptengine/script/com/trolltech/__init__.js b/tests/auto/qscriptengine/script/com/trolltech/__init__.js
index f12b17d..a55b132 100644
--- a/tests/auto/qscriptengine/script/com/trolltech/__init__.js
+++ b/tests/auto/qscriptengine/script/com/trolltech/__init__.js
@@ -3,3 +3,7 @@ __setupPackage__("com.trolltech");
com.trolltech.wasDefinedAlready = wasDefinedAlready;
com.trolltech.name = __extension__;
com.trolltech.level = com.level + 1;
+
+com.trolltech.postInitCallCount = 0;
+com.trolltech.originalPostInit = __postInit__;
+__postInit__ = function() { ++com.trolltech.postInitCallCount; };
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 3b17c3c..e9d9747 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -1583,6 +1583,7 @@ void tst_QScriptEngine::importExtension()
QScriptValue ret = eng.importExtension("this.extension.does.not.exist");
QCOMPARE(eng.hasUncaughtException(), true);
QCOMPARE(ret.isError(), true);
+ QCOMPARE(ret.toString(), QString::fromLatin1("Error: Unable to import this.extension.does.not.exist: no such extension"));
}
{
@@ -1601,6 +1602,8 @@ void tst_QScriptEngine::importExtension()
.strictlyEquals(QScriptValue(&eng, "com")), true);
QCOMPARE(com.property("level")
.strictlyEquals(QScriptValue(&eng, 1)), true);
+ QVERIFY(com.property("originalPostInit").isUndefined());
+ QVERIFY(com.property("postInitCallCount").strictlyEquals(1));
QScriptValue trolltech = com.property("trolltech");
QCOMPARE(trolltech.isObject(), true);
@@ -1610,6 +1613,8 @@ void tst_QScriptEngine::importExtension()
.strictlyEquals(QScriptValue(&eng, "com.trolltech")), true);
QCOMPARE(trolltech.property("level")
.strictlyEquals(QScriptValue(&eng, 2)), true);
+ QVERIFY(trolltech.property("originalPostInit").isUndefined());
+ QVERIFY(trolltech.property("postInitCallCount").strictlyEquals(1));
}
QStringList imp = eng.importedExtensions();
QCOMPARE(imp.size(), 2);
@@ -1625,6 +1630,8 @@ void tst_QScriptEngine::importExtension()
eng.globalObject().setProperty("__import__", eng.newFunction(__import__));
QScriptValue ret = eng.importExtension("com.trolltech.recursive");
QCOMPARE(eng.hasUncaughtException(), true);
+ QVERIFY(ret.isError());
+ QCOMPARE(ret.toString(), QString::fromLatin1("Error: recursive import of com.trolltech.recursive"));
QStringList imp = eng.importedExtensions();
QCOMPARE(imp.size(), 2);
QCOMPARE(imp.at(0), QString::fromLatin1("com"));