2012-02-10 14:11:49 +01:00
|
|
|
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():
|
2012-03-30 13:05:29 +02:00
|
|
|
files = [srcPath + "/creator/README", srcPath + "/creator/qtcreator.pri",
|
2012-06-13 18:09:13 +02:00
|
|
|
srcPath + "/creator/doc/snippets/qml/list-of-transitions.qml",
|
|
|
|
|
srcPath + "/creator/share/qtcreator/glsl/glsl_120.frag"]
|
2012-03-30 13:05:29 +02:00
|
|
|
for currentFile in files:
|
2012-02-10 14:11:49 +01:00
|
|
|
if not neededFilePresent(currentFile):
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
startApplication("qtcreator" + SettingsPath)
|
2012-03-30 13:05:29 +02:00
|
|
|
for currentFile in files:
|
2012-02-10 14:11:49 +01:00
|
|
|
test.log("Opening file %s" % currentFile)
|
|
|
|
|
size = charactersInFile(currentFile)
|
|
|
|
|
invokeMenuItem("File", "Open File or Project...")
|
|
|
|
|
selectFromFileDialog(currentFile)
|
2012-03-30 13:05:29 +02:00
|
|
|
editor = getEditorForFileSuffix(currentFile)
|
|
|
|
|
if editor == None:
|
|
|
|
|
test.fatal("Could not get the editor for '%s'" % currentFile,
|
|
|
|
|
"Skipping this file for now.")
|
|
|
|
|
continue
|
2012-02-10 16:25:08 +01:00
|
|
|
JIRA.performWorkaroundIfStillOpen(6918, JIRA.Bug.CREATOR, editor)
|
2012-02-10 14:11:49 +01:00
|
|
|
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)
|
2012-05-30 15:33:01 +02:00
|
|
|
test.log("Pressing key: %s" % key.replace("<", "").replace(">", ""))
|
2012-02-10 14:11:49 +01:00
|
|
|
type(editor, key)
|
|
|
|
|
if key == "<Up>":
|
|
|
|
|
test.compare(editor.textCursor().selectionStart(), editor.textCursor().selectionEnd())
|
|
|
|
|
else:
|
|
|
|
|
pos = size
|
|
|
|
|
if key == "<Left>":
|
|
|
|
|
pos -= 1
|
2012-05-30 15:33:01 +02:00
|
|
|
if JIRA.isBugStillOpen(7215, JIRA.Bug.CREATOR):
|
2012-04-25 12:48:27 +02:00
|
|
|
test.warning("Using workaround for %s-%d" % (JIRA.Bug.CREATOR, 7215))
|
|
|
|
|
pos = 0
|
2012-02-10 14:11:49 +01:00
|
|
|
test.compare(editor.textCursor().selectionStart(), pos)
|
|
|
|
|
test.compare(editor.textCursor().selectionEnd(), pos)
|
|
|
|
|
test.compare(editor.textCursor().position(), pos)
|
|
|
|
|
invokeMenuItem("File", "Exit")
|
|
|
|
|
waitForCleanShutdown()
|