From 1042834e11befa48e615775e853ac0f4d4bef5af Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 08:32:42 +1000 Subject: ignore chart exe --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d0e9c5f..1b29fca 100644 --- a/.gitignore +++ b/.gitignore @@ -107,6 +107,7 @@ tests/auto/qprocess/fileWriterProcess.txt tests/auto/qlibrary/libmylib.so* tests/auto/qresourceengine/runtime_resource.rcc tools/qdoc3/qdoc3* +tools/qtestlib/chart/chart* tools/qtestlib/updater/updater* tools/activeqt/testcon/testcon.tlb translations/*.qm -- cgit v0.12 From 5f0a3cd6dbae87b5944c3cb31fdc294fc0ac1163 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 23 Nov 2009 09:56:08 +1000 Subject: Remove deleted state operations from the state. --- src/declarative/util/qmlstate_p_p.h | 25 ++++++++- tests/auto/declarative/states/data/deleting.qml | 11 ++++ .../auto/declarative/states/data/deletingState.qml | 13 +++++ tests/auto/declarative/states/tst_states.cpp | 65 ++++++++++++++++++++++ 4 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/states/data/deleting.qml create mode 100644 tests/auto/declarative/states/data/deletingState.qml diff --git a/src/declarative/util/qmlstate_p_p.h b/src/declarative/util/qmlstate_p_p.h index 095a7d2..75eb3fd 100644 --- a/src/declarative/util/qmlstate_p_p.h +++ b/src/declarative/util/qmlstate_p_p.h @@ -102,7 +102,30 @@ public: QString name; QmlBinding *when; - QmlConcreteList operations; + + class OperationList; + struct OperationGuard : public QGuard + { + OperationGuard(QObject *obj, OperationList *l) : list(l) { (QGuard&)*this = obj; } + OperationList *list; + void objectDestroyed(QmlStateOperation *) { + // we assume priv will always be destroyed after objectDestroyed calls + list->removeOne(*this); + } + }; + + typedef QList GuardedOpList; + class OperationList : public GuardedOpList, public QmlList + { + public: + virtual void append(QmlStateOperation* v) { GuardedOpList::append(OperationGuard(v, this)); } + virtual void insert(int i, QmlStateOperation* v) { GuardedOpList::insert(i, OperationGuard(v, this)); } + virtual void clear() { GuardedOpList::clear(); } + virtual QmlStateOperation* at(int i) const { return GuardedOpList::at(i); } + virtual void removeAt(int i) { GuardedOpList::removeAt(i); } + virtual int count() const { return GuardedOpList::count(); } + }; + OperationList operations; QmlTransitionManager transitionManager; diff --git a/tests/auto/declarative/states/data/deleting.qml b/tests/auto/declarative/states/data/deleting.qml new file mode 100644 index 0000000..0c512dd --- /dev/null +++ b/tests/auto/declarative/states/data/deleting.qml @@ -0,0 +1,11 @@ +import Qt 4.6 +Rectangle { + id: MyRectangle + width: 100; height: 100 + color: "red" + states: State { + name: "blue" + PropertyChanges { target: MyRectangle; color: "blue"; objectName: "pc1" } + PropertyChanges { target: MyRectangle; radius: 5; objectName: "pc2" } + } +} diff --git a/tests/auto/declarative/states/data/deletingState.qml b/tests/auto/declarative/states/data/deletingState.qml new file mode 100644 index 0000000..9dc46a6 --- /dev/null +++ b/tests/auto/declarative/states/data/deletingState.qml @@ -0,0 +1,13 @@ +import Qt 4.6 +Rectangle { + id: MyRectangle + width: 100; height: 100 + color: "red" + StateGroup { + id: stateGroup + states: State { + name: "blue" + PropertyChanges { target: MyRectangle; color: "blue" } + } + } +} diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp index a4da1f1..4847535 100644 --- a/tests/auto/declarative/states/tst_states.cpp +++ b/tests/auto/declarative/states/tst_states.cpp @@ -44,6 +44,7 @@ #include #include #include +#include class tst_states : public QObject { @@ -69,6 +70,8 @@ private slots: void explicitChanges(); void propertyErrors(); void incorrectRestoreBug(); + void deletingChange(); + void deletingState(); }; void tst_states::basicChanges() @@ -738,6 +741,68 @@ void tst_states::incorrectRestoreBug() QCOMPARE(rect->color(),QColor("green")); } +void tst_states::deletingChange() +{ + QmlEngine engine; + + QmlComponent rectComponent(&engine, SRCDIR "/data/deleting.qml"); + QmlGraphicsRectangle *rect = qobject_cast(rectComponent.create()); + QVERIFY(rect != 0); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + QCOMPARE(rect->radius(),qreal(5)); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + QCOMPARE(rect->radius(),qreal(0)); + + QmlPropertyChanges *pc = rect->findChild("pc1"); + QVERIFY(pc != 0); + delete pc; + + QmlState *state = rect->findChild(); + QVERIFY(state != 0); + QCOMPARE(state->changes()->count(), 1); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("red")); + QCOMPARE(rect->radius(),qreal(5)); + + delete rect; +} + +void tst_states::deletingState() +{ + QmlEngine engine; + + QmlComponent rectComponent(&engine, SRCDIR "/data/deletingState.qml"); + QmlGraphicsRectangle *rect = qobject_cast(rectComponent.create()); + QVERIFY(rect != 0); + + QmlStateGroup *sg = rect->findChild(); + QVERIFY(sg != 0); + QVERIFY(sg->findState("blue") != 0); + + sg->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + sg->setState(""); + QCOMPARE(rect->color(),QColor("red")); + + QmlState *state = rect->findChild(); + QVERIFY(state != 0); + delete state; + + QVERIFY(sg->findState("blue") == 0); + + //### should we warn that state doesn't exist + sg->setState("blue"); + QCOMPARE(rect->color(),QColor("red")); + + delete rect; +} + QTEST_MAIN(tst_states) #include "tst_states.moc" -- cgit v0.12 From c3008c1df3017d0b9a4280def69c99be181a3689 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 09:59:10 +1000 Subject: Check initial preferredHeight. --- tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp index 6bd28fb..543ba3f 100644 --- a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp +++ b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp @@ -143,6 +143,7 @@ void tst_qmlgraphicswebview::basicProperties() QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->html())); QCOMPARE(wv->width(), 123.0); QCOMPARE(wv->preferredWidth(), 0); + QCOMPARE(wv->preferredHeight(), 0); QCOMPARE(wv->zoomFactor(), 1.0); QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); QCOMPARE(wv->status(), QmlGraphicsWebView::Ready); -- cgit v0.12 From 99ff19eab317990ae927e42aa5084110ebc1e03a Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 10:08:47 +1000 Subject: Test setting property when not set before. --- tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp index 80efd94..61d0863 100644 --- a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp +++ b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp @@ -111,6 +111,7 @@ void tst_QmlListModel::dynamic_data() QTest::newRow("setprop3b") << "{append({'foo':123,'bar':456});set(0,'foo',999);get(0).bar}" << 456 << ""; QTest::newRow("setprop4a") << "{set(0,'foo',456)}" << 0 << "QML QmlListModel (unknown location) set: index 0 out of range"; QTest::newRow("setprop4a") << "{append({'foo':123,'bar':456});set(1,'foo',456)}" << 0 << "QML QmlListModel (unknown location) set: index 1 out of range"; + QTest::newRow("setprop5") << "{append({'foo':123,'bar':456});append({'foo':111});set(1,'bar',222);get(1).bar}" << 222 << ""; QTest::newRow("move1a") << "{append({'foo':123});append({'foo':456});move(0,1,1);count}" << 2 << ""; QTest::newRow("move1b") << "{append({'foo':123});append({'foo':456});move(0,1,1);get(0).foo}" << 456 << ""; -- cgit v0.12 From 9e5cb8c9e6a8526a26cd6ada9ccec1aba002cf68 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 10:10:46 +1000 Subject: Test one-past-end setting (not error; same as append). --- tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp index 61d0863..95cf68e 100644 --- a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp +++ b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp @@ -104,6 +104,7 @@ void tst_QmlListModel::dynamic_data() QTest::newRow("set4a") << "{set(0,{'foo':456})}" << 0 << "QML QmlListModel (unknown location) set: index 0 out of range"; QTest::newRow("set5a") << "{append({'foo':123,'bar':456});set(0,123)}" << 0 << "QML QmlListModel (unknown location) set: value is not an object"; QTest::newRow("set5b") << "{append({'foo':123,'bar':456});set(0,[1,2,3])}" << 0 << "QML QmlListModel (unknown location) set: value is not an object"; + QTest::newRow("set6") << "{append({'foo':123});set(1,{'foo':456});count}" << 2 << ""; QTest::newRow("setprop1") << "{append({'foo':123});set(0,'foo',456);count}" << 1 << ""; QTest::newRow("setprop2") << "{append({'foo':123});set(0,'foo',456);get(0).foo}" << 456 << ""; -- cgit v0.12 From 3bfdd96b99aa346d055d97c648f8f553d557f998 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 23 Nov 2009 10:36:22 +1000 Subject: Update benchmarks to run again --- tests/benchmarks/declarative/binding/binding.pro | 1 + .../benchmarks/declarative/binding/idproperty.txt | 2 + .../declarative/binding/localproperty.txt | 2 + tests/benchmarks/declarative/binding/testtypes.cpp | 2 +- tests/benchmarks/declarative/creation/creation.pro | 10 + .../declarative/creation/data/qobject.qml | 4 + .../declarative/creation/tst_creation.cpp | 247 +++++++++++++++++++++ tests/benchmarks/declarative/pointers/pointers.pro | 1 + .../benchmarks/declarative/qmlcomponent/object.txt | 2 +- .../declarative/qmlcomponent/object_id.txt | 2 +- .../declarative/qmlcomponent/qmlcomponent.pro | 1 + .../qmlcomponent/synthesized_properties.2.txt | 2 +- .../qmlcomponent/synthesized_properties.txt | 2 +- .../declarative/qmlcomponent/testtypes.cpp | 2 +- .../qmlmetaproperty/qmlmetaproperty.pro | 1 + 15 files changed, 275 insertions(+), 6 deletions(-) create mode 100644 tests/benchmarks/declarative/creation/creation.pro create mode 100644 tests/benchmarks/declarative/creation/data/qobject.qml create mode 100644 tests/benchmarks/declarative/creation/tst_creation.cpp diff --git a/tests/benchmarks/declarative/binding/binding.pro b/tests/benchmarks/declarative/binding/binding.pro index 26ee4fa..e25f186 100644 --- a/tests/benchmarks/declarative/binding/binding.pro +++ b/tests/benchmarks/declarative/binding/binding.pro @@ -2,6 +2,7 @@ load(qttest_p4) TEMPLATE = app TARGET = tst_binding QT += declarative +macx:CONFIG -= app_bundle SOURCES += tst_binding.cpp testtypes.cpp HEADERS += testtypes.h diff --git a/tests/benchmarks/declarative/binding/idproperty.txt b/tests/benchmarks/declarative/binding/idproperty.txt index 0a98e0d..71e3c4e 100644 --- a/tests/benchmarks/declarative/binding/idproperty.txt +++ b/tests/benchmarks/declarative/binding/idproperty.txt @@ -1,3 +1,5 @@ +import Test 1.0 + MyQmlObject { id: MyObject diff --git a/tests/benchmarks/declarative/binding/localproperty.txt b/tests/benchmarks/declarative/binding/localproperty.txt index 4694d99..c7ca0ef 100644 --- a/tests/benchmarks/declarative/binding/localproperty.txt +++ b/tests/benchmarks/declarative/binding/localproperty.txt @@ -1,3 +1,5 @@ +import Test 1.0 + MyQmlObject { result: ### } diff --git a/tests/benchmarks/declarative/binding/testtypes.cpp b/tests/benchmarks/declarative/binding/testtypes.cpp index 9dad523..892738c 100644 --- a/tests/benchmarks/declarative/binding/testtypes.cpp +++ b/tests/benchmarks/declarative/binding/testtypes.cpp @@ -40,4 +40,4 @@ ****************************************************************************/ #include "testtypes.h" -QML_DEFINE_TYPE(MyQmlObject, MyQmlObject); +QML_DEFINE_TYPE(Test, 1, 0, MyQmlObject, MyQmlObject); diff --git a/tests/benchmarks/declarative/creation/creation.pro b/tests/benchmarks/declarative/creation/creation.pro new file mode 100644 index 0000000..fcc2987 --- /dev/null +++ b/tests/benchmarks/declarative/creation/creation.pro @@ -0,0 +1,10 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_creation +QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_creation.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" + diff --git a/tests/benchmarks/declarative/creation/data/qobject.qml b/tests/benchmarks/declarative/creation/data/qobject.qml new file mode 100644 index 0000000..99d010f --- /dev/null +++ b/tests/benchmarks/declarative/creation/data/qobject.qml @@ -0,0 +1,4 @@ +import Qt 4.6 + +QtObject { +} diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp new file mode 100644 index 0000000..99411d4 --- /dev/null +++ b/tests/benchmarks/declarative/creation/tst_creation.cpp @@ -0,0 +1,247 @@ +/**************************************************************************** +** +** 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 +#include +#include +#include +#include +#include +#include + +class tst_creation : public QObject +{ + Q_OBJECT +public: + tst_creation() {} + +private slots: + void qobject_cpp(); + void qobject_qml(); + void qobject_qmltype(); + void qobject_alloc(); + + void objects_qmltype_data(); + void objects_qmltype(); + + void qgraphicsitem(); + void qgraphicsitem_tree(); + +private: + QmlEngine engine; +}; + +inline QUrl TEST_FILE(const QString &filename) +{ + return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); +} + +void tst_creation::qobject_cpp() +{ + QBENCHMARK { + QObject *obj = new QObject; + delete obj; + } +} + +void tst_creation::qobject_qml() +{ + QmlComponent component(&engine, TEST_FILE("qobject.qml")); + QObject *obj = component.create(); + delete obj; + + QBENCHMARK { + QObject *obj = component.create(); + delete obj; + } +} + +void tst_creation::qobject_qmltype() +{ + QmlType *t = QmlMetaType::qmlType("Qt/QtObject", 4, 6); + + QBENCHMARK { + QObject *obj = t->create(); + delete obj; + } +} + +struct QObjectFakeData { + char data[sizeof(QObjectPrivate)]; +}; + +struct QObjectFake { + QObjectFake(); + virtual ~QObjectFake(); +private: + QObjectFakeData *d; +}; + +QObjectFake::QObjectFake() +{ + d = new QObjectFakeData; +} + +QObjectFake::~QObjectFake() +{ + delete d; +} + +void tst_creation::qobject_alloc() +{ + QBENCHMARK { + QObjectFake *obj = new QObjectFake; + delete obj; + } +} + +void tst_creation::objects_qmltype_data() +{ + QTest::addColumn("type"); + + QList types = QmlMetaType::qmlTypeNames(); + foreach (QByteArray type, types) + QTest::newRow(type.constData()) << type; +} + +void tst_creation::objects_qmltype() +{ + QFETCH(QByteArray, type); + QmlType *t = QmlMetaType::qmlType(type, 4, 6); + + QBENCHMARK { + QObject *obj = t->create(); + delete obj; + } +} + +class QGraphicsItemDummy : public QGraphicsItem +{ +public: + virtual QRectF boundingRect() const { return QRectF(); } + virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {} +}; + +void tst_creation::qgraphicsitem() +{ + QBENCHMARK { + QGraphicsItemDummy *i1 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i2 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i3 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i4 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i5 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i6 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i7 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i8 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i9 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i10 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i11 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i12 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i13 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i14 = new QGraphicsItemDummy(); + + delete i1; + delete i2; + delete i3; + delete i4; + delete i5; + delete i6; + delete i7; + delete i8; + delete i9; + delete i10; + delete i11; + delete i12; + delete i13; + delete i14; + } +} + +void tst_creation::qgraphicsitem_tree() +{ + QBENCHMARK { + // i1 + // +-------------------------+ + // i2 i3 + // +-----------+ +-----+-----+ + // i4 i5 i6 i7 + // +----+ +--+ +--+--+ +----+ + // i8 i9 i10 i11 i12 i13 i14 + + QGraphicsItemDummy *i1 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i2 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i3 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i4 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i5 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i6 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i7 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i8 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i9 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i10 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i11 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i12 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i13 = new QGraphicsItemDummy(); + QGraphicsItemDummy *i14 = new QGraphicsItemDummy(); + + i14->setParentItem(i7); + i13->setParentItem(i7); + i12->setParentItem(i6); + i11->setParentItem(i6); + i10->setParentItem(i5); + i9->setParentItem(i4); + i8->setParentItem(i4); + + i7->setParentItem(i3); + i6->setParentItem(i3); + i5->setParentItem(i2); + i4->setParentItem(i2); + + i3->setParentItem(i1); + i2->setParentItem(i1); + + delete i1; + } +} + + +QTEST_MAIN(tst_creation) + +#include "tst_creation.moc" diff --git a/tests/benchmarks/declarative/pointers/pointers.pro b/tests/benchmarks/declarative/pointers/pointers.pro index fafdcd6..6de6e31 100644 --- a/tests/benchmarks/declarative/pointers/pointers.pro +++ b/tests/benchmarks/declarative/pointers/pointers.pro @@ -1,6 +1,7 @@ load(qttest_p4) TEMPLATE = app TARGET = tst_pointers +macx:CONFIG -= app_bundle SOURCES += tst_pointers.cpp diff --git a/tests/benchmarks/declarative/qmlcomponent/object.txt b/tests/benchmarks/declarative/qmlcomponent/object.txt index 85e74b9..0d2d49b 100644 --- a/tests/benchmarks/declarative/qmlcomponent/object.txt +++ b/tests/benchmarks/declarative/qmlcomponent/object.txt @@ -1,3 +1,3 @@ import Qt 4.6 -Object {} +QtObject {} diff --git a/tests/benchmarks/declarative/qmlcomponent/object_id.txt b/tests/benchmarks/declarative/qmlcomponent/object_id.txt index 526b6ad..69114af 100644 --- a/tests/benchmarks/declarative/qmlcomponent/object_id.txt +++ b/tests/benchmarks/declarative/qmlcomponent/object_id.txt @@ -1,6 +1,6 @@ import Qt 4.6 -Object { +QtObject { id: Blah } diff --git a/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro b/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro index 5f0cbe6..6a86f58 100644 --- a/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro +++ b/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro @@ -2,6 +2,7 @@ load(qttest_p4) TEMPLATE = app TARGET = tst_qmlcomponent QT += declarative +macx:CONFIG -= app_bundle SOURCES += tst_qmlcomponent.cpp testtypes.cpp HEADERS += testtypes.h diff --git a/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.2.txt b/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.2.txt index 90db37c..27c5646 100644 --- a/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.2.txt +++ b/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.2.txt @@ -1,6 +1,6 @@ import Qt 4.6 -Object { +QtObject { property int a property bool b property double c diff --git a/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.txt b/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.txt index bb5469a..d08f35b 100644 --- a/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.txt +++ b/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.txt @@ -1,5 +1,5 @@ import Qt 4.6 -Object { +QtObject { property int a } diff --git a/tests/benchmarks/declarative/qmlcomponent/testtypes.cpp b/tests/benchmarks/declarative/qmlcomponent/testtypes.cpp index 8350211..56d20c6 100644 --- a/tests/benchmarks/declarative/qmlcomponent/testtypes.cpp +++ b/tests/benchmarks/declarative/qmlcomponent/testtypes.cpp @@ -40,4 +40,4 @@ ****************************************************************************/ #include "testtypes.h" -QML_DEFINE_TYPE(Qt/test, 4, 6, 6, MyQmlObject, MyQmlObject); +QML_DEFINE_TYPE(Qt.test, 4, 6, MyQmlObject, MyQmlObject); diff --git a/tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro b/tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro index b4e83d7..c18a56b 100644 --- a/tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro +++ b/tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro @@ -2,6 +2,7 @@ load(qttest_p4) TEMPLATE = app TARGET = tst_qmlmetaproperty QT += declarative +macx:CONFIG -= app_bundle SOURCES += tst_qmlmetaproperty.cpp -- cgit v0.12 From 831d30af205d5125f762696bb6f9a5f9d1e3c5f5 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 23 Nov 2009 10:53:06 +1000 Subject: Doc. --- src/declarative/graphicsitems/qmlgraphicsitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qmlgraphicsitem.cpp index fb6afb1..263aea5 100644 --- a/src/declarative/graphicsitems/qmlgraphicsitem.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsitem.cpp @@ -2307,7 +2307,7 @@ void QmlGraphicsItem::setBaselineOffset(qreal offset) Opacity is an \e inherited attribute. That is, the opacity is also applied individually to child items. In almost all cases this is what you want. If you can spot the issue in the following - example, you might need to use an opacity filter (not yet available) instead. + example, you might need to use an \l Opacity effect instead. \table \row -- cgit v0.12 From 7de5a4981144648a158d893542bfe5ad82d6830d Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 11:10:26 +1000 Subject: Tidy (and fix) error messages. --- src/declarative/util/qmllistmodel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index a3c5c59..5491fd7 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -732,11 +732,11 @@ bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QL for(int jj = 0; jj < props.count(); ++jj) { const QmlCustomParserProperty &nodeProp = props.at(jj); if (nodeProp.name() == "") { - error(nodeProp, QLatin1String("Cannot use default property in ListModel")); + error(nodeProp, QmlListModel::tr("ListElement: cannot use default property")); return false; } if (nodeProp.name() == "id") { - error(nodeProp, QLatin1String("Cannot use reserved \"id\" property in ListModel")); + error(nodeProp, QmlListModel::tr("ListElement: cannot use reserved \"id\" property")); return false; } @@ -792,7 +792,7 @@ QByteArray QmlListModelParser::compile(const QList &cus for(int ii = 0; ii < customProps.count(); ++ii) { const QmlCustomParserProperty &prop = customProps.at(ii); if(prop.name() != "") { // isn't default property - error(prop, QLatin1String("Cannot use default property")); + error(prop, QmlListModel::tr("ListModel: undefined property '%1'").arg(QString::fromUtf8(prop.name()))); return QByteArray(); } -- cgit v0.12 From b316de95032216a90a8262cce3708f781f8ccbd9 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 11:11:53 +1000 Subject: Test error messages. --- .../declarative/qmllistmodel/tst_qmllistmodel.cpp | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp index 95cf68e..f2ffb7b 100644 --- a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp +++ b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include class tst_QmlListModel : public QObject @@ -52,6 +53,8 @@ public: private slots: void dynamic_data(); void dynamic(); + void error_data(); + void error(); }; void tst_QmlListModel::dynamic_data() @@ -155,6 +158,56 @@ void tst_QmlListModel::dynamic() QCOMPARE(actual,result); } +void tst_QmlListModel::error_data() +{ + QTest::addColumn("qml"); + QTest::addColumn("error"); + + QTest::newRow("id not allowed in ListElement") + << "import Qt 4.6\nListModel { ListElement { id: fred } }" + << "ListElement: cannot use reserved \"id\" property"; + + QTest::newRow("id allowed in ListModel") + << "import Qt 4.6\nListModel { id:model }" + << ""; + + QTest::newRow("random properties not allowed in ListModel") + << "import Qt 4.6\nListModel { foo:123 }" + << "ListModel: undefined property 'foo'"; + + QTest::newRow("random properties allowed in ListElement") + << "import Qt 4.6\nListModel { ListElement { foo:123 } }" + << ""; + + QTest::newRow("random object list properties allowed in ListElement") + << "import Qt 4.6\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }" + << ""; + + QTest::newRow("default properties not allowed in ListElement") + << "import Qt 4.6\nListModel { ListElement { Item { } } }" + << "QTBUG-6082 ListElement should not allow child objects"; +} + +void tst_QmlListModel::error() +{ + QFETCH(QString, qml); + QFETCH(QString, error); + + QmlEngine engine; + QmlComponent component(&engine, qml.toUtf8(), + QUrl::fromLocalFile(QString("dummy.qml"))); + if (error.isEmpty()) { + QVERIFY(!component.isError()); + } else { + if (error.startsWith(QLatin1String("QTBUG-"))) + QEXPECT_FAIL("",error.toLatin1(),Abort); + QVERIFY(component.isError()); + QList errors = component.errors(); + QCOMPARE(errors.count(),1); + QCOMPARE(errors.at(0).description(),error); + } +} + QTEST_MAIN(tst_QmlListModel) #include "tst_qmllistmodel.moc" -- cgit v0.12 From 13815e441c6e0bb02daced5546965fde65a0cbb7 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 23 Nov 2009 11:29:05 +1000 Subject: Documentation fixes Changed html tags over to qdoc tags. --- src/declarative/util/qmlnumberformatter.cpp | 92 +++++++++++++++++++++-------- 1 file changed, 68 insertions(+), 24 deletions(-) diff --git a/src/declarative/util/qmlnumberformatter.cpp b/src/declarative/util/qmlnumberformatter.cpp index b09be5b..fce35d9 100644 --- a/src/declarative/util/qmlnumberformatter.cpp +++ b/src/declarative/util/qmlnumberformatter.cpp @@ -97,7 +97,7 @@ QmlNumberFormatter::~QmlNumberFormatter() \qmlproperty string NumberFormatter::text The number in the specified format. -
+ If no format is specified the text will be empty. */ @@ -123,38 +123,82 @@ qreal QmlNumberFormatter::number() const \qmlproperty string NumberFormatter::format The particular format the number will adhere to during the conversion to text. -
+ The format syntax follows a style similar to the Unicode Standard (UTS35). The table below shows the characters, patterns that can be used in the format. - - - - - - - -
Character Meaning
# Any digit(s), zero shows as absent (for leading/trailing zeroes)
0 Implicit digit. Zero will show in the case that the input number is too small.
. Decimal separator. Output decimal seperator will be dependant on system locale.
, Grouping separator. The number of digits (either #, or 0) between the grouping separator and the decimal (or the rightmost digit) will determine the groupingSize)
other Any other character will be taken as a string literal and placed directly into the output string
+ \table + \header + \o Character + \o Meaning + \row + \o # + \o Any digit(s), zero shows as absent (for leading/trailing zeroes). + \row + \o 0 + \o Implicit digit. Zero will show in the case that the input number is too small. + \row + \o . + \o Decimal separator. Output decimal seperator will be dependant on system locale. + \row + \o , + \o Grouping separator. The number of digits (either #, or 0) between the grouping separator and the decimal (or the rightmost digit) will determine the groupingSize). + \row + \o other + \o Any other character will be taken as a string literal and placed directly into the output string. + \endtable - Invalid formats will not guarantee a meaningful text output.
+ Invalid formats will not guarantee a meaningful text output. - \note Input numbers that are too long for the given format will be rounded dependent on precison based on the position of the decimal point + \note Input numbers that are too long for the given format will be rounded dependent on precison based on the position of the decimal point. The following table illustrates the output text created by applying some examples of numeric formats to the formatter. - - - - - - - - - - - -
Format Number Output
### 123456 123456
000 123456 123456
###### 1234 1234
000000 1234 001234
##,##0.## 1234.456 1,234.46 (for US locale)
1 234,46 (for FR locale)
000000,000.# 123456 000,123,456 (for US locale)
000 123 456 (for FR locale)
0.0### 0.999997 1.0
(000) 000 - 000 12345678 (012) 345 - 678
#A1212A
+ \table + \header + \o Format + \o Number + \o Output + \row + \o ### + \o 123456 + \o 123456 + \row + \o 000 + \o 123456 + \o 123456 + \row + \o ###### + \o 1234 + \o 1234 + \row + \o 000000 + \o 1234 + \o 001234 + \row + \o ##,##0.## + \o 1234.456 + \o 1,234.46 (for US locale) + \codeline 1 234,46 (for FR locale) + \row + \o 000000,000.# + \o 123456 + \o 000,123,456 (for US locale) + \codeline 000 123 456 (for FR locale) + \row + \o 0.0### + \o 0.999997 + \o 1.0 + \row + \o (000) 000 - 000 + \o 12345678 + \o (012) 345 - 678 + \row + \o #A + \o 12 + \o 12A + \endtable */ QString QmlNumberFormatter::format() const -- cgit v0.12 From 4621721a9c3705dc9fbc3b6f15e6122f913e5c72 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 11:38:16 +1000 Subject: Demonstrate "container" type objects. --- examples/declarative/tabwidget/TabWidget.qml | 42 ++++++++++++++++++++++++++++ examples/declarative/tabwidget/tabs.qml | 29 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 examples/declarative/tabwidget/TabWidget.qml create mode 100644 examples/declarative/tabwidget/tabs.qml diff --git a/examples/declarative/tabwidget/TabWidget.qml b/examples/declarative/tabwidget/TabWidget.qml new file mode 100644 index 0000000..c56f41e --- /dev/null +++ b/examples/declarative/tabwidget/TabWidget.qml @@ -0,0 +1,42 @@ +import Qt 4.6 + +Item { + id: page + property int current: 0 + default property alias content: stack.children + onCurrentChanged: setOpacities() + Component.onCompleted: setOpacities() + function setOpacities() + { + for (var i=0; iRoses are red"; font.pixelSize: 24 + wrap: true; width: parent.width-20 } + } + Rectangle { + property string title: "Green" + color: "green" + anchors.fill: parent + Text { anchors.centerIn: parent; text: "
Flower stems are green"; font.pixelSize: 24; + wrap: true; width: parent.width-20 } + } + Rectangle { + property string title: "Blue" + color: "blue" + anchors.fill: parent + Text { anchors.centerIn: parent; text: "
Violets are blue"; color: "white"; font.pixelSize: 24 + wrap: true; width: parent.width-20 } + } +} -- cgit v0.12 From 51c4944a90cca18679cfdb22f9bb5ef47664e465 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 23 Nov 2009 12:15:01 +1000 Subject: Crash --- tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index 92b2c1a..1481dae 100644 --- a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -993,7 +993,6 @@ void tst_QMetaObjectBuilder::serialize() QMetaObjectBuilder builder; builder.setClassName("Test"); builder.addProperty("foo", "int"); - builder.setSuperClass(0); QByteArray data; QDataStream stream(&data, QIODevice::WriteOnly | QIODevice::Append); -- cgit v0.12