aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Loehning <robert.loehning@digia.com>2013-12-02 18:57:23 +0100
committerRobert Loehning <robert.loehning@digia.com>2013-12-03 10:41:39 +0100
commit4d6cb992b12fdf9b2da7ebb1bd0f8b9ec7a59873 (patch)
treec7d0548390045c0a355d421b64ab167bd7e02b25
parent62fed3c4071622abd3aad1b2bfb4a97df29eb37c (diff)
Squish: Use generic function textUnderCursor(...)
Change-Id: I7ea6e9af1435e716266f4dfd917fe9ac568a67a5 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
-rw-r--r--tests/system/shared/utils.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py
index 3279980aab..b46499d8b2 100644
--- a/tests/system/shared/utils.py
+++ b/tests/system/shared/utils.py
@@ -112,19 +112,16 @@ def selectFromLocator(filter, itemName = None):
doubleClick(wantedItem, 5, 5, 0, Qt.LeftButton)
def wordUnderCursor(window):
- cursor = window.textCursor()
- oldposition = cursor.position()
- cursor.movePosition(QTextCursor.StartOfWord)
- cursor.movePosition(QTextCursor.EndOfWord, QTextCursor.KeepAnchor)
- returnValue = cursor.selectedText()
- cursor.setPosition(oldposition)
- return returnValue
+ return textUnderCursor(window, QTextCursor.StartOfWord, QTextCursor.EndOfWord)
def lineUnderCursor(window):
+ return textUnderCursor(window, QTextCursor.StartOfLine, QTextCursor.EndOfLine)
+
+def textUnderCursor(window, fromPos, toPos):
cursor = window.textCursor()
oldposition = cursor.position()
- cursor.movePosition(QTextCursor.StartOfLine)
- cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor)
+ cursor.movePosition(fromPos)
+ cursor.movePosition(toPos, QTextCursor.KeepAnchor)
returnValue = cursor.selectedText()
cursor.setPosition(oldposition)
return returnValue