aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBernd Weimer <bweimer@blackberry.com>2014-04-29 08:51:58 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-09 16:08:38 +0200
commit4b6856411c92d70bb4162d4f00685d5f8d17874d (patch)
tree50554c053115e8fa9db99f6ab1ce2634f1520c71 /tests
parentcabc944f0e7070fa8834999d88e7d82d62e428a8 (diff)
Fix tst_textedit.qml
On platforms that have QT_NO_CLIPBOARD defined copy/paste/cut functions are not available. Change-Id: Ia2c82d0d3910f89642b1c3ef719caee88da3999e Reviewed-by: Damian Jansen <damian.jansen@gmail.com> Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qmltest/textedit/tst_textedit.qml47
1 files changed, 38 insertions, 9 deletions
diff --git a/tests/auto/qmltest/textedit/tst_textedit.qml b/tests/auto/qmltest/textedit/tst_textedit.qml
index eb53eaa604..1dc7084049 100644
--- a/tests/auto/qmltest/textedit/tst_textedit.qml
+++ b/tests/auto/qmltest/textedit/tst_textedit.qml
@@ -43,6 +43,8 @@ import QtTest 1.0
Item {
id: top
+ height: 30
+ width: 60
TextEdit {
id: emptyText
@@ -82,6 +84,13 @@ Item {
TextEdit {
id: txtfunctions
+ text: "The quick brown fox"
+ height: 20
+ width: 50
+ }
+
+ TextEdit {
+ id: txtclipboard
text: "The quick brown fox jumped over the lazy dog"
height: 20
width: 50
@@ -148,31 +157,51 @@ Item {
compare(txtentry2.text, "hello World")
}
- function test_functions() {
+ function test_select_insert() {
compare(txtfunctions.getText(4,9), "quick")
txtfunctions.select(4,9);
compare(txtfunctions.selectedText, "quick")
+ txtfunctions.insert(4, "very ")
+ compare(txtfunctions.text, "The very quick brown fox")
txtfunctions.deselect();
compare(txtfunctions.selectedText, "")
- txtfunctions.select(4,9);
- txtfunctions.cut();
- compare(txtfunctions.text, "The brown fox jumped over the lazy dog")
txtfunctions.text = "Qt";
txtfunctions.insert(txtfunctions.text.length, " ")
compare(txtfunctions.text, "Qt ");
- txtfunctions.cursorPosition = txtfunctions.text.length;
- txtfunctions.paste();
+ txtfunctions.insert(txtfunctions.text.length, "quick")
compare(txtfunctions.text, "Qt quick");
txtfunctions.cursorPosition = txtfunctions.text.length;
txtfunctions.selectWord();
compare(txtfunctions.selectedText, "quick")
- txtfunctions.copy();
txtfunctions.selectAll();
compare(txtfunctions.selectedText, "Qt quick")
txtfunctions.deselect();
compare(txtfunctions.selectedText, "")
- txtfunctions.paste();
- compare(txtfunctions.text, "Qt quickquick");
+ }
+
+ function test_clipboard() {
+ if (typeof(txtclipboard.copy) !== "function"
+ || typeof(txtclipboard.paste) !== "function"
+ || typeof(txtclipboard.cut) !== "function") {
+ skip("Clipboard is not supported on this platform.")
+ }
+ txtclipboard.select(4,10);
+ txtclipboard.cut();
+ compare(txtclipboard.text, "The brown fox jumped over the lazy dog")
+ txtclipboard.select(30,35)
+ txtclipboard.paste();
+ compare(txtclipboard.text, "The brown fox jumped over the quick dog")
+ txtclipboard.text = "Qt ";
+ txtclipboard.cursorPosition = txtclipboard.text.length;
+ txtclipboard.paste();
+ compare(txtclipboard.text, "Qt quick ");
+ txtclipboard.cursorPosition = txtclipboard.text.length-1;
+ txtclipboard.selectWord();
+ compare(txtclipboard.selectedText, "quick")
+ txtclipboard.copy();
+ txtclipboard.cursorPosition = txtclipboard.text.length;
+ txtclipboard.paste();
+ compare(txtclipboard.text, "Qt quick quick");
}
function test_linecounts() {