summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@nokia.com>2011-09-26 12:59:55 +0200
committerChristian Stenger <christian.stenger@nokia.com>2011-09-26 13:50:23 +0200
commit6271661390184074ba34ae9bc2505811a919a1e4 (patch)
treef40d7a5f0eb8c06f7f1621540c60cbc353e6fbaa /tests
parent84a535bae74771bdfc20a3f86ebb2cc00ce699b1 (diff)
downloadqt-creator-6271661390184074ba34ae9bc2505811a919a1e4.tar.gz
Improved testing of id renaming.
Change-Id: If1312fdbd9f8c934b8412289ede457032131fc42 Reviewed-on: http://codereview.qt-project.org/5533 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Robert Löhning <robert.loehning@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/system/suite_qtquick/tst_qml_editor/test.py43
1 files changed, 27 insertions, 16 deletions
diff --git a/tests/system/suite_qtquick/tst_qml_editor/test.py b/tests/system/suite_qtquick/tst_qml_editor/test.py
index 7905ccb8dd..488836b73b 100644
--- a/tests/system/suite_qtquick/tst_qml_editor/test.py
+++ b/tests/system/suite_qtquick/tst_qml_editor/test.py
@@ -20,7 +20,7 @@ def prepareTemplate():
global templateDir
templateDir = tempDir()
templateDir = os.path.abspath(templateDir + "/template")
- sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/text/textselection")
+ sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/keyinteraction/focus")
shutil.copytree(sourceExample, templateDir)
def createNewQtQuickApplication():
@@ -49,7 +49,7 @@ def createNewQtQuickApplication():
chooseComponents(QtQuickConstants.Components.EXISTING_QML)
# define the existing qml file to import
baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
- type(baseLineEd, templateDir+"/qml/textselection.qml")
+ type(baseLineEd, templateDir+"/qml/focus.qml")
clickButton(nextButton)
chooseDestination()
snooze(1)
@@ -61,14 +61,16 @@ def testRenameId():
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
model = navTree.model()
- treeElement = ("untitled.QML.%s/qml.textselection\\.qml" %
- templateDir.replace("\\", "/").replace("_", "\\_"))
- waitForObjectItem(navTree, treeElement)
- doubleClickItem(navTree, treeElement, 5, 5, 0, Qt.LeftButton)
- editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' "
- "window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
- originalText = "%s" % editor.plainText
- line = "TextEdit\s*\{"
+ files = ["Core.ContextMenu\\.qml", "Core.GridMenu\\.qml", "Core.ListMenu\\.qml", "focus\\.qml"]
+ originalTexts = {}
+ for file in files:
+ doubleClickFile(navTree, file)
+ editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' "
+ "window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
+ originalTexts.setdefault(file, "%s" % editor.plainText)
+ test.log("stored %s's content" % file.replace("Core.","").replace("\\",""))
+ # last opened file is the main file focus.qml
+ line = "FocusScope\s*\{"
if not placeCursorToLine(editor, line, True):
test.fatal("File seems to have changed... Canceling current test")
return False
@@ -77,14 +79,23 @@ def testRenameId():
activateItem(waitForObjectItem("{type='QMenu' visible='1' unnamed='1'}", "Rename Symbol Under Cursor"))
type(waitForObject("{leftWidget={text='Replace with:' type='QLabel' unnamed='1' visible='1'} "
"type='Find::Internal::WideEnoughLineEdit' unnamed='1' visible='1' "
- "window=':Qt Creator_Core::Internal::MainWindow'}"), "halloballo")
+ "window=':Qt Creator_Core::Internal::MainWindow'}"), "renamedView")
clickButton(waitForObject("{text='Replace' type='QToolButton' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}"))
- modifiedText = "%s" % editor.plainText
- originalText = "%s" % (originalText.replace("editor", "__EDITOR__").replace("edit", "halloballo")
- .replace("__EDITOR__", "editor"))
- test.compare(originalText,modifiedText)
- type(editor, "<Ctrl+S>")
+ for file in files:
+ doubleClickFile(navTree, file)
+ editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' "
+ "window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
+ modifiedText = "%s" % editor.plainText
+ originalText = originalTexts.get(file).replace("mainView", "renamedView")
+ test.compare(originalText,modifiedText)
+ type(editor, "<Ctrl+S>")
+
+def doubleClickFile(navTree, file):
+ treeElement = ("untitled.QML.%s/qml.%s" %
+ (templateDir.replace("\\", "/").replace("_", "\\_"),file))
+ waitForObjectItem(navTree, treeElement)
+ doubleClickItem(navTree, treeElement, 5, 5, 0, Qt.LeftButton)
def cleanup():
global workingDir, templateDir