aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCaroline Chao <caroline.chao@digia.com>2013-05-27 08:17:59 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-08 07:36:03 +0200
commit5f88cdc757f8f3666bd26821598b90f79394448f (patch)
tree379624e8c1a1379793ca44f262a58f6a93ff17bf /tests
parent3f6cad782e7751c34226cc1bda874951109ca228 (diff)
Autotest: Update textedit test using textFormat
TextEdit does not support the StyledText format, Text does. Add an autotest to Text to check the line counts using different text formats. Task-number: QTBUG-31191 Change-Id: I4670f9155bea295ba85f410988d9636eac12842c Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au> Reviewed-by: Liang Qi <liang.qi@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qmltest/text/tst_text.qml17
-rw-r--r--tests/auto/qmltest/textedit/tst_textedit.qml7
2 files changed, 19 insertions, 5 deletions
diff --git a/tests/auto/qmltest/text/tst_text.qml b/tests/auto/qmltest/text/tst_text.qml
index 87e9501ccd..b1d743f630 100644
--- a/tests/auto/qmltest/text/tst_text.qml
+++ b/tests/auto/qmltest/text/tst_text.qml
@@ -78,6 +78,13 @@ Item {
font.pixelSize: 18
}
+ Text {
+ id: txtlines
+ property string styledtextvalue: "Line 1<br>Line 2<br>Line 3"
+ text: "Line 1\nLine 2\nLine 3"
+ textFormat: Text.PlainText
+ }
+
TestCase {
name: "Text"
@@ -116,6 +123,16 @@ Item {
txtlinecount.width = 50;
compare(txtlinecount.lineCount, 3)
}
+ function test_linecounts() {
+ compare(txtlines.lineCount, 3)
+ txtlines.text = txtlines.styledtextvalue;
+ compare(txtlines.text, "Line 1<br>Line 2<br>Line 3")
+ tryCompare(txtlines, 'lineCount', 1)
+ txtlines.textFormat = Text.StyledText;
+ tryCompare(txtlines, 'lineCount', 3)
+ txtlines.textFormat = Text.RichText;
+ tryCompare(txtlines, 'lineCount', 3)
+ }
}
}
diff --git a/tests/auto/qmltest/textedit/tst_textedit.qml b/tests/auto/qmltest/textedit/tst_textedit.qml
index 6e5124253c..eb53eaa604 100644
--- a/tests/auto/qmltest/textedit/tst_textedit.qml
+++ b/tests/auto/qmltest/textedit/tst_textedit.qml
@@ -91,7 +91,7 @@ Item {
id: txtlines
property string styledtextvalue: "Line 1<br>Line 2<br>Line 3"
text: "Line 1\nLine 2\nLine 3"
- textFormat: Text.PlainText
+ textFormat: TextEdit.PlainText
}
TestCase {
@@ -180,10 +180,7 @@ Item {
txtlines.text = txtlines.styledtextvalue;
compare(txtlines.text, "Line 1<br>Line 2<br>Line 3")
tryCompare(txtlines, 'lineCount', 1)
- txtlines.textFormat = Text.StyledText;
- expectFail("", "QTBUG-31191")
- tryCompare(txtlines, 'lineCount', 3)
- txtlines.textFormat = Text.RichText;
+ txtlines.textFormat = TextEdit.RichText;
tryCompare(txtlines, 'lineCount', 3)
}
}