Files
qt-creator/tests/system/suite_general/tst_select_all/test.py
Christian Stenger d766c2e773 Squish: Use single file for workarounds
This would help to keep the normal tests clean
and mess up only a single file that contains all
workarounds.

Change-Id: Ic26e57bcd13663efe9c882c003909eb0caa6fe9e
Reviewed-by: Robert Löhning <robert.loehning@nokia.com>
Reviewed-by: Bill King <bill.king@nokia.com>
2012-02-15 17:46:18 +01:00

49 lines
2.2 KiB
Python

source("../../shared/qtcreator.py")
# This tests for QTCREATORBUG-5757
# Results can differ from actual size on disk (different line endings on Windows)
def charactersInFile(filename):
f = open(filename,"r")
content = f.read()
f.close()
return len(content)
def main():
filesAndEditors = {srcPath + "/creator/README" : "TextEditor::PlainTextEditorWidget",
srcPath + "/creator/qtcreator.pri" : "Qt4ProjectManager::Internal::ProFileEditorWidget",
srcPath + "/creator/doc/snippets/qml/list-of-transitions.qml" : "QmlJSEditor::QmlJSTextEditorWidget"}
for currentFile in filesAndEditors:
if not neededFilePresent(currentFile):
return
startApplication("qtcreator" + SettingsPath)
for currentFile in filesAndEditors:
test.log("Opening file %s" % currentFile)
size = charactersInFile(currentFile)
invokeMenuItem("File", "Open File or Project...")
selectFromFileDialog(currentFile)
editor = waitForObject("{type='%s' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}"
% filesAndEditors[currentFile], 20000)
JIRA.performWorkaroundIfStillOpen(6918, JIRA.Bug.CREATOR, editor)
for key in ["<Up>", "<Down>", "<Left>", "<Right>"]:
test.log("Selecting everything")
invokeMenuItem("Edit", "Select All")
waitFor("editor.textCursor().hasSelection()", 1000)
test.compare(editor.textCursor().selectionStart(), 0)
test.compare(editor.textCursor().selectionEnd(), size)
test.compare(editor.textCursor().position(), size)
test.log("Pressing key %s" % key)
type(editor, key)
if key == "<Up>":
test.compare(editor.textCursor().selectionStart(), editor.textCursor().selectionEnd())
else:
pos = size
if key == "<Left>":
pos -= 1
test.compare(editor.textCursor().selectionStart(), pos)
test.compare(editor.textCursor().selectionEnd(), pos)
test.compare(editor.textCursor().position(), pos)
invokeMenuItem("File", "Exit")
waitForCleanShutdown()