diff options
author | Charles Yin <charles.yin@nokia.com> | 2011-07-20 11:28:26 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-20 05:36:02 +0200 |
commit | 29cf717366623bceb4d4e3009600cfa538529c10 (patch) | |
tree | 0a82d6887057a21c4ac1bde69e9fb3e46f5d53d3 /src/imports/testlib/main.cpp | |
parent | a1867e5c6229e171b0fac3e57b96295221f2ea0a (diff) |
fix qmltest bugs
Change-Id: If814516b1094b85fba46e215b44e1a2b582179c5
Reviewed-on: http://codereview.qt.nokia.com/1858
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Charles Yin <charles.yin@nokia.com>
Diffstat (limited to 'src/imports/testlib/main.cpp')
-rw-r--r-- | src/imports/testlib/main.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp index 0f27102764..5781b3ddf1 100644 --- a/src/imports/testlib/main.cpp +++ b/src/imports/testlib/main.cpp @@ -79,6 +79,48 @@ public: } public Q_SLOTS: + + QDeclarativeV8Handle typeName(const QVariant& v) const + { + QString name(v.typeName()); + //qDebug() << "type:" << name << " string value:" << v.toString() << " value:" << v; + 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())); + } + + 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; |