summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-11-05 04:47:57 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-11-05 04:47:57 (GMT)
commitf6caaf073408da5c85329fb4849e23f97621ea85 (patch)
tree8a460398e00eda896d4eabc34c40bb1e65f4ce95 /tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp
parent0ef5d89b540be963d1a8131f6625f990a4fe66e8 (diff)
parentd39ec85b7e5d8702c2888cdad4ccdae72531c199 (diff)
downloadQt-f6caaf073408da5c85329fb4849e23f97621ea85.zip
Qt-f6caaf073408da5c85329fb4849e23f97621ea85.tar.gz
Qt-f6caaf073408da5c85329fb4849e23f97621ea85.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp')
-rw-r--r--tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp
index 3e86cab..ba5c835 100644
--- a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp
+++ b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp
@@ -198,6 +198,8 @@ void tst_qmlgraphicstext::width()
for (int i = 0; i < standard.size(); i++)
{
+ QVERIFY(!Qt::mightBeRichText(standard.at(i))); // self-test
+
QFont f;
QFontMetrics fm(f);
int metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width();
@@ -208,11 +210,13 @@ void tst_qmlgraphicstext::width()
QVERIFY(textObject != 0);
QCOMPARE(textObject->width(), qreal(metricWidth));
- QVERIFY(textObject->textFormat() == QmlGraphicsText::PlainText);
+ QVERIFY(textObject->textFormat() == QmlGraphicsText::AutoText); // setting text doesn't change format
}
for (int i = 0; i < richText.size(); i++)
{
+ QVERIFY(Qt::mightBeRichText(richText.at(i))); // self-test
+
QTextDocument document;
document.setHtml(richText.at(i));
document.setDocumentMargin(0);
@@ -225,7 +229,7 @@ void tst_qmlgraphicstext::width()
QVERIFY(textObject != 0);
QCOMPARE(textObject->width(), qreal(documentWidth));
- QVERIFY(textObject->textFormat() == QmlGraphicsText::RichText);
+ QVERIFY(textObject->textFormat() == QmlGraphicsText::AutoText); // setting text doesn't change format
}
}
@@ -269,7 +273,7 @@ void tst_qmlgraphicstext::wrap()
void tst_qmlgraphicstext::elide()
{
- for (Qt::TextElideMode m = Qt::ElideLeft; m<=Qt::ElideNone; m=Qt::TextElideMode(int(m)+1)) {
+ for (QmlGraphicsText::TextElideMode m = QmlGraphicsText::ElideLeft; m<=QmlGraphicsText::ElideNone; m=QmlGraphicsText::TextElideMode(int(m)+1)) {
const char* elidename[]={"ElideLeft", "ElideRight", "ElideMiddle", "ElideNone"};
QString elide = "elide: Text." + QString(elidename[int(m)]) + ";";
@@ -279,6 +283,7 @@ void tst_qmlgraphicstext::elide()
QmlComponent textComponent(&engine, ("import Qt 4.6\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl("file://"));
QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+ QCOMPARE(textObject->elideMode(), m);
QCOMPARE(textObject->width(), 100.);
}
@@ -288,6 +293,7 @@ void tst_qmlgraphicstext::elide()
QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+ QCOMPARE(textObject->elideMode(), m);
QCOMPARE(textObject->width(), 100.);
}
@@ -298,6 +304,7 @@ void tst_qmlgraphicstext::elide()
QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+ QCOMPARE(textObject->elideMode(), m);
QCOMPARE(textObject->width(), 100.);
}
}