summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-11-04 04:46:11 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-11-04 04:46:11 (GMT)
commit3ba15a237e8d38e471026e4a0f49a411bd4ada41 (patch)
tree45bcc091b252f1c4a4fe5baae97983b2a5182c2f
parentedcdcc5a27ce853b03e91e328b5eb4764c92eda0 (diff)
parenta5e66c8c02db19a26fcb8378a1d61302ad2d2c5f (diff)
downloadQt-3ba15a237e8d38e471026e4a0f49a411bd4ada41.zip
Qt-3ba15a237e8d38e471026e4a0f49a411bd4ada41.tar.gz
Qt-3ba15a237e8d38e471026e4a0f49a411bd4ada41.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--examples/declarative/animations/color-animation.qml5
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp3
-rw-r--r--tests/auto/declarative/declarative.pro3
-rw-r--r--tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp257
-rw-r--r--tests/auto/declarative/qmlpixmapcache/data/exists.png (renamed from tests/auto/declarative/qfxpixmapcache/data/exists.png)bin2738 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qmlpixmapcache/data/exists1.png (renamed from tests/auto/declarative/qfxpixmapcache/data/exists1.png)bin2738 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qmlpixmapcache/data/exists2.png (renamed from tests/auto/declarative/qfxpixmapcache/data/exists2.png)bin2738 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qmlpixmapcache/qmlpixmapcache.pro (renamed from tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro)2
-rw-r--r--tests/auto/declarative/qmlpixmapcache/tst_qmlpixmapcache.cpp (renamed from tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp)40
-rw-r--r--tests/auto/declarative/qmlxmllistmodel/data/model.qml10
-rw-r--r--tests/auto/declarative/qmlxmllistmodel/data/model.xml56
-rw-r--r--tests/auto/declarative/qmlxmllistmodel/qmlxmllistmodel.pro7
-rw-r--r--tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp80
13 files changed, 405 insertions, 58 deletions
diff --git a/examples/declarative/animations/color-animation.qml b/examples/declarative/animations/color-animation.qml
index edb0659..54608c7 100644
--- a/examples/declarative/animations/color-animation.qml
+++ b/examples/declarative/animations/color-animation.qml
@@ -31,10 +31,7 @@ Item {
Item {
width: parent.width; height: 2 * parent.height
transformOrigin: Item.Center
- rotation: SequentialAnimation {
- running: true; repeat: true
- NumberAnimation { from: 0; to: 360; duration: 10000 }
- }
+ rotation: NumberAnimation { from: 0; to: 360; duration: 10000; running: true; repeat: true }
Image {
source: "images/sun.png"; y: 10; anchors.horizontalCenter: parent.horizontalCenter
transformOrigin: Item.Center; rotation: -3 * parent.rotation
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index 8385352..f340612 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -558,6 +558,9 @@ QmlAbstractBinding *QmlMetaProperty::binding() const
Ownership of \a newBinding transfers to QML. Ownership of the return value
is assumed by the caller.
+
+ \a flags is passed through to the binding and is used for the initial update (when
+ the binding sets the intial value, it will use these flags for the write).
*/
QmlAbstractBinding *
QmlMetaProperty::setBinding(QmlAbstractBinding *newBinding, QmlMetaProperty::WriteFlags flags) const
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 321e91b..f09d6cf 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -10,7 +10,7 @@ SUBDIRS += anchors \
numberformatter \
pathview \
qfxloader \
- qfxpixmapcache \
+ qmlpixmapcache \
qfxtextedit \
qfxtextinput \
qfxwebview \
@@ -28,6 +28,7 @@ SUBDIRS += anchors \
qmlmetatype \
qmlpropertymap \
qmltimer \
+ qmlxmllistmodel \
repeater \
sql \
states \
diff --git a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp
index 1a90575..3e86cab 100644
--- a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp
+++ b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp
@@ -43,6 +43,7 @@
#include <QtDeclarative/qmlengine.h>
#include <QtDeclarative/qmlcomponent.h>
#include <private/qmlgraphicstext_p.h>
+#include <private/qmlvaluetype_p.h>
#include <QFontMetrics>
class tst_qmlgraphicstext : public QObject
@@ -67,6 +68,15 @@ private slots:
void color();
void smooth();
+ // QmlFontValueType
+ void weight();
+ void underline();
+ void overline();
+ void strikeout();
+ void capitalization();
+ void letterSpacing();
+ void wordSpacing();
+
private:
QStringList standard;
QStringList richText;
@@ -88,54 +98,54 @@ private:
tst_qmlgraphicstext::tst_qmlgraphicstext()
{
standard << "the quick brown fox jumped over the lazy dog"
- << "the quick brown fox\n jumped over the lazy dog";
+ << "the quick brown fox\n jumped over the lazy dog";
richText << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a> jumped over the <b>lazy</b> dog</i>"
- << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a><br>jumped over the <b>lazy</b> dog</i>";
+ << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a><br>jumped over the <b>lazy</b> dog</i>";
horizontalAlignmentmentStrings << "AlignLeft"
- << "AlignRight"
- << "AlignHCenter";
+ << "AlignRight"
+ << "AlignHCenter";
verticalAlignmentmentStrings << "AlignTop"
- << "AlignBottom"
- << "AlignVCenter";
+ << "AlignBottom"
+ << "AlignVCenter";
horizontalAlignmentments << Qt::AlignLeft
- << Qt::AlignRight
- << Qt::AlignHCenter;
+ << Qt::AlignRight
+ << Qt::AlignHCenter;
verticalAlignmentments << Qt::AlignTop
- << Qt::AlignBottom
- << Qt::AlignVCenter;
+ << Qt::AlignBottom
+ << Qt::AlignVCenter;
styleStrings << "Normal"
- << "Outline"
- << "Raised"
- << "Sunken";
+ << "Outline"
+ << "Raised"
+ << "Sunken";
styles << QmlGraphicsText::Normal
- << QmlGraphicsText::Outline
- << QmlGraphicsText::Raised
- << QmlGraphicsText::Sunken;
+ << QmlGraphicsText::Outline
+ << QmlGraphicsText::Raised
+ << QmlGraphicsText::Sunken;
colorStrings << "aliceblue"
- << "antiquewhite"
- << "aqua"
- << "darkkhaki"
- << "darkolivegreen"
- << "dimgray"
- << "palevioletred"
- << "lightsteelblue"
- << "#000000"
- << "#AAAAAA"
- << "#FFFFFF"
- << "#2AC05F";
- //
- // need a different test to do alpha channel test
- // << "#AA0011DD"
- // << "#00F16B11";
- //
+ << "antiquewhite"
+ << "aqua"
+ << "darkkhaki"
+ << "darkolivegreen"
+ << "dimgray"
+ << "palevioletred"
+ << "lightsteelblue"
+ << "#000000"
+ << "#AAAAAA"
+ << "#FFFFFF"
+ << "#2AC05F";
+ //
+ // need a different test to do alpha channel test
+ // << "#AA0011DD"
+ // << "#00F16B11";
+ //
}
void tst_qmlgraphicstext::text()
@@ -353,6 +363,8 @@ void tst_qmlgraphicstext::verticalAlignment()
QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j));
}
}
@@ -365,6 +377,7 @@ void tst_qmlgraphicstext::verticalAlignment()
QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+ QVERIFY(textObject != 0);
QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j));
}
}
@@ -528,6 +541,186 @@ void tst_qmlgraphicstext::smooth()
}
}
+void tst_qmlgraphicstext::weight()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().weight(), (int)QmlFontValueType::Normal);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { font.weight: \"Bold\"; text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().weight(), (int)QmlFontValueType::Bold);
+ }
+}
+
+void tst_qmlgraphicstext::underline()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().underline(), false);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { font.underline: true; text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().underline(), true);
+ }
+}
+
+void tst_qmlgraphicstext::overline()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().overline(), false);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { font.overline: true; text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().overline(), true);
+ }
+}
+
+void tst_qmlgraphicstext::strikeout()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().strikeOut(), false);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { font.strikeout: true; text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().strikeOut(), true);
+ }
+}
+
+void tst_qmlgraphicstext::capitalization()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::MixedCase);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::AllUppercase);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::AllLowercase);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::SmallCaps);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::Capitalize);
+ }
+}
+
+void tst_qmlgraphicstext::letterSpacing()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().letterSpacing(), 0.0);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: -50 }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().letterSpacing(), -50.);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: 200 }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().letterSpacing(), 200.);
+ }
+}
+
+void tst_qmlgraphicstext::wordSpacing()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().wordSpacing(), 0.0);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: -50 }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().wordSpacing(), -50.);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: 200 }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().wordSpacing(), 200.);
+ }
+}
+
QTEST_MAIN(tst_qmlgraphicstext)
#include "tst_qmlgraphicstext.moc"
diff --git a/tests/auto/declarative/qfxpixmapcache/data/exists.png b/tests/auto/declarative/qmlpixmapcache/data/exists.png
index 399bd0b..399bd0b 100644
--- a/tests/auto/declarative/qfxpixmapcache/data/exists.png
+++ b/tests/auto/declarative/qmlpixmapcache/data/exists.png
Binary files differ
diff --git a/tests/auto/declarative/qfxpixmapcache/data/exists1.png b/tests/auto/declarative/qmlpixmapcache/data/exists1.png
index 399bd0b..399bd0b 100644
--- a/tests/auto/declarative/qfxpixmapcache/data/exists1.png
+++ b/tests/auto/declarative/qmlpixmapcache/data/exists1.png
Binary files differ
diff --git a/tests/auto/declarative/qfxpixmapcache/data/exists2.png b/tests/auto/declarative/qmlpixmapcache/data/exists2.png
index 399bd0b..399bd0b 100644
--- a/tests/auto/declarative/qfxpixmapcache/data/exists2.png
+++ b/tests/auto/declarative/qmlpixmapcache/data/exists2.png
Binary files differ
diff --git a/tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro b/tests/auto/declarative/qmlpixmapcache/qmlpixmapcache.pro
index 218eeff..423fa2f 100644
--- a/tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro
+++ b/tests/auto/declarative/qmlpixmapcache/qmlpixmapcache.pro
@@ -3,7 +3,7 @@ contains(QT_CONFIG,declarative): QT += declarative
QT += network
macx:CONFIG -= app_bundle
-SOURCES += tst_qfxpixmapcache.cpp
+SOURCES += tst_qmlpixmapcache.cpp
# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
# LIBS += -lgcov
diff --git a/tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp b/tests/auto/declarative/qmlpixmapcache/tst_qmlpixmapcache.cpp
index 88fbdab..88d9df5 100644
--- a/tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp
+++ b/tests/auto/declarative/qmlpixmapcache/tst_qmlpixmapcache.cpp
@@ -40,18 +40,18 @@
****************************************************************************/
#include <qtest.h>
#include <QtTest/QtTest>
-#include <private/qmlgraphicspixmapcache_p.h>
+#include <private/qmlpixmapcache_p.h>
#include <QtDeclarative/qmlengine.h>
#include <QNetworkReply>
// These don't let normal people run tests!
//#include "../network-settings.h"
-class tst_qfxpixmapcache : public QObject
+class tst_qmlpixmapcache : public QObject
{
Q_OBJECT
public:
- tst_qfxpixmapcache() :
+ tst_qmlpixmapcache() :
thisfile("file://" __FILE__)
{
}
@@ -97,9 +97,9 @@ static const bool localfile_optimized = true;
static const bool localfile_optimized = false;
#endif
-void tst_qfxpixmapcache::single_data()
+void tst_qmlpixmapcache::single_data()
{
- // Note, since QmlGraphicsPixmapCache is shared, tests affect each other!
+ // Note, since QmlPixmapCache is shared, tests affect each other!
// so use different files fore all test functions.
QTest::addColumn<QUrl>("target");
@@ -114,7 +114,7 @@ void tst_qfxpixmapcache::single_data()
QTest::newRow("remote") << QUrl("http://qt.nokia.com/thereisnologo.png") << false << false << true;
}
-void tst_qfxpixmapcache::single()
+void tst_qmlpixmapcache::single()
{
QFETCH(QUrl, target);
QFETCH(bool, incache);
@@ -130,7 +130,7 @@ void tst_qfxpixmapcache::single()
QPixmap pixmap;
QVERIFY(pixmap.width() <= 0); // Check Qt assumption
- QNetworkReply *reply= QmlGraphicsPixmapCache::get(&engine, target, &pixmap);
+ QNetworkReply *reply= QmlPixmapCache::get(&engine, target, &pixmap);
if (incache) {
QVERIFY(!reply);
@@ -148,20 +148,20 @@ void tst_qfxpixmapcache::single()
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(getter.gotslot);
if (exists) {
- QVERIFY(QmlGraphicsPixmapCache::find(target, &pixmap));
+ QVERIFY(QmlPixmapCache::find(target, &pixmap));
QVERIFY(pixmap.width() > 0);
} else {
- QVERIFY(!QmlGraphicsPixmapCache::find(target, &pixmap));
+ QVERIFY(!QmlPixmapCache::find(target, &pixmap));
QVERIFY(pixmap.width() <= 0);
}
}
- QCOMPARE(QmlGraphicsPixmapCache::pendingRequests(), 0);
+ QCOMPARE(QmlPixmapCache::pendingRequests(), 0);
}
-void tst_qfxpixmapcache::parallel_data()
+void tst_qmlpixmapcache::parallel_data()
{
- // Note, since QmlGraphicsPixmapCache is shared, tests affect each other!
+ // Note, since QmlPixmapCache is shared, tests affect each other!
// so use different files fore all test functions.
QTest::addColumn<QUrl>("target1");
@@ -211,7 +211,7 @@ void tst_qfxpixmapcache::parallel_data()
;
}
-void tst_qfxpixmapcache::parallel()
+void tst_qmlpixmapcache::parallel()
{
QFETCH(QUrl, target1);
QFETCH(QUrl, target2);
@@ -227,7 +227,7 @@ void tst_qfxpixmapcache::parallel()
for (int i=0; i<targets.count(); ++i) {
QUrl target = targets.at(i);
QPixmap pixmap;
- QNetworkReply *reply = QmlGraphicsPixmapCache::get(&engine, target, &pixmap);
+ QNetworkReply *reply = QmlPixmapCache::get(&engine, target, &pixmap);
replies.append(reply);
if (!reply) {
QVERIFY(pixmap.width() > 0);
@@ -240,10 +240,10 @@ void tst_qfxpixmapcache::parallel()
}
QCOMPARE(incache+slotters, targets.count());
- QCOMPARE(QmlGraphicsPixmapCache::pendingRequests(), requests);
+ QCOMPARE(QmlPixmapCache::pendingRequests(), requests);
if (cancel >= 0) {
- QmlGraphicsPixmapCache::cancelGet(targets.at(cancel), getters[cancel]);
+ QmlPixmapCache::cancelGet(targets.at(cancel), getters[cancel]);
slotters--;
}
@@ -260,16 +260,16 @@ void tst_qfxpixmapcache::parallel()
} else {
QVERIFY(getters[i]->gotslot);
QPixmap pixmap;
- QVERIFY(QmlGraphicsPixmapCache::find(targets[i], &pixmap));
+ QVERIFY(QmlPixmapCache::find(targets[i], &pixmap));
QVERIFY(pixmap.width() > 0);
}
delete getters[i];
}
}
- QCOMPARE(QmlGraphicsPixmapCache::pendingRequests(), 0);
+ QCOMPARE(QmlPixmapCache::pendingRequests(), 0);
}
-QTEST_MAIN(tst_qfxpixmapcache)
+QTEST_MAIN(tst_qmlpixmapcache)
-#include "tst_qfxpixmapcache.moc"
+#include "tst_qmlpixmapcache.moc"
diff --git a/tests/auto/declarative/qmlxmllistmodel/data/model.qml b/tests/auto/declarative/qmlxmllistmodel/data/model.qml
new file mode 100644
index 0000000..199a447
--- /dev/null
+++ b/tests/auto/declarative/qmlxmllistmodel/data/model.qml
@@ -0,0 +1,10 @@
+import Qt 4.6
+
+XmlListModel {
+ source: "model.xml"
+ query: "/ListModel/ListElement"
+ XmlRole { name: "name"; query: "name/string()" }
+ XmlRole { name: "type"; query: "type/string()" }
+ XmlRole { name: "age"; query: "age/number()" }
+ XmlRole { name: "size"; query: "size/string()" }
+}
diff --git a/tests/auto/declarative/qmlxmllistmodel/data/model.xml b/tests/auto/declarative/qmlxmllistmodel/data/model.xml
new file mode 100644
index 0000000..f1fe742
--- /dev/null
+++ b/tests/auto/declarative/qmlxmllistmodel/data/model.xml
@@ -0,0 +1,56 @@
+<ListModel>
+ <ListElement>
+ <name>Polly</name>
+ <type>Parrot</type>
+ <age>12</age>
+ <size>Small</size>
+ </ListElement>
+ <ListElement>
+ <name>Penny</name>
+ <type>Turtle</type>
+ <age>4</age>
+ <size>Small</size>
+ </ListElement>
+ <ListElement>
+ <name>Warren</name>
+ <type>Rabbit</type>
+ <age>2</age>
+ <size>Small</size>
+ </ListElement>
+ <ListElement>
+ <name>Spot</name>
+ <type>Dog</type>
+ <age>9</age>
+ <size>Medium</size>
+ </ListElement>
+ <ListElement>
+ <name>Whiskers</name>
+ <type>Cat</type>
+ <age>2</age>
+ <size>Medium</size>
+ </ListElement>
+ <ListElement>
+ <name>Joey</name>
+ <type>Kangaroo</type>
+ <age>1</age>
+ <size>Medium</size>
+ </ListElement>
+ <ListElement>
+ <name>Kimba</name>
+ <type>Bunny</type>
+ <age>65</age>
+ <size>Large</size>
+ </ListElement>
+ <ListElement>
+ <name>Rover</name>
+ <type>Dog</type>
+ <age>5</age>
+ <size>Large</size>
+ </ListElement>
+ <ListElement>
+ <name>Tiny</name>
+ <type>Elephant</type>
+ <age>15</age>
+ <size>Large</size>
+ </ListElement>
+</ListModel>
diff --git a/tests/auto/declarative/qmlxmllistmodel/qmlxmllistmodel.pro b/tests/auto/declarative/qmlxmllistmodel/qmlxmllistmodel.pro
new file mode 100644
index 0000000..462723e
--- /dev/null
+++ b/tests/auto/declarative/qmlxmllistmodel/qmlxmllistmodel.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative gui
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qmlxmllistmodel.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp b/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp
new file mode 100644
index 0000000..0fc9006
--- /dev/null
+++ b/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** 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 <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <private/qmlxmllistmodel_p.h>
+#include "../../../shared/util.h"
+
+class tst_qmlxmllistmodel : public QObject
+
+{
+ Q_OBJECT
+public:
+ tst_qmlxmllistmodel() {}
+
+private slots:
+ void buildModel();
+
+private:
+ QmlEngine engine;
+};
+
+void tst_qmlxmllistmodel::buildModel()
+{
+ QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/model.qml"));
+ QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create());
+ QVERIFY(listModel != 0);
+ QTRY_COMPARE(listModel->count(), 9);
+
+ QList<int> roles;
+ roles << Qt::UserRole << Qt::UserRole + 1 << Qt::UserRole + 2 << Qt::UserRole + 3;
+ QHash<int, QVariant> data = listModel->data(3, roles);
+ QVERIFY(data.count() == 4);
+ QCOMPARE(data.value(Qt::UserRole).toString(), QLatin1String("Spot"));
+ QCOMPARE(data.value(Qt::UserRole+1).toString(), QLatin1String("Dog"));
+ QCOMPARE(data.value(Qt::UserRole+2).toInt(), 9);
+ QCOMPARE(data.value(Qt::UserRole+3).toString(), QLatin1String("Medium"));
+}
+
+QTEST_MAIN(tst_qmlxmllistmodel)
+
+#include "tst_qmlxmllistmodel.moc"