summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/regExp.qml7
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.h5
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp11
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/big.jpegbin0 -> 1700081 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/big256.pngbin0 -> 3566 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart.pngbin0 -> 12577 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart.svg55
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart200.pngbin0 -> 8063 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp64
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp27
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml4
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/validators.qml7
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp3
-rw-r--r--tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp43
14 files changed, 209 insertions, 17 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/regExp.qml b/tests/auto/declarative/qdeclarativeecmascript/data/regExp.qml
new file mode 100644
index 0000000..0dc404b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/regExp.qml
@@ -0,0 +1,7 @@
+import Qt.test 1.0
+
+MyQmlObject{
+ id: obj
+ objectName: "obj"
+ regExp: /[a-zA-z]/
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
index 72dc3bb..faad8b7 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
@@ -90,6 +90,7 @@ class MyQmlObject : public QObject
Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty NOTIFY objectChanged)
Q_PROPERTY(QDeclarativeListProperty<QObject> objectListProperty READ objectListProperty CONSTANT)
Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty)
+ Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp)
public:
MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {}
@@ -138,6 +139,9 @@ public:
void setResettableProperty(int v) { m_resetProperty = v; }
void resetProperty() { m_resetProperty = 13; }
+ QRegExp regExp() { return m_regExp; }
+ void setRegExp(const QRegExp &regExp) { m_regExp = regExp; }
+
signals:
void basicSignal();
void argumentSignal(int a, QString b, qreal c);
@@ -162,6 +166,7 @@ private:
QList<QObject *> m_objectQList;
int m_value;
int m_resetProperty;
+ QRegExp m_regExp;
};
QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES)
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 87d73a0..041fd4d 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -131,6 +131,7 @@ private slots:
void bug1();
void dynamicCreationCrash();
+ void regExpBug();
void callQtInvokables();
private:
@@ -1241,6 +1242,16 @@ void tst_qdeclarativeecmascript::dynamicCreationCrash()
QVERIFY(created == 0);
}
+//QTBUG-9367
+void tst_qdeclarativeecmascript::regExpBug()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("regExp.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+ QEXPECT_FAIL("", "QTBUG-9367", Continue);
+ QCOMPARE(object->regExp().pattern(), QLatin1String("[a-zA-z]"));
+}
+
void tst_qdeclarativeecmascript::callQtInvokables()
{
MyInvokableObject o;
diff --git a/tests/auto/declarative/qdeclarativeimage/data/big.jpeg b/tests/auto/declarative/qdeclarativeimage/data/big.jpeg
new file mode 100644
index 0000000..bed7bd6
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeimage/data/big.jpeg
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/data/big256.png b/tests/auto/declarative/qdeclarativeimage/data/big256.png
new file mode 100644
index 0000000..1dc1596
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeimage/data/big256.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart.png b/tests/auto/declarative/qdeclarativeimage/data/heart.png
new file mode 100644
index 0000000..372b224
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeimage/data/heart.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart.svg b/tests/auto/declarative/qdeclarativeimage/data/heart.svg
new file mode 100644
index 0000000..8c982cd
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeimage/data/heart.svg
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) --><svg viewBox="100 200 550 500" height="841.88976pt" id="svg1" inkscape:version="0.40+cvs" sodipodi:docbase="C:\Documents and Settings\Jon Phillips\My Documents\projects\clipart-project\submissions" sodipodi:docname="heart-left-highlight.svg" sodipodi:version="0.32" width="595.27559pt" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg">
+<metadata>
+<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+<cc:Work rdf:about="">
+<dc:title>Heart Left-Highlight</dc:title>
+<dc:description>This is a normal valentines day heart.</dc:description>
+<dc:subject>
+<rdf:Bag>
+<rdf:li>holiday</rdf:li>
+<rdf:li>valentines</rdf:li>
+<rdf:li></rdf:li>
+<rdf:li>valentine</rdf:li>
+<rdf:li>hash(0x8a091c0)</rdf:li>
+<rdf:li>hash(0x8a0916c)</rdf:li>
+<rdf:li>signs_and_symbols</rdf:li>
+<rdf:li>hash(0x8a091f0)</rdf:li>
+<rdf:li>day</rdf:li>
+</rdf:Bag>
+</dc:subject>
+<dc:publisher>
+<cc:Agent rdf:about="http://www.openclipart.org">
+<dc:title>Jon Phillips</dc:title>
+</cc:Agent>
+</dc:publisher>
+<dc:creator>
+<cc:Agent>
+<dc:title>Jon Phillips</dc:title>
+</cc:Agent>
+</dc:creator>
+<dc:rights>
+<cc:Agent>
+<dc:title>Jon Phillips</dc:title>
+</cc:Agent>
+</dc:rights>
+<dc:date></dc:date>
+<dc:format>image/svg+xml</dc:format>
+<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
+<dc:language>en</dc:language>
+</cc:Work>
+<cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
+<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
+<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
+<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
+</cc:License>
+</rdf:RDF>
+</metadata>
+<defs id="defs3"/>
+<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="549.40674" inkscape:cy="596.00159" inkscape:document-units="px" inkscape:guide-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="615" inkscape:window-width="866" inkscape:window-x="88" inkscape:window-y="116" inkscape:zoom="0.35000000" pagecolor="#ffffff" showguides="true"/>
+<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1">
+<path d="M 263.41570,235.14588 C 197.17570,235.14588 143.41575,288.90587 143.41575,355.14588 C 143.41575,489.90139 279.34890,525.23318 371.97820,658.45392 C 459.55244,526.05056 600.54070,485.59932 600.54070,355.14588 C 600.54070,288.90588 546.78080,235.14587 480.54070,235.14588 C 432.49280,235.14588 391.13910,263.51631 371.97820,304.33338 C 352.81740,263.51630 311.46370,235.14587 263.41570,235.14588 z " id="path7" sodipodi:nodetypes="ccccccc" style="fill:#e60000;fill-opacity:1.0000000;stroke:#000000;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/>
+<path d="M 265.00000,253.59375 C 207.04033,253.59375 160.00000,300.63407 160.00000,358.59375 C 160.00000,476.50415 278.91857,507.43251 359.96875,624.00000 C 366.52868,614.08205 220.00000,478.47309 220.00000,378.59375 C 220.00000,320.63407 267.04033,273.59375 325.00000,273.59375 C 325.50453,273.59375 325.99718,273.64912 326.50000,273.65625 C 309.22436,261.07286 288.00557,253.59374 265.00000,253.59375 z " id="path220" sodipodi:nodetypes="ccccccc" style="fill:#e6e6e6;fill-opacity:0.64556962;stroke:none;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/>
+</g>
+</svg>
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200.png b/tests/auto/declarative/qdeclarativeimage/data/heart200.png
new file mode 100644
index 0000000..786e75d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeimage/data/heart200.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
index ed2095b..9073750 100644
--- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
+++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
@@ -82,6 +82,8 @@ private slots:
void resized();
void smooth();
void pixmap();
+ void svg();
+ void big();
private:
QDeclarativeEngine engine;
@@ -111,24 +113,29 @@ void tst_qdeclarativeimage::noSource()
void tst_qdeclarativeimage::imageSource_data()
{
QTest::addColumn<QString>("source");
+ QTest::addColumn<qreal>("width");
+ QTest::addColumn<qreal>("height");
QTest::addColumn<bool>("remote");
QTest::addColumn<bool>("async");
QTest::addColumn<QString>("error");
- QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << false << false << "";
- QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << false << true << "";
- QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << false
+ QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << "";
+ QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << 120.0 << 120.0 << false << true << "";
+ QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << 0.0 << 0.0 << false
<< false << "Cannot open QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() + "\" ) ";
- QTest::newRow("local async not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() << false
+ QTest::newRow("local async not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() << 0.0 << 0.0 << false
<< true << "\"Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() + "\" ";
- QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << false << "";
- QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true << false
+ QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << "";
+ QTest::newRow("remote svg") << SERVER_ADDR "/heart.svg" << 550.0 << 500.0 << true << false << "";
+ QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << 0.0 << 0.0 << true << false
<< "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" ";
}
void tst_qdeclarativeimage::imageSource()
{
QFETCH(QString, source);
+ QFETCH(qreal, width);
+ QFETCH(qreal, height);
QFETCH(bool, remote);
QFETCH(bool, async);
QFETCH(QString, error);
@@ -156,8 +163,8 @@ void tst_qdeclarativeimage::imageSource()
if (error.isEmpty()) {
TRY_WAIT(obj->status() == QDeclarativeImage::Ready);
- QCOMPARE(obj->width(), 120.);
- QCOMPARE(obj->height(), 120.);
+ QCOMPARE(obj->width(), width);
+ QCOMPARE(obj->height(), height);
QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch);
QCOMPARE(obj->progress(), 1.0);
} else {
@@ -248,6 +255,47 @@ void tst_qdeclarativeimage::pixmap()
delete obj;
}
+void tst_qdeclarativeimage::svg()
+{
+ QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/heart.svg\"; sourceSize.width: 300; sourceSize.height: 300 }";
+ QDeclarativeComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->pixmap().width(), 300);
+ QCOMPARE(obj->pixmap().height(), 300);
+ QCOMPARE(obj->width(), 550.0);
+ QCOMPARE(obj->height(), 500.0);
+ QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png"));
+
+ obj->setSourceSize(QSize(200,200));
+
+ QCOMPARE(obj->pixmap().width(), 200);
+ QCOMPARE(obj->pixmap().height(), 200);
+ QCOMPARE(obj->width(), 550.0);
+ QCOMPARE(obj->height(), 500.0);
+ QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png"));
+
+ delete obj;
+}
+
+void tst_qdeclarativeimage::big()
+{
+ QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/big.jpeg\"; sourceSize.width: 256; sourceSize.height: 256 }";
+ QDeclarativeComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->pixmap().width(), 256);
+ QCOMPARE(obj->pixmap().height(), 256);
+ QCOMPARE(obj->width(), 10240.0);
+ QCOMPARE(obj->height(), 10240.0);
+ QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/big256.png"));
+
+ delete obj;
+}
+
+
QTEST_MAIN(tst_qdeclarativeimage)
#include "tst_qdeclarativeimage.moc"
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index 7665e18..46f3517 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -61,6 +61,8 @@ private slots:
void mapCoordinates();
void mapCoordinates_data();
void propertyChanges();
+ void transforms();
+ void transforms_data();
private:
template<typename T>
@@ -402,6 +404,31 @@ void tst_QDeclarativeItem::mapCoordinates_data()
QTest::newRow(QTest::toString(i)) << i << i;
}
+void tst_QDeclarativeItem::transforms_data()
+{
+ QTest::addColumn<QByteArray>("qml");
+ QTest::addColumn<QMatrix>("matrix");
+ QTest::newRow("translate") << QByteArray("Translate { x: 10; y: 20 }")
+ << QMatrix(1,0,0,1,10,20);
+ QTest::newRow("rotation") << QByteArray("Rotation { angle: 90 }")
+ << QMatrix(0,1,-1,0,0,0);
+ QTest::newRow("scale") << QByteArray("Scale { xScale: 1.5; yScale: -2 }")
+ << QMatrix(1.5,0,0,-2,0,0);
+ QTest::newRow("sequence") << QByteArray("[ Translate { x: 10; y: 20 }, Scale { xScale: 1.5; yScale: -2 } ]")
+ << QMatrix(1,0,0,1,10,20) * QMatrix(1.5,0,0,-2,0,0);
+}
+
+void tst_QDeclarativeItem::transforms()
+{
+ QFETCH(QByteArray, qml);
+ QFETCH(QMatrix, matrix);
+ QDeclarativeComponent component(&engine);
+ component.setData("import Qt 4.6\nItem { transform: "+qml+"}", QUrl::fromLocalFile(""));
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(item);
+ QCOMPARE(item->sceneMatrix(), matrix);
+}
+
void tst_QDeclarativeItem::propertyChanges()
{
QDeclarativeView *canvas = new QDeclarativeView(0);
diff --git a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml
index 1c1b3f8..cc64c3f 100644
--- a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml
+++ b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml
@@ -85,12 +85,10 @@ Rectangle {
}
color: ListView.isCurrentItem ? "lightsteelblue" : "white"
ListView.onRemove: SequentialAnimation {
- ScriptAction { script: console.log("Fix PropertyAction with attached properties") }
-/*
PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" }
PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false }
-*/
+
}
}
},
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/validators.qml b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml
index 0c81548..efe7570 100644
--- a/tests/auto/declarative/qdeclarativetextinput/data/validators.qml
+++ b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml
@@ -9,14 +9,13 @@ Item {
Column{
TextInput { id: intInput;
- validator: QIntValidator{top: 11; bottom: 2}
+ validator: IntValidator{top: 11; bottom: 2}
}
TextInput { id: dblInput;
- validator: QDoubleValidator{top: 12.12; bottom: 2.93; decimals: 2; notation: QDoubleValidator.StandardNotation}
+ validator: DoubleValidator{top: 12.12; bottom: 2.93; decimals: 2; notation: DoubleValidator.StandardNotation}
}
TextInput { id: strInput;
- //Requires QTBUG-8025 to be implemented first
- //validator: QRegExpValidator { regExp: /[a-zA-z]{2,4}/;}
+ validator: RegExpValidator { regExp: RegExp(/[a-zA-z]{2,4}/) }
}
}
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index e623df6..84e7182 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -463,7 +463,6 @@ void tst_qdeclarativetextinput::validators()
QVERIFY(strInput->hasFocus() == true);
QTest::keyPress(canvas, Qt::Key_1);
QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10);
- QEXPECT_FAIL("","Will not work until QTBUG-8025 is resolved", Abort);
QCOMPARE(strInput->text(), QLatin1String(""));
QCOMPARE(strInput->hasAcceptableInput(), false);
QTest::keyPress(canvas, Qt::Key_A);
@@ -677,7 +676,7 @@ void tst_qdeclarativetextinput::setHAlignClearCache()
view.show();
QApplication::setActiveWindow(&view);
QTest::qWaitForWindowShown(&view);
- QCOMPARE(input.nbPaint, 1);
+ QTRY_COMPARE(input.nbPaint, 1);
input.setHAlign(QDeclarativeTextInput::AlignRight);
QApplication::processEvents();
//Changing the alignment should trigger a repaint
diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
index 81cc922..e3aa5cc 100644
--- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
@@ -69,6 +69,8 @@ private slots:
void roles();
void roleErrors();
void uniqueRoleNames();
+ void status();
+ void data();
void reload();
void useKeys();
void useKeys_data();
@@ -247,6 +249,47 @@ void tst_qdeclarativexmllistmodel::uniqueRoleNames()
delete model;
}
+void tst_qdeclarativexmllistmodel::status()
+{
+ QDeclarativeXmlListModel *model;
+ model = new QDeclarativeXmlListModel;
+ QCOMPARE(model->status(), QDeclarativeXmlListModel::Null);
+
+ model->setXml("<data></data>");
+ QCOMPARE(model->status(), QDeclarativeXmlListModel::Ready);
+ delete model;
+
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
+ model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
+ QVERIFY(model != 0);
+ QCOMPARE(model->status(), QDeclarativeXmlListModel::Loading);
+
+ QTRY_COMPARE(model->count(), 9);
+ QCOMPARE(model->status(), QDeclarativeXmlListModel::Ready);
+
+ delete model;
+}
+
+void tst_qdeclarativexmllistmodel::data()
+{
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
+ QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
+ QVERIFY(model != 0);
+
+ QHash<int,QVariant> blank;
+ for (int i=0; i<model->roles().count(); i++)
+ blank.insert(model->roles()[i], QVariant());
+ for (int i=0; i<9; i++) {
+ QCOMPARE(model->data(i, model->roles()), blank);
+ for (int j=0; j<model->roles().count(); j++) {
+ QCOMPARE(model->data(i, j), QVariant());
+ }
+ }
+ QTRY_COMPARE(model->count(), 9);
+
+ delete model;
+}
+
void tst_qdeclarativexmllistmodel::reload()
{
// If no keys are used, the model should be rebuilt from scratch when