aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2011-09-30 13:55:07 +1000
committerQt by Nokia <qt-info@nokia.com>2011-09-30 10:37:05 +0200
commit3fff5e654e1b39844deae43cf5b211c2f196227f (patch)
tree45b70e244ac2da27f4456e2112f506a6e492be64 /tests
parent270f4a7d6421b134b26b1aa10e6604b38689d638 (diff)
Text format AutoText should use StyledText instead of RichText.
Task-number: QTBUG-21723 Change-Id: Ife213be95985ad1022e2f60241e69ecd9f467caf Reviewed-on: http://codereview.qt-project.org/5825 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qsgtext/data/embeddedImagesLocal.qml1
-rw-r--r--tests/auto/declarative/qsgtext/data/embeddedImagesLocalError.qml1
-rw-r--r--tests/auto/declarative/qsgtext/data/embeddedImagesRemote.qml1
-rw-r--r--tests/auto/declarative/qsgtext/data/embeddedImagesRemoteError.qml1
-rw-r--r--tests/auto/declarative/qsgtext/tst_qsgtext.cpp22
5 files changed, 24 insertions, 2 deletions
diff --git a/tests/auto/declarative/qsgtext/data/embeddedImagesLocal.qml b/tests/auto/declarative/qsgtext/data/embeddedImagesLocal.qml
index d71e9bb5bf..74b2ab817a 100644
--- a/tests/auto/declarative/qsgtext/data/embeddedImagesLocal.qml
+++ b/tests/auto/declarative/qsgtext/data/embeddedImagesLocal.qml
@@ -1,5 +1,6 @@
import QtQuick 2.0
Text {
+ textFormat: Text.RichText
text: "<img src='http/exists.png'>"
}
diff --git a/tests/auto/declarative/qsgtext/data/embeddedImagesLocalError.qml b/tests/auto/declarative/qsgtext/data/embeddedImagesLocalError.qml
index e6719481db..a2f7e0c89f 100644
--- a/tests/auto/declarative/qsgtext/data/embeddedImagesLocalError.qml
+++ b/tests/auto/declarative/qsgtext/data/embeddedImagesLocalError.qml
@@ -1,5 +1,6 @@
import QtQuick 2.0
Text {
+ textFormat: Text.RichText
text: "<img src='http/notexists.png'>"
}
diff --git a/tests/auto/declarative/qsgtext/data/embeddedImagesRemote.qml b/tests/auto/declarative/qsgtext/data/embeddedImagesRemote.qml
index e524d028b5..702633c538 100644
--- a/tests/auto/declarative/qsgtext/data/embeddedImagesRemote.qml
+++ b/tests/auto/declarative/qsgtext/data/embeddedImagesRemote.qml
@@ -1,5 +1,6 @@
import QtQuick 2.0
Text {
+ textFormat: Text.RichText
text: "<img src='http://127.0.0.1:14453/exists.png'>"
}
diff --git a/tests/auto/declarative/qsgtext/data/embeddedImagesRemoteError.qml b/tests/auto/declarative/qsgtext/data/embeddedImagesRemoteError.qml
index f541e0e497..5762f3e47d 100644
--- a/tests/auto/declarative/qsgtext/data/embeddedImagesRemoteError.qml
+++ b/tests/auto/declarative/qsgtext/data/embeddedImagesRemoteError.qml
@@ -1,5 +1,6 @@
import QtQuick 2.0
Text {
+ textFormat: Text.RichText
text: "<img src='http://127.0.0.1:14453/notexists.png'>"
}
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;
}
{