diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-11-08 23:31:18 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-11-08 23:31:18 (GMT) |
commit | b61a413e592e2d47ff158e2451ae54cd0cc35230 (patch) | |
tree | 8de0cf252b27c8a3097b5b0d9cb422e6936a4916 | |
parent | b615f8667dfc9a36a9bef2bc2e2e509a9a2e478a (diff) | |
parent | 3ceeb87db6b6f7beeffe9df0417bd076fa72eece (diff) | |
download | Qt-b61a413e592e2d47ff158e2451ae54cd0cc35230.zip Qt-b61a413e592e2d47ff158e2451ae54cd0cc35230.tar.gz Qt-b61a413e592e2d47ff158e2451ae54cd0cc35230.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r-- | src/declarative/qml/qmlcontext_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmldom.cpp | 7 | ||||
-rw-r--r-- | src/declarative/qml/qmlparser.cpp | 94 | ||||
-rw-r--r-- | src/declarative/qml/qmlparser_p.h | 6 | ||||
-rw-r--r-- | src/gui/styles/qwindowsxpstyle.cpp | 4 | ||||
-rw-r--r-- | tests/auto/declarative/declarative.pro | 1 | ||||
-rw-r--r-- | tests/auto/declarative/parserstress/parserstress.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/parserstress/tst_parserstress.cpp | 141 | ||||
-rw-r--r-- | tests/auto/declarative/visual/tst_visual.cpp | 19 | ||||
-rw-r--r-- | tools/qdoc3/cppcodemarker.cpp | 2 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 5 |
11 files changed, 171 insertions, 117 deletions
diff --git a/src/declarative/qml/qmlcontext_p.h b/src/declarative/qml/qmlcontext_p.h index 7f9be0f..22d981f 100644 --- a/src/declarative/qml/qmlcontext_p.h +++ b/src/declarative/qml/qmlcontext_p.h @@ -74,7 +74,7 @@ class QmlExpressionPrivate; class QmlAbstractExpression; class QmlBinding_Id; -class QmlContextPrivate : public QObjectPrivate +class Q_DECLARATIVE_EXPORT QmlContextPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QmlContext) public: diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index b6e794b..39d6730 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -52,8 +52,6 @@ QT_BEGIN_NAMESPACE -DEFINE_BOOL_CONFIG_OPTION(compilerDump, QML_COMPILER_DUMP) - QmlDomDocumentPrivate::QmlDomDocumentPrivate() : root(0) { @@ -191,11 +189,6 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data, const QUrl } if (td->data.tree()) { - if (compilerDump()) { - qWarning() << "-AST------------------------------------------------------------------------------"; - td->data.tree()->dump(); - qWarning() << "----------------------------------------------------------------------------------"; - } d->root = td->data.tree(); d->root->addref(); } diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp index 7fd57f3..ee69b14 100644 --- a/src/declarative/qml/qmlparser.cpp +++ b/src/declarative/qml/qmlparser.cpp @@ -200,28 +200,6 @@ QmlParser::Object::DynamicSlot::DynamicSlot(const DynamicSlot &o) { } -void QmlParser::Object::dump(int indent) const -{ - QByteArray ba(indent * 4, ' '); - if (type != -1) { - qWarning() << ba.constData() << "Object:" << typeName; - } else { - qWarning() << ba.constData() << "Object: fetched"; - } - - for (QHash<QByteArray, Property *>::ConstIterator iter = properties.begin(); - iter != properties.end(); - ++iter) { - qWarning() << ba.constData() << " Property" << iter.key(); - (*iter)->dump(indent + 1); - } - - if (defaultProperty) { - qWarning() << ba.constData() << " Default property"; - defaultProperty->dump(indent + 1); - } -} - QmlParser::Property::Property() : parent(0), type(0), index(-1), value(0), isDefault(true), isDeferred(false) { @@ -256,15 +234,6 @@ bool QmlParser::Property::isEmpty() const return !value && values.isEmpty(); } -void QmlParser::Property::dump(int indent) const -{ - QByteArray ba(indent * 4, ' '); - for (int ii = 0; ii < values.count(); ++ii) - values.at(ii)->dump(indent); - if (value) - value->dump(indent); -} - QmlParser::Value::Value() : type(Unknown), object(0) { @@ -275,69 +244,6 @@ QmlParser::Value::~Value() if (object) object->release(); } -void QmlParser::Value::dump(int indent) const -{ - QByteArray type; - switch(this->type) { - default: - case Value::Unknown: - type = "Unknown"; - break; - case Value::Literal: - type = "Literal"; - break; - case Value::PropertyBinding: - type = "PropertyBinding"; - break; - case Value::ValueSource: - type = "ValueSource"; - break; - case Value::ValueInterceptor: - type = "ValueInterceptor"; - break; - case Value::CreatedObject: - type = "CreatedObject"; - break; - case Value::SignalObject: - type = "SignalObject"; - break; - case Value::SignalExpression: - type = "SignalExpression"; - break; - case Value::Id: - type = "Id"; - break; - } - - QByteArray primType; - switch(this->value.type()) { - default: - case Variant::Invalid: - primType = "Invalid"; - break; - case Variant::Boolean: - primType = "Boolean"; - break; - case Variant::Number: - primType = "Number"; - break; - case Variant::String: - primType = "String"; - break; - case Variant::Script: - primType = "Script"; - break; - } - - QByteArray ba(indent * 4, ' '); - if (object) { - qWarning() << ba.constData() << "Value (" << type << "):"; - object->dump(indent + 1); - } else { - qWarning() << ba.constData() << "Value (" << type << "):" << primType.constData() << primitive(); - } -} - QmlParser::Variant::Variant() : t(Invalid) {} diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h index 5bffff2..4f080e5 100644 --- a/src/declarative/qml/qmlparser_p.h +++ b/src/declarative/qml/qmlparser_p.h @@ -216,8 +216,6 @@ namespace QmlParser QList<DynamicSignal> dynamicSignals; // The list of dynamic slots QList<DynamicSlot> dynamicSlots; - - void dump(int = 0) const; }; class Variant @@ -299,8 +297,6 @@ namespace QmlParser Object *object; LocationSpan location; - - void dump(int = 0) const; }; class Property : public QmlRefCount @@ -342,8 +338,6 @@ namespace QmlParser LocationSpan location; LocationRange listValueRange; QList<int> listCommaPositions; - - void dump(int = 0) const; }; } diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 9fd9ce9..fe7f5d7 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -2926,10 +2926,10 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo } // Draw arrow p->save(); - p->setPen(option->palette.dark()); + p->setPen(option->palette.dark().color()); p->drawLine(menuarea.left(), menuarea.top() + 3, menuarea.left(), menuarea.bottom() - 3); - p->setPen(option->palette.light()); + p->setPen(option->palette.light().color()); p->drawLine(menuarea.left() - 1, menuarea.top() + 3, menuarea.left() - 1, menuarea.bottom() - 3); diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 64672f6..000ceb3 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -10,6 +10,7 @@ SUBDIRS += \ qmlgraphicslistview \ # Cover qmlgraphicsgridview \ # Cover numberformatter \ # Cover + parserstress \ # Cover pathview \ # Cover qfxloader \ # Cover qfxtextedit \ # Cover diff --git a/tests/auto/declarative/parserstress/parserstress.pro b/tests/auto/declarative/parserstress/parserstress.pro new file mode 100644 index 0000000..48f147a --- /dev/null +++ b/tests/auto/declarative/parserstress/parserstress.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_parserstress.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp new file mode 100644 index 0000000..dd8f347 --- /dev/null +++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qtest.h> +#include <QmlEngine> +#include <QmlComponent> +#include <QDebug> +#include <QDir> +#include <QFile> + +class tst_parserstress : public QObject +{ + Q_OBJECT +public: + tst_parserstress() {} + +private slots: + void ecmascript_data(); + void ecmascript(); + +private: + static QStringList findJSFiles(const QDir &); + QmlEngine engine; +}; + +QStringList tst_parserstress::findJSFiles(const QDir &d) +{ + QStringList rv; + + QStringList files = d.entryList(QStringList() << QLatin1String("*.js"), + QDir::Files); + foreach (const QString &file, files) { + if (file == "browser.js") + continue; + rv << d.absoluteFilePath(file); + } + + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | + QDir::NoSymLinks); + foreach (const QString &dir, dirs) { + QDir sub = d; + sub.cd(dir); + rv << findJSFiles(sub); + } + + return rv; +} + +void tst_parserstress::ecmascript_data() +{ + QDir dir(SRCDIR); + dir.cdUp(); + dir.cdUp(); + dir.cd("qscriptjstestsuite"); + dir.cd("tests"); + + QStringList files = findJSFiles(dir); + + QTest::addColumn<QString>("file"); + foreach (const QString &file, files) { + QTest::newRow(qPrintable(file)) << file; + } +} + +void tst_parserstress::ecmascript() +{ + QFETCH(QString, file); + + QFile f(file); + QVERIFY(f.open(QIODevice::ReadOnly)); + + QByteArray data = f.readAll(); + + QVERIFY(!data.isEmpty()); + + QString dataStr = QString::fromUtf8(data); + + QString qml = "import Qt 4.6\n"; + qml+= "\n"; + qml+= "Object {\n"; + qml+= " property int test\n"; + qml+= " test: {\n"; + qml+= dataStr + "\n"; + qml+= " return 1;\n"; + qml+= " }\n"; + qml+= " Script {\n"; + qml+= " function stress() {\n"; + qml+= dataStr; + qml+= " }\n"; + qml+= " }\n"; + qml+= "}\n"; + + QByteArray qmlData = qml.toUtf8(); + + QmlComponent component(&engine, qmlData, + QUrl::fromLocalFile(SRCDIR + QString("/dummy.qml"))); + QVERIFY(!component.isError()); +} + + +QTEST_MAIN(tst_parserstress) + +#include "tst_parserstress.moc" diff --git a/tests/auto/declarative/visual/tst_visual.cpp b/tests/auto/declarative/visual/tst_visual.cpp index e40dec7..5a5318a 100644 --- a/tests/auto/declarative/visual/tst_visual.cpp +++ b/tests/auto/declarative/visual/tst_visual.cpp @@ -59,13 +59,13 @@ public: static QString toTestScript(const QString &, Mode=Test); static QString viewer(); + static QStringList findQmlFiles(const QDir &d); private slots: void visual_data(); void visual(); private: QString qmlviewer; - QStringList findQmlFiles(const QDir &d); }; @@ -257,6 +257,7 @@ void usage() { fprintf(stderr, "\n"); fprintf(stderr, "QML related options\n"); + fprintf(stderr, " -listtests : list all the tests seen by tst_visual, and then exit immediately\n"); fprintf(stderr, " -record file : record new test data for file\n"); fprintf(stderr, " -recordnovisuals file : record new test data for file, but ignore visuals\n"); fprintf(stderr, " -play file : playback test data for file, printing errors\n"); @@ -267,12 +268,12 @@ void usage() "Visual tests are recordings of manual interactions with a QML test,\n" "that can then be run automatically. To record a new test, run:\n" "\n" - " tst_visuals -record yourtestdir/yourtest # Note, no .qml extension\n" + " tst_visual -record yourtestdir/yourtest.qml\n" "\n" "This records everything you do (try to keep it short).\n" "To play back a test, run:\n" "\n" - " tst_visuals -play yourtestdir/yourtest\n" + " tst_visual -play yourtestdir/yourtest.qml\n" "\n" "Your test may include QML code to test itself, reporting any error to an\n" "'error' property on the root object - the test will fail if this property\n" @@ -281,7 +282,7 @@ void usage() "If your test changes slightly but is still correct (check with -play), you\n" "can update the visuals by running:\n" "\n" - " tst_visuals -updatevisuals yourtestdir/yourtest\n" + " tst_visual -updatevisuals yourtestdir/yourtest.qml\n" "\n" "If your test includes platform-sensitive visuals (eg. text in system fonts),\n" "you should create platform-specific visuals, using -updateplatformvisuals\n" @@ -332,10 +333,18 @@ int main(int argc, char **argv) newArgv[newArgc++] = argv[ii]; } - if (arg == "-help" || arg == "-?") { + if (arg == "-help" || arg == "-?" || arg == "--help") { atexit(usage); showHelp = true; } + + if (arg == "-listtests") { + QStringList list = tst_visual::findQmlFiles(QDir(QT_TEST_SOURCE_DIR)); + foreach (QString test, list) { + qWarning() << qPrintable(test); + } + return 0; + } } if (mode == Test || showHelp) { diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index f3188bd..a8f6a02 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -194,6 +194,8 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, synopsis = "class " + name; break; case Node::Function: + case Node::QmlSignal: + case Node::QmlMethod: func = (const FunctionNode *) node; if (style != SeparateList && !func->returnType().isEmpty()) synopsis = typified(func->returnType()) + " "; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index ae47fc0..f0ddade 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4224,7 +4224,8 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << "<table class=\"qmlname\">"; out() << "<tr><td>"; out() << "<a name=\"" + refForNode(qsn) + "\"></a>"; - generateQmlItem(qsn,relative,marker,false); + generateSynopsis(qsn,relative,marker,CodeMarker::Detailed,false); + //generateQmlItem(qsn,relative,marker,false); out() << "</td></tr>"; out() << "</table>"; out() << "</div>"; @@ -4235,7 +4236,7 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << "<table class=\"qmlname\">"; out() << "<tr><td>"; out() << "<a name=\"" + refForNode(qmn) + "\"></a>"; - generateQmlItem(qmn,relative,marker,false); + generateSynopsis(qmn,relative,marker,CodeMarker::Detailed,false); out() << "</td></tr>"; out() << "</table>"; out() << "</div>"; |