aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Weimer <bweimer@blackberry.com>2014-05-14 10:47:48 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-28 09:37:27 +0200
commit9bdd35b4efc41b687f151882630a3217e83eb710 (patch)
treebb0382af0c8930231004159ff21020777de11654
parent0bc54d362e9f11c8bca8e8d5415d3a112896fb84 (diff)
Fix tst_textinput.qml
On platforms that have QT_NO_CLIPBOARD defined copy/paste/cut functions are not available. Change-Id: I28be021f45cd5a5fe8aaad2752d379c3eebea8cf Reviewed-by: Alan Alpert <aalpert@blackberry.com>
-rw-r--r--tests/auto/qmltest/textinput/tst_textinput.qml45
1 files changed, 36 insertions, 9 deletions
diff --git a/tests/auto/qmltest/textinput/tst_textinput.qml b/tests/auto/qmltest/textinput/tst_textinput.qml
index c359d53200..9a00ac8a60 100644
--- a/tests/auto/qmltest/textinput/tst_textinput.qml
+++ b/tests/auto/qmltest/textinput/tst_textinput.qml
@@ -75,6 +75,13 @@ Item {
TextInput {
id: txtfunctions
+ text: "The quick brown fox"
+ height: 20
+ width: 50
+ }
+
+ TextInput {
+ id: txtclipboard
text: "The quick brown fox jumped over the lazy dog"
height: 20
width: 50
@@ -143,31 +150,51 @@ Item {
compare(txtentry.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_intvalidators_data() {