diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-01-27 06:52:54 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-01-27 06:52:54 (GMT) |
commit | ab71df83ba4eb9d749efc0f3a2d4a0fe5486023f (patch) | |
tree | 4605ab304db27aeec693a154418f2fbffbdebfc2 | |
parent | 5d2817cd668a705729df1727de49adf00713ac97 (diff) | |
download | Qt-ab71df83ba4eb9d749efc0f3a2d4a0fe5486023f.zip Qt-ab71df83ba4eb9d749efc0f3a2d4a0fe5486023f.tar.gz Qt-ab71df83ba4eb9d749efc0f3a2d4a0fe5486023f.tar.bz2 |
Add missing revisions for QtQuick 1.1 additions
Task-number: QTBUG-15279
Reviewed-by: Michael Brasser
10 files changed, 148 insertions, 17 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index 8448bd6..471c87f 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -48,6 +48,11 @@ QT_BEGIN_NAMESPACE +QDeclarativeImageBase::QDeclarativeImageBase(QDeclarativeItem *parent) + : QDeclarativeImplicitSizeItem(*(new QDeclarativeImageBasePrivate), parent) +{ +} + QDeclarativeImageBase::QDeclarativeImageBase(QDeclarativeImageBasePrivate &dd, QDeclarativeItem *parent) : QDeclarativeImplicitSizeItem(dd, parent) { diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h index d183bdc..abee25d 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h @@ -58,11 +58,12 @@ class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeImplicitSizeI Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged) - Q_PROPERTY(bool cache READ cache WRITE setCache NOTIFY cacheChanged) // ### VERSIONING: Only in QtQuick 1.1 + Q_PROPERTY(bool cache READ cache WRITE setCache NOTIFY cacheChanged REVISION 1) Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged) - Q_PROPERTY(bool mirror READ mirror WRITE setMirror NOTIFY mirrorChanged) // ### VERSIONING: Only in QtQuick 1.1 + Q_PROPERTY(bool mirror READ mirror WRITE setMirror NOTIFY mirrorChanged REVISION 1) public: + QDeclarativeImageBase(QDeclarativeItem *parent=0); ~QDeclarativeImageBase(); enum Status { Null, Ready, Loading, Error }; Status status() const; @@ -89,8 +90,8 @@ Q_SIGNALS: void statusChanged(QDeclarativeImageBase::Status); void progressChanged(qreal progress); void asynchronousChanged(); - void cacheChanged(); - void mirrorChanged(); + Q_REVISION(1) void cacheChanged(); + Q_REVISION(1) void mirrorChanged(); protected: virtual void load(); diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 3395397..bc4a2d0 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -187,10 +187,12 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType<QDeclarativeGrid,1>("QtQuick",1,1,"Grid"); qmlRegisterType<QDeclarativeFlow,1>("QtQuick",1,1,"Flow"); qmlRegisterType<QDeclarativeRepeater,1>("QtQuick",1,1,"Repeater"); + qmlRegisterType<QDeclarativeText,1>("QtQuick",1,1,"Text"); qmlRegisterType<QDeclarativeTextEdit,1>("QtQuick",1,1,"TextEdit"); #ifndef QT_NO_LINEEDIT qmlRegisterType<QDeclarativeTextInput,1>("QtQuick",1,1,"TextInput"); #endif + qmlRegisterRevision<QDeclarativeImageBase,1>("QtQuick",1,1); qmlRegisterRevision<QDeclarativeImplicitSizeItem,0>("QtQuick",1,0); qmlRegisterRevision<QDeclarativeImplicitSizeItem,1>("QtQuick",1,1); qmlRegisterRevision<QDeclarativeImplicitSizePaintedItem,0>("QtQuick",1,0); diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h index 6b45e49..55d8fa1 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h @@ -129,7 +129,7 @@ private: class Q_AUTOTEST_EXPORT QDeclarativeRow: public QDeclarativeBasePositioner { Q_OBJECT - Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1); + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) public: QDeclarativeRow(QDeclarativeItem *parent=0); @@ -153,7 +153,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged) Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged) Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) - Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1); + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) public: QDeclarativeGrid(QDeclarativeItem *parent=0); @@ -194,7 +194,7 @@ class QDeclarativeFlowPrivate; class Q_AUTOTEST_EXPORT QDeclarativeFlow: public QDeclarativeBasePositioner { Q_OBJECT - Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1); + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) public: QDeclarativeFlow(QDeclarativeItem *parent=0); diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index ec33b84..58751e7 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -71,9 +71,9 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeText : public QDeclarativeImplici Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) - Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged) - Q_PROPERTY(bool truncated READ truncated NOTIFY truncatedChanged) - Q_PROPERTY(int maximumLineCount READ maximumLineCount WRITE setMaximumLineCount NOTIFY maximumLineCountChanged RESET resetMaximumLineCount) + Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1) + Q_PROPERTY(bool truncated READ truncated NOTIFY truncatedChanged REVISION 1) + Q_PROPERTY(int maximumLineCount READ maximumLineCount WRITE setMaximumLineCount NOTIFY maximumLineCountChanged RESET resetMaximumLineCount REVISION 1) Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged) Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode NOTIFY elideModeChanged) //### elideMode? @@ -169,9 +169,9 @@ Q_SIGNALS: void horizontalAlignmentChanged(HAlignment alignment); void verticalAlignmentChanged(VAlignment alignment); void wrapModeChanged(); - void lineCountChanged(); - void truncatedChanged(); - void maximumLineCountChanged(); + Q_REVISION(1) void lineCountChanged(); + Q_REVISION(1) void truncatedChanged(); + Q_REVISION(1) void maximumLineCountChanged(); void textFormatChanged(TextFormat textFormat); void elideModeChanged(TextElideMode mode); void paintedSizeChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 276d570..db3cb2d 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -75,7 +75,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePa Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) - Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged) + Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1) Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged) Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedSizeChanged) Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged) diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index c277eb7..f1fe2bd 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -90,6 +90,8 @@ private slots: void paintedWidthHeight(); void sourceSize_QTBUG_14303(); void nullPixmapPaint(); + void testQtQuick11Attributes(); + void testQtQuick11Attributes_data(); private: template<typename T> @@ -164,7 +166,7 @@ void tst_qdeclarativeimage::imageSource() if (!error.isEmpty()) QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - QString componentStr = "import QtQuick 1.0\nImage { source: \"" + source + "\"; asynchronous: " + QString componentStr = "import QtQuick 1.1\nImage { source: \"" + source + "\"; asynchronous: " + (async ? QLatin1String("true") : QLatin1String("false")) + "; cache: " + (cache ? QLatin1String("true") : QLatin1String("false")) + " }"; QDeclarativeComponent component(&engine); @@ -280,7 +282,7 @@ void tst_qdeclarativeimage::mirror() qreal height = 250; QString src = QUrl::fromLocalFile(SRCDIR "/data/heart200.png").toString(); - QString componentStr = "import QtQuick 1.0\nImage { source: \"" + src + "\"; }"; + QString componentStr = "import QtQuick 1.1\nImage { source: \"" + src + "\"; }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -667,6 +669,45 @@ void tst_qdeclarativeimage::nullPixmapPaint() delete image; } +void tst_qdeclarativeimage::testQtQuick11Attributes() +{ + QFETCH(QString, code); + QFETCH(QString, warning); + QFETCH(QString, error); + + QDeclarativeEngine engine; + QObject *obj; + + QDeclarativeComponent valid(&engine); + valid.setData("import QtQuick 1.1; Image { " + code.toUtf8() + " }", QUrl("")); + obj = valid.create(); + QVERIFY(obj); + QVERIFY(valid.errorString().isEmpty()); + delete obj; + + QDeclarativeComponent invalid(&engine); + invalid.setData("import QtQuick 1.0; Image { " + code.toUtf8() + " }", QUrl("")); + QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); + obj = invalid.create(); + QCOMPARE(invalid.errorString(), error); + delete obj; +} + +void tst_qdeclarativeimage::testQtQuick11Attributes_data() +{ + QTest::addColumn<QString>("code"); + QTest::addColumn<QString>("warning"); + QTest::addColumn<QString>("error"); + + QTest::newRow("mirror") << "mirror: true" + << "QDeclarativeComponent: Component is not ready" + << ":1 \"Image.mirror\" is not available in QtQuick 1.0.\n"; + + QTest::newRow("cache") << "cache: true" + << "QDeclarativeComponent: Component is not ready" + << ":1 \"Image.cache\" is not available in QtQuick 1.0.\n"; +} + /* Find an item with the specified objectName. If index is supplied then the item must also evaluate the {index} expression equal to index diff --git a/tests/auto/declarative/qdeclarativetext/data/lineCount.qml b/tests/auto/declarative/qdeclarativetext/data/lineCount.qml index b3d7bc1..63817f6 100644 --- a/tests/auto/declarative/qdeclarativetext/data/lineCount.qml +++ b/tests/auto/declarative/qdeclarativetext/data/lineCount.qml @@ -1,4 +1,4 @@ -import QtQuick 1.0 +import QtQuick 1.1 Item { width: 200 diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index faea448..fabae18 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -103,6 +103,8 @@ private slots: void QTBUG_12291(); void implicitSize_data(); void implicitSize(); + void testQtQuick11Attributes(); + void testQtQuick11Attributes_data(); private: QStringList standard; @@ -1079,6 +1081,45 @@ void tst_qdeclarativetext::implicitSize() QVERIFY(textObject->height() == textObject->implicitHeight()); } +void tst_qdeclarativetext::testQtQuick11Attributes() +{ + QFETCH(QString, code); + QFETCH(QString, warning); + QFETCH(QString, error); + + QDeclarativeEngine engine; + QObject *obj; + + QDeclarativeComponent valid(&engine); + valid.setData("import QtQuick 1.1; Text { " + code.toUtf8() + " }", QUrl("")); + obj = valid.create(); + QVERIFY(obj); + QVERIFY(valid.errorString().isEmpty()); + delete obj; + + QDeclarativeComponent invalid(&engine); + invalid.setData("import QtQuick 1.0; Text { " + code.toUtf8() + " }", QUrl("")); + QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); + obj = invalid.create(); + QCOMPARE(invalid.errorString(), error); + delete obj; +} + +void tst_qdeclarativetext::testQtQuick11Attributes_data() +{ + QTest::addColumn<QString>("code"); + QTest::addColumn<QString>("warning"); + QTest::addColumn<QString>("error"); + + QTest::newRow("maximumLineCount") << "maximumLineCount: 4" + << "QDeclarativeComponent: Component is not ready" + << ":1 \"Text.maximumLineCount\" is not available in QtQuick 1.0.\n"; + + QTest::newRow("truncated") << "property int foo: lineCount" + << "<Unknown File>:1: ReferenceError: Can't find variable: lineCount" + << ""; +} + QTEST_MAIN(tst_qdeclarativetext) #include "tst_qdeclarativetext.moc" diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 582b20f..cd1977a 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -129,6 +129,8 @@ private slots: void pastingRichText_QTBUG_14003(); void implicitSize_data(); void implicitSize(); + void testQtQuick11Attributes(); + void testQtQuick11Attributes_data(); private: void simulateKey(QDeclarativeView *, int key); @@ -1476,6 +1478,45 @@ void tst_qdeclarativetextedit::implicitSize() QVERIFY(textObject->height() == textObject->implicitHeight()); } +void tst_qdeclarativetextedit::testQtQuick11Attributes() +{ + QFETCH(QString, code); + QFETCH(QString, warning); + QFETCH(QString, error); + + QDeclarativeEngine engine; + QObject *obj; + + QDeclarativeComponent valid(&engine); + valid.setData("import QtQuick 1.1; Text { " + code.toUtf8() + " }", QUrl("")); + obj = valid.create(); + QVERIFY(obj); + QVERIFY(valid.errorString().isEmpty()); + delete obj; + + QDeclarativeComponent invalid(&engine); + invalid.setData("import QtQuick 1.0; Text { " + code.toUtf8() + " }", QUrl("")); + QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); + obj = invalid.create(); + QCOMPARE(invalid.errorString(), error); + delete obj; +} + +void tst_qdeclarativetextedit::testQtQuick11Attributes_data() +{ + QTest::addColumn<QString>("code"); + QTest::addColumn<QString>("warning"); + QTest::addColumn<QString>("error"); + + QTest::newRow("canPaste") << "property bool foo: canPaste" + << "<Unknown File>:1: ReferenceError: Can't find variable: canPaste" + << ""; + + QTest::newRow("lineCount") << "property int foo: lineCount" + << "<Unknown File>:1: ReferenceError: Can't find variable: lineCount" + << ""; +} + QTEST_MAIN(tst_qdeclarativetextedit) #include "tst_qdeclarativetextedit.moc" |