aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qsgtext/tst_qsgtext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qsgtext/tst_qsgtext.cpp')
-rw-r--r--tests/auto/declarative/qsgtext/tst_qsgtext.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/auto/declarative/qsgtext/tst_qsgtext.cpp b/tests/auto/declarative/qsgtext/tst_qsgtext.cpp
index 7b04e76f01..5a27a69dec 100644
--- a/tests/auto/declarative/qsgtext/tst_qsgtext.cpp
+++ b/tests/auto/declarative/qsgtext/tst_qsgtext.cpp
@@ -321,14 +321,14 @@ void tst_qsgtext::width()
int documentWidth = document.idealWidth();
- QString componentStr = "import QtQuick 2.0\nText { text: \"" + richText.at(i) + "\" }";
+ QString componentStr = "import QtQuick 2.0\nText { text: \"" + richText.at(i) + "\"; textFormat: Text.RichText }";
QDeclarativeComponent textComponent(&engine);
textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QSGText *textObject = qobject_cast<QSGText*>(textComponent.create());
QVERIFY(textObject != 0);
QCOMPARE(textObject->width(), qreal(documentWidth));
- QVERIFY(textObject->textFormat() == QSGText::AutoText); // setting text doesn't change format
+ QVERIFY(textObject->textFormat() == QSGText::RichText);
delete textObject;
}
@@ -465,6 +465,24 @@ void tst_qsgtext::textFormat()
QVERIFY(textObject != 0);
QVERIFY(textObject->textFormat() == QSGText::RichText);
+ QSGTextPrivate *textPrivate = QSGTextPrivate::get(textObject);
+ QVERIFY(textPrivate != 0);
+ QVERIFY(textPrivate->richText == true);
+
+ delete textObject;
+ }
+ {
+ QDeclarativeComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\nText { text: \"<b>Hello</b>\" }", QUrl::fromLocalFile(""));
+ QSGText *textObject = qobject_cast<QSGText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QVERIFY(textObject->textFormat() == QSGText::AutoText);
+
+ QSGTextPrivate *textPrivate = QSGTextPrivate::get(textObject);
+ QVERIFY(textPrivate != 0);
+ QVERIFY(textPrivate->styledText == true);
+
delete textObject;
}
{