summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-09-09 05:44:58 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-09-09 05:44:58 (GMT)
commit543b7355a03a7010ec767dba3f538b96aacc4e89 (patch)
tree52e26058bf491ce8bd932a5af4c065a7ef53dbe2 /tests/auto
parent7688d668a2a8997d0bc6bac9094d8694e746391b (diff)
downloadQt-543b7355a03a7010ec767dba3f538b96aacc4e89.zip
Qt-543b7355a03a7010ec767dba3f538b96aacc4e89.tar.gz
Qt-543b7355a03a7010ec767dba3f538b96aacc4e89.tar.bz2
Fix more autotests
You can now expect autotests to pass (as much as the rest of Qt) Tests updated: NumberFormatter PathView QBindableMap QFxText QFxTextEdit (still fails) Repeater
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/numberformatter/tst_numberformatter.cpp15
-rw-r--r--tests/auto/declarative/pathview/data/pathview.qml10
-rw-r--r--tests/auto/declarative/pathview/tst_pathview.cpp8
-rw-r--r--tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp4
-rw-r--r--tests/auto/declarative/qfxtext/tst_qfxtext.cpp160
-rw-r--r--tests/auto/declarative/qfxtextedit/data/cursorTest.qml6
-rw-r--r--tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp64
-rw-r--r--tests/auto/declarative/repeater/data/repeater.qml6
-rw-r--r--tests/auto/declarative/repeater/tst_repeater.cpp22
9 files changed, 156 insertions, 139 deletions
diff --git a/tests/auto/declarative/numberformatter/tst_numberformatter.cpp b/tests/auto/declarative/numberformatter/tst_numberformatter.cpp
index 9a2f4f3..78ec347 100644
--- a/tests/auto/declarative/numberformatter/tst_numberformatter.cpp
+++ b/tests/auto/declarative/numberformatter/tst_numberformatter.cpp
@@ -166,11 +166,15 @@ void tst_numberformat::number()
QFETCH(QString, string);
QFETCH(float, number);
- QString componentStr = QString("NumberFormatter { number: \"") + string + QString("\" }");
+ QString componentStr = QString("import Qt 4.6\nNumberFormatter { number: \"") + string + QString("\" }");
QmlEngine engine;
- QmlComponent formatterComponent(&engine, componentStr.toAscii());
+ QmlComponent formatterComponent(&engine, componentStr.toAscii(), QUrl("file://"));
+ if(formatterComponent.isError())
+ qDebug() << formatterComponent.errors();
+ QVERIFY(formatterComponent.isReady());
QmlNumberFormatter *formatter = qobject_cast<QmlNumberFormatter*>(formatterComponent.create());
+ QVERIFY(formatterComponent.isReady());
QVERIFY(formatter != 0);
QCOMPARE((float)formatter->number(), number);
//qDebug() << formatter->format() << formatter->text();
@@ -201,10 +205,13 @@ void tst_numberformat::text()
QFETCH(QString, format);
QFETCH(QString, text);
- QString componentStr = QString("NumberFormatter { number: \"") + string + QString("\"; format: \"") + format + QString("\" }");
+ QString componentStr = QString("import Qt 4.6\nNumberFormatter { number: \"") + string + QString("\"; format: \"") + format + QString("\" }");
QmlEngine engine;
- QmlComponent formatterComponent(&engine, componentStr.toAscii());
+ QmlComponent formatterComponent(&engine, componentStr.toAscii(), QUrl("file://"));
+ if(formatterComponent.isError())
+ qDebug() << formatterComponent.errors();
+ QVERIFY(formatterComponent.isReady());
QmlNumberFormatter *formatter = qobject_cast<QmlNumberFormatter*>(formatterComponent.create());
QVERIFY(formatter != 0);
diff --git a/tests/auto/declarative/pathview/data/pathview.qml b/tests/auto/declarative/pathview/data/pathview.qml
index 7040e4c..be5673c 100644
--- a/tests/auto/declarative/pathview/data/pathview.qml
+++ b/tests/auto/declarative/pathview/data/pathview.qml
@@ -1,14 +1,15 @@
import Qt 4.6
-Rect {
+Rectangle {
width: 240
height: 320
color: "#ffffff"
resources: [
Component {
id: Delegate
- Rect {
+ Rectangle {
id: wrapper
+ objectName: "wrapper"
height: 20
width: 60
color: "white"
@@ -19,11 +20,13 @@ Rect {
Text {
x: 20
id: textName
+ objectName: "textName"
text: name
}
Text {
x: 40
id: textNumber
+ objectName: "textNumber"
text: number
}
}
@@ -31,11 +34,12 @@ Rect {
]
PathView {
id: view
+ objectName: "view"
width: 240
height: 320
model: testModel
delegate: Delegate
- snapPos: 0.01
+ snapPosition: 0.01
path: Path {
startY: 120
startX: 160
diff --git a/tests/auto/declarative/pathview/tst_pathview.cpp b/tests/auto/declarative/pathview/tst_pathview.cpp
index 9cae961..2933323 100644
--- a/tests/auto/declarative/pathview/tst_pathview.cpp
+++ b/tests/auto/declarative/pathview/tst_pathview.cpp
@@ -117,7 +117,7 @@ void tst_QFxPathView::items()
QFxPathView *pathview = findItem<QFxPathView>(canvas->root(), "view");
QVERIFY(pathview != 0);
- QCOMPARE(pathview->children()->count(), model.count()); // assumes all are visible
+ QCOMPARE(pathview->childItems().count(), model.count()); // assumes all are visible
for (int i = 0; i < model.count(); ++i) {
QFxText *name = findItem<QFxText>(pathview, "textName", i);
@@ -234,8 +234,10 @@ template<typename T>
T *tst_QFxPathView::findItem(QFxItem *parent, const QString &objectName, int index)
{
const QMetaObject &mo = T::staticMetaObject;
- for (int i = 0; i < parent->children()->count(); ++i) {
- QFxItem *item = parent->children()->at(i);
+ for (int i = 0; i < parent->children().count(); ++i) {
+ QFxItem *item = qobject_cast<QFxItem*>(parent->children().at(i));
+ if(!item)
+ continue;
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
QmlExpression e(qmlContext(item), "index", item);
diff --git a/tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp b/tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp
index a8046e6..c9c37ab 100644
--- a/tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp
+++ b/tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp
@@ -59,7 +59,9 @@ void tst_QBindableMap::changed()
QmlEngine engine;
QmlContext *ctxt = engine.rootContext();
ctxt->setContextProperty(QLatin1String("data"), &map);
- QmlComponent component(&engine, "Script { script: \"data.key1 = 'Hello World';\" }");
+ QmlComponent component(&engine, "import Qt 4.6\nScript { script: \"data.key1 = 'Hello World';\" }",
+ QUrl("file://"));
+ QVERIFY(component.isReady());
component.create();
QCOMPARE(spy.count(), 1);
QList<QVariant> arguments = spy.takeFirst();
diff --git a/tests/auto/declarative/qfxtext/tst_qfxtext.cpp b/tests/auto/declarative/qfxtext/tst_qfxtext.cpp
index 0eb9f97..cae85a4 100644
--- a/tests/auto/declarative/qfxtext/tst_qfxtext.cpp
+++ b/tests/auto/declarative/qfxtext/tst_qfxtext.cpp
@@ -19,8 +19,8 @@ private slots:
void elide();
// ### these tests may be trivial
- void hAlign();
- void vAlign();
+ void horizontalAlignment();
+ void verticalAlignment();
void font();
void style();
void color();
@@ -29,11 +29,11 @@ private:
QStringList standard;
QStringList richText;
- QStringList hAlignmentStrings;
- QStringList vAlignmentStrings;
+ QStringList horizontalAlignmentmentStrings;
+ QStringList verticalAlignmentmentStrings;
- QList<Qt::Alignment> vAlignments;
- QList<Qt::Alignment> hAlignments;
+ QList<Qt::Alignment> verticalAlignmentments;
+ QList<Qt::Alignment> horizontalAlignmentments;
QStringList styleStrings;
QList<QFxText::TextStyle> styles;
@@ -51,19 +51,19 @@ tst_qfxtext::tst_qfxtext()
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>";
- hAlignmentStrings << "AlignLeft"
+ horizontalAlignmentmentStrings << "AlignLeft"
<< "AlignRight"
<< "AlignHCenter";
- vAlignmentStrings << "AlignTop"
+ verticalAlignmentmentStrings << "AlignTop"
<< "AlignBottom"
<< "AlignVCenter";
- hAlignments << Qt::AlignLeft
+ horizontalAlignmentments << Qt::AlignLeft
<< Qt::AlignRight
<< Qt::AlignHCenter;
- vAlignments << Qt::AlignTop
+ verticalAlignmentments << Qt::AlignTop
<< Qt::AlignBottom
<< Qt::AlignVCenter;
@@ -99,7 +99,7 @@ tst_qfxtext::tst_qfxtext()
void tst_qfxtext::text()
{
{
- QmlComponent textComponent(&engine, "Text { text: \"\" }");
+ QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\" }", QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QVERIFY(textObject != 0);
@@ -108,8 +108,8 @@ void tst_qfxtext::text()
for (int i = 0; i < standard.size(); i++)
{
- QString componentStr = "Text { text: \"" + standard.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QVERIFY(textObject != 0);
@@ -118,8 +118,8 @@ void tst_qfxtext::text()
for (int i = 0; i < richText.size(); i++)
{
- QString componentStr = "Text { text: \"" + richText.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QVERIFY(textObject != 0);
@@ -132,7 +132,7 @@ void tst_qfxtext::width()
{
// uses Font metrics to find the width for standard and document to find the width for rich
{
- QmlComponent textComponent(&engine, "Text { text: \"\" }");
+ QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\" }", QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 0.);
@@ -144,8 +144,8 @@ void tst_qfxtext::width()
QFontMetrics fm(f);
int metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width();
- QString componentStr = "Text { text: \"" + standard.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), qreal(metricWidth));
@@ -159,8 +159,8 @@ void tst_qfxtext::width()
int documentWidth = document.idealWidth();
- QString componentStr = "Text { text: \"" + richText.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), qreal(documentWidth));
@@ -173,7 +173,7 @@ void tst_qfxtext::wrap()
// for specified width and wrap set true
{
- QmlComponent textComponent(&engine, "Text { text: \"\"; wrap: true; width: 300 }");
+ QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\"; wrap: true; width: 300 }", QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 300.);
@@ -181,8 +181,8 @@ void tst_qfxtext::wrap()
for (int i = 0; i < standard.size(); i++)
{
- QString componentStr = "Text { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 300.);
@@ -190,8 +190,8 @@ void tst_qfxtext::wrap()
for (int i = 0; i < richText.size(); i++)
{
- QString componentStr = "Text { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 300.);
@@ -208,7 +208,7 @@ void tst_qfxtext::elide()
// XXX Poor coverage.
{
- QmlComponent textComponent(&engine, ("Text { text: \"\"; "+elide+" width: 300 }").toLatin1());
+ QmlComponent textComponent(&engine, ("import Qt 4.6\nText { text: \"\"; "+elide+" width: 300 }").toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 300.);
@@ -216,8 +216,8 @@ void tst_qfxtext::elide()
for (int i = 0; i < standard.size(); i++)
{
- QString componentStr = "Text { "+elide+" width: 300; text: \"" + standard.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { "+elide+" width: 300; text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 300.);
@@ -226,8 +226,8 @@ void tst_qfxtext::elide()
// richtext - does nothing
for (int i = 0; i < richText.size(); i++)
{
- QString componentStr = "Text { "+elide+" width: 300; text: \"" + richText.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { "+elide+" width: 300; text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->width(), 300.);
@@ -236,61 +236,61 @@ void tst_qfxtext::elide()
}
//the alignment tests may be trivial o.oa
-void tst_qfxtext::hAlign()
+void tst_qfxtext::horizontalAlignment()
{
//test one align each, and then test if two align fails.
for (int i = 0; i < standard.size(); i++)
{
- for (int j=0; j < hAlignmentStrings.size(); j++)
+ for (int j=0; j < horizontalAlignmentmentStrings.size(); j++)
{
- QString componentStr = "Text { hAlign: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE((int)textObject->hAlign(), (int)hAlignments.at(j));
+ QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j));
}
}
for (int i = 0; i < richText.size(); i++)
{
- for (int j=0; j < hAlignmentStrings.size(); j++)
+ for (int j=0; j < horizontalAlignmentmentStrings.size(); j++)
{
- QString componentStr = "Text { hAlign: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE((int)textObject->hAlign(), (int)hAlignments.at(j));
+ QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j));
}
}
}
-void tst_qfxtext::vAlign()
+void tst_qfxtext::verticalAlignment()
{
//test one align each, and then test if two align fails.
for (int i = 0; i < standard.size(); i++)
{
- for (int j=0; j < vAlignmentStrings.size(); j++)
+ for (int j=0; j < verticalAlignmentmentStrings.size(); j++)
{
- QString componentStr = "Text { vAlign: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE((int)textObject->vAlign(), (int)vAlignments.at(j));
+ QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j));
}
}
for (int i = 0; i < richText.size(); i++)
{
- for (int j=0; j < vAlignmentStrings.size(); j++)
+ for (int j=0; j < verticalAlignmentmentStrings.size(); j++)
{
- QString componentStr = "Text { vAlign: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE((int)textObject->vAlign(), (int)vAlignments.at(j));
+ QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j));
}
}
@@ -300,49 +300,49 @@ void tst_qfxtext::font()
{
//test size, then bold, then italic, then family
{
- QString componentStr = "Text { font.size: 40; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { font.pointSize: 40; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE(textObject->font()->size(), qreal(40));
- QCOMPARE(textObject->font()->bold(), false);
- QCOMPARE(textObject->font()->italic(), false);
+ QCOMPARE(textObject->font().pointSize(), 40);
+ QCOMPARE(textObject->font().bold(), false);
+ QCOMPARE(textObject->font().italic(), false);
}
{
- QString componentStr = "Text { font.bold: true; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { font.bold: true; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE(textObject->font()->bold(), true);
- QCOMPARE(textObject->font()->italic(), false);
+ QCOMPARE(textObject->font().bold(), true);
+ QCOMPARE(textObject->font().italic(), false);
}
{
- QString componentStr = "Text { font.italic: true; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { font.italic: true; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE(textObject->font()->italic(), true);
- QCOMPARE(textObject->font()->bold(), false);
+ QCOMPARE(textObject->font().italic(), true);
+ QCOMPARE(textObject->font().bold(), false);
}
-
+
{
- QString componentStr = "Text { font.family: \"Helvetica\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { font.family: \"Helvetica\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE(textObject->font()->family(), QString("Helvetica"));
- QCOMPARE(textObject->font()->bold(), false);
- QCOMPARE(textObject->font()->italic(), false);
+ QCOMPARE(textObject->font().family(), QString("Helvetica"));
+ QCOMPARE(textObject->font().bold(), false);
+ QCOMPARE(textObject->font().italic(), false);
}
{
- QString componentStr = "Text { font.family: \"\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { font.family: \"\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
- QCOMPARE(textObject->font()->family(), QString(""));
+ QCOMPARE(textObject->font().family(), QString(""));
}
}
@@ -351,8 +351,8 @@ void tst_qfxtext::style()
//test style
for (int i = 0; i < styles.size(); i++)
{
- QString componentStr = "Text { style: \"" + styleStrings.at(i) + "\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { style: \"" + styleStrings.at(i) + "\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE((int)textObject->style(), (int)styles.at(i));
@@ -365,8 +365,8 @@ void tst_qfxtext::color()
//test style
for (int i = 0; i < colorStrings.size(); i++)
{
- QString componentStr = "Text { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->color(), QColor(colorStrings.at(i)));
@@ -375,8 +375,8 @@ void tst_qfxtext::color()
for (int i = 0; i < colorStrings.size(); i++)
{
- QString componentStr = "Text { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->styleColor(), QColor(colorStrings.at(i)));
@@ -388,8 +388,8 @@ void tst_qfxtext::color()
{
for (int j = 0; j < colorStrings.size(); j++)
{
- QString componentStr = "Text { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->color(), QColor(colorStrings.at(i)));
@@ -401,8 +401,8 @@ void tst_qfxtext::color()
QColor testColor("#001234");
testColor.setAlpha(170);
- QString componentStr = "Text { color: \"" + colorStr + "\"; text: \"Hello World\" }";
- QmlComponent textComponent(&engine, componentStr.toLatin1());
+ QString componentStr = "import Qt 4.6\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
QCOMPARE(textObject->color(), testColor);
diff --git a/tests/auto/declarative/qfxtextedit/data/cursorTest.qml b/tests/auto/declarative/qfxtextedit/data/cursorTest.qml
index 25e53d0..e5df8f1 100644
--- a/tests/auto/declarative/qfxtextedit/data/cursorTest.qml
+++ b/tests/auto/declarative/qfxtextedit/data/cursorTest.qml
@@ -1,8 +1,8 @@
import Qt 4.6
-Rect { width: 300; height: 300; color: "white"
- TextEdit { text: "Hello world!"; focusable: true; id: textEditObject
- resources: [ Component { id:cursor; Item { id:cursorInstance } } ]
+Rectangle { width: 300; height: 300; color: "white"
+ TextEdit { text: "Hello world!"; id: textEditObject; objectName: "textEditObject"
+ resources: [ Component { id:cursor; Item { id:cursorInstance; objectName: "cursorInstance" } } ]
cursorDelegate: cursor
}
}
diff --git a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
index 241dbad..c4fc506 100644
--- a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
+++ b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
@@ -89,7 +89,7 @@ tst_qfxtextedit::tst_qfxtextedit()
void tst_qfxtextedit::text()
{
{
- QmlComponent texteditComponent(&engine, "TextEdit { text: \"\" }", QUrl());
+ QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\" }", QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
@@ -98,7 +98,7 @@ void tst_qfxtextedit::text()
for (int i = 0; i < standard.size(); i++)
{
- QString componentStr = "TextEdit { text: \"" + standard.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -108,7 +108,7 @@ void tst_qfxtextedit::text()
for (int i = 0; i < richText.size(); i++)
{
- QString componentStr = "TextEdit { text: \"" + richText.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -126,7 +126,7 @@ void tst_qfxtextedit::width()
{
// uses Font metrics to find the width for standard and document to find the width for rich
{
- QmlComponent texteditComponent(&engine, "TextEdit { text: \"\" }", QUrl());
+ QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\" }", QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
@@ -139,7 +139,7 @@ void tst_qfxtextedit::width()
QFontMetrics fm(f);
int metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width();
- QString componentStr = "TextEdit { text: \"" + standard.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -155,7 +155,7 @@ void tst_qfxtextedit::width()
int documentWidth = document.idealWidth();
- QString componentStr = "TextEdit { text: \"" + richText.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -168,7 +168,7 @@ void tst_qfxtextedit::wrap()
{
// for specified width and wrap set true
{
- QmlComponent texteditComponent(&engine, "TextEdit { text: \"\"; wrap: true; width: 300 }", QUrl());
+ QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\"; wrap: true; width: 300 }", QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
@@ -177,7 +177,7 @@ void tst_qfxtextedit::wrap()
for (int i = 0; i < standard.size(); i++)
{
- QString componentStr = "TextEdit { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -187,7 +187,7 @@ void tst_qfxtextedit::wrap()
for (int i = 0; i < richText.size(); i++)
{
- QString componentStr = "TextEdit { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -206,7 +206,7 @@ void tst_qfxtextedit::hAlign()
{
for (int j=0; j < hAlignmentStrings.size(); j++)
{
- QString componentStr = "TextEdit { hAlign: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -219,7 +219,7 @@ void tst_qfxtextedit::hAlign()
{
for (int j=0; j < hAlignmentStrings.size(); j++)
{
- QString componentStr = "TextEdit { hAlign: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -238,7 +238,7 @@ void tst_qfxtextedit::vAlign()
{
for (int j=0; j < vAlignmentStrings.size(); j++)
{
- QString componentStr = "TextEdit { vAlign: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -251,7 +251,7 @@ void tst_qfxtextedit::vAlign()
{
for (int j=0; j < vAlignmentStrings.size(); j++)
{
- QString componentStr = "TextEdit { vAlign: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -266,54 +266,54 @@ void tst_qfxtextedit::font()
{
//test size, then bold, then italic, then family
{
- QString componentStr = "TextEdit { font.size: 40; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { font.pointSize: 40; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->font()->size(), qreal(40));
- QCOMPARE(textEditObject->font()->bold(), false);
- QCOMPARE(textEditObject->font()->italic(), false);
+ QCOMPARE(textEditObject->font().pointSize(), 40);
+ QCOMPARE(textEditObject->font().bold(), false);
+ QCOMPARE(textEditObject->font().italic(), false);
}
{
- QString componentStr = "TextEdit { font.bold: true; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { font.bold: true; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->font()->bold(), true);
- QCOMPARE(textEditObject->font()->italic(), false);
+ QCOMPARE(textEditObject->font().bold(), true);
+ QCOMPARE(textEditObject->font().italic(), false);
}
{
- QString componentStr = "TextEdit { font.italic: true; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { font.italic: true; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->font()->italic(), true);
- QCOMPARE(textEditObject->font()->bold(), false);
+ QCOMPARE(textEditObject->font().italic(), true);
+ QCOMPARE(textEditObject->font().bold(), false);
}
{
- QString componentStr = "TextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->font()->family(), QString("Helvetica"));
- QCOMPARE(textEditObject->font()->bold(), false);
- QCOMPARE(textEditObject->font()->italic(), false);
+ QCOMPARE(textEditObject->font().family(), QString("Helvetica"));
+ QCOMPARE(textEditObject->font().bold(), false);
+ QCOMPARE(textEditObject->font().italic(), false);
}
{
- QString componentStr = "TextEdit { font.family: \"\"; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"\"; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->font()->family(), QString(""));
+ QCOMPARE(textEditObject->font().family(), QString(""));
}
}
@@ -322,7 +322,7 @@ void tst_qfxtextedit::color()
//test style
for (int i = 0; i < colorStrings.size(); i++)
{
- QString componentStr = "TextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
//qDebug() << "textEditObject: " << textEditObject->color() << "vs. " << QColor(colorStrings.at(i));
@@ -335,7 +335,7 @@ void tst_qfxtextedit::color()
QColor testColor("#001234");
testColor.setAlpha(170);
- QString componentStr = "TextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }";
+ QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
@@ -347,7 +347,7 @@ void tst_qfxtextedit::color()
void tst_qfxtextedit::selection()
{
QString testStr = standard[0];//TODO: What should happen for multiline/rich text?
- QString componentStr = "TextEdit { text: \""+ testStr +"\"; }";
+ QString componentStr = "import Qt 4.6\nTextEdit { text: \""+ testStr +"\"; }";
QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
diff --git a/tests/auto/declarative/repeater/data/repeater.qml b/tests/auto/declarative/repeater/data/repeater.qml
index 57b1183..57ba9dc 100644
--- a/tests/auto/declarative/repeater/data/repeater.qml
+++ b/tests/auto/declarative/repeater/data/repeater.qml
@@ -1,15 +1,17 @@
import Qt 4.6
-Rect {
+Rectangle {
id: container
+ objectName: "container"
width: 240
height: 320
color: "white"
Repeater {
id: repeater
+ objectName: "repeater"
width: 240
height: 320
- dataSource: testData
+ model: testData
Component {
Text {
y: index*20
diff --git a/tests/auto/declarative/repeater/tst_repeater.cpp b/tests/auto/declarative/repeater/tst_repeater.cpp
index 0e7c187..08f9154 100644
--- a/tests/auto/declarative/repeater/tst_repeater.cpp
+++ b/tests/auto/declarative/repeater/tst_repeater.cpp
@@ -17,7 +17,7 @@ private slots:
private:
QFxView *createView(const QString &filename);
template<typename T>
- T *findItem(QFxItem *parent, const QString &id);
+ T *findItem(QObject *parent, const QString &id);
};
tst_QFxRepeater::tst_QFxRepeater()
@@ -26,7 +26,7 @@ tst_QFxRepeater::tst_QFxRepeater()
void tst_QFxRepeater::stringList()
{
- QFxView *canvas = createView(SRCDIR "/data/repeater.xml");
+ QFxView *canvas = createView(SRCDIR "/data/repeater.qml");
QStringList data;
data << "One";
@@ -35,7 +35,7 @@ void tst_QFxRepeater::stringList()
data << "Four";
QmlContext *ctxt = canvas->rootContext();
- ctxt->setProperty("testData", data);
+ ctxt->setContextProperty("testData", data);
canvas->execute();
qApp->processEvents();
@@ -46,10 +46,10 @@ void tst_QFxRepeater::stringList()
QFxItem *container = findItem<QFxItem>(canvas->root(), "container");
QVERIFY(container != 0);
- QCOMPARE(container->children()->count(), data.count() + 1);
+ QCOMPARE(container->childItems().count(), data.count() + 1);
- for (int i = 1; i < container->children()->count(); ++i) {
- QFxText *name = qobject_cast<QFxText*>(container->children()->at(i));
+ for (int i = 1; i < container->childItems().count(); ++i) {
+ QFxText *name = qobject_cast<QFxText*>(container->childItems().at(i));
QVERIFY(name != 0);
QCOMPARE(name->text(), data.at(i-1));
}
@@ -65,20 +65,20 @@ QFxView *tst_QFxRepeater::createView(const QString &filename)
QFile file(filename);
file.open(QFile::ReadOnly);
- QString xml = file.readAll();
- canvas->setQml(xml, filename);
+ QString qml = file.readAll();
+ canvas->setQml(qml, filename);
return canvas;
}
template<typename T>
-T *tst_QFxRepeater::findItem(QFxItem *parent, const QString &objectName)
+T *tst_QFxRepeater::findItem(QObject *parent, const QString &objectName)
{
const QMetaObject &mo = T::staticMetaObject;
if (mo.cast(parent) && (objectName.isEmpty() || parent->objectName() == objectName))
return static_cast<T*>(parent);
- for (int i = 0; i < parent->children()->count(); ++i) {
- QFxItem *item = findItem<T>(parent->children()->at(i), objectName);
+ for (int i = 0; i < parent->children().count(); ++i) {
+ QFxItem *item = findItem<T>(parent->children().at(i), objectName);
if (item)
return static_cast<T*>(item);
}