From 5897326b86d30a347a004d54bd1fd86097caf9aa Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 10 Aug 2009 13:38:07 +0200 Subject: implement QScriptContextInfo streaming from datastream --- src/script/api/qscriptcontextinfo.cpp | 31 +++++++++++++++++++++- .../qscriptcontextinfo/tst_qscriptcontextinfo.cpp | 5 ++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp index 2e2d346..98d0d52 100644 --- a/src/script/api/qscriptcontextinfo.cpp +++ b/src/script/api/qscriptcontextinfo.cpp @@ -518,7 +518,36 @@ Q_SCRIPT_EXPORT QDataStream &operator>>(QDataStream &in, QScriptContextInfo &inf info.d_ptr->ref.ref(); } - Q_ASSERT_X(false, Q_FUNC_INFO, "not implemented"); + in >> info.d_ptr->scriptId; + + qint32 line; + in >> line; + info.d_ptr->lineNumber = line; + + qint32 column; + in >> column; + info.d_ptr->columnNumber = column; + + quint32 ftype; + in >> ftype; + info.d_ptr->functionType = QScriptContextInfo::FunctionType(ftype); + + qint32 startLine; + in >> startLine; + info.d_ptr->functionStartLineNumber = startLine; + + qint32 endLine; + in >> endLine; + info.d_ptr->functionEndLineNumber = endLine; + + qint32 metaIndex; + in >> metaIndex; + info.d_ptr->functionMetaIndex = metaIndex; + + in >> info.d_ptr->fileName; + in >> info.d_ptr->functionName; + in >> info.d_ptr->parameterNames; + return in; } #endif diff --git a/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp b/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp index 1adef98..0877717 100644 --- a/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp +++ b/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp @@ -203,7 +203,7 @@ void tst_QScriptContextInfo::scriptFunction() // evaluate() QScriptContextInfo info = lst.at(2); QCOMPARE(info.functionType(), QScriptContextInfo::NativeFunction); - QEXPECT_FAIL("", "doesn't works", Abort); + QEXPECT_FAIL("", "Script ID is invalid for evaluate() call", Abort); QVERIFY(info.scriptId() != -1); QCOMPARE(info.fileName(), fileName); QCOMPARE(info.lineNumber(), lineNumber + 3); @@ -516,8 +516,6 @@ void tst_QScriptContextInfo::nullContext() void tst_QScriptContextInfo::streaming() { - QEXPECT_FAIL("", "Crashes", Abort); - QVERIFY(false); { QScriptContextInfo info((QScriptContext*)0); QByteArray ba; @@ -547,6 +545,7 @@ void tst_QScriptContextInfo::streaming() QScriptValue ret = eng.evaluate("function bar(a, b, c) {\n return getContextInfoList();\n}\nbar()", fileName, lineNumber); QList lst = qscriptvalue_cast >(ret); + QEXPECT_FAIL("", "getContextInfoList() returns one item too many", Continue); QCOMPARE(lst.size(), 3); for (int i = 0; i < lst.size(); ++i) { const QScriptContextInfo &info = lst.at(i); -- cgit v0.12