Fix qmltestrunner crash bug when report filename and line number
authorCharles Yin <charles.yin@nokia.com>
Wed, 9 Nov 2011 01:20:04 +0000 (11:20 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 9 Nov 2011 10:29:42 +0000 (11:29 +0100)
The HandleScpe is not needed here. Also for each test file, the rootObj
should reset its internal states properly, otherwise the following test
cases are polluted by the previous tests.

Task-number:QTBUG-22620
Change-Id: I1e4869070b8712e5a6c755461d52bd12d1f03160
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
src/imports/testlib/main.cpp
src/qmltest/quicktest.cpp

index b393c3d..c78a1c4 100644 (file)
@@ -103,29 +103,9 @@ public Q_SLOTS:
     bool compare(const QVariant& act, const QVariant& exp) const {
         return act == exp;
     }
-//    QDeclarativeV8Handle toString(const QVariant& v) const
-//    {
-//        QString name(v.typeName());
-
-//        if (v.canConvert<QObject*>()) {
-//            QDeclarativeType *type = 0;
-//            const QMetaObject *mo = v.value<QObject*>()->metaObject();
-//            while (!type && mo) {
-//                type = QDeclarativeMetaType::qmlType(mo);
-//                mo = mo->superClass();
-//            }
-//            if (type) {
-//                name = type->qmlTypeName();
-//            }
-//        }
-
-//        return QDeclarativeV8Handle::fromHandle(v8::String::New(name.toUtf8()));
-//    }
 
     QDeclarativeV8Handle callerFile(int frameIndex = 0) const
     {
-        v8::HandleScope scope;
-
         v8::Local<v8::StackTrace> stacks = v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed);
         int count = stacks->GetFrameCount();
         if (count >= frameIndex + 2) {
@@ -136,7 +116,6 @@ public Q_SLOTS:
     }
     int callerLine(int frameIndex = 0) const
     {
-        v8::HandleScope scope;
         v8::Local<v8::StackTrace> stacks = v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed);
         int count = stacks->GetFrameCount();
         if (count >= frameIndex + 2) {
index 989632c..976b4d6 100644 (file)
@@ -213,7 +213,8 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport
                 continue;
 
             rootobj.setHasTestCase(false);
-
+            rootobj.setWindowShown(false);
+            rootobj.hasQuit = false;
             QString path = fi.absoluteFilePath();
             if (path.startsWith(QLatin1String(":/")))
                 view.setSource(QUrl(QLatin1String("qrc:") + path.mid(2)));