From 8480c3837b550a29022e78d296183cbd1a0aefd2 Mon Sep 17 00:00:00 2001 From: Robert Loehning <robert.loehning@nokia.com> Date: Thu, 8 Dec 2011 11:52:38 +0100 Subject: [PATCH] Squish: Added utility functions Change-Id: I5ac2aabde688e86557ee364bb190e0230ba75822 Reviewed-by: Christian Stenger <christian.stenger@nokia.com> --- tests/system/shared/editor_utils.py | 10 ++++++++++ tests/system/shared/project_explorer.py | 10 ++++++++++ .../system/suite_qtquick/tst_qtquick_creation2/test.py | 3 +-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index de32e3b6c36..f0e129aead9 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -62,3 +62,13 @@ def replaceEditorContent(editor, newcontent): type(editor, "<Ctrl+A>") type(editor, "<Delete>") type(editor, newcontent) + +def typeLines(editor, lines): + if isinstance(lines, (str, unicode)): + lines = [lines] + if isinstance(lines, (list, tuple)): + for line in lines: + type(editor, line) + type(editor, "<Enter>") + else: + test.warning("Illegal parameter passed to typeLines()") diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py index 21350642ec5..89ff31c5e2d 100644 --- a/tests/system/shared/project_explorer.py +++ b/tests/system/shared/project_explorer.py @@ -93,3 +93,13 @@ def switchToBuildOrRunSettingsFor(targetCount, currentTarget, projectSettings, i mouseClick(targetSel, xToClick, yToClick, 0, Qt.LeftButton) return True +# this function switches "Run in terminal" on or off in a project's run settings +# param targetCount specifies the number of targets currently defined (must be correct!) +# param currentTarget specifies the target for which to switch into the specified settings (zero based index) +# param runInTerminal specifies if "Run in terminal should be turned on (True) or off (False) +def setRunInTerminal(targetCount, currentTarget, runInTerminal=True): + switchViewTo(ViewConstants.PROJECTS) + switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.RUN) + ensureChecked("{container=':Qt Creator.scrollArea_QScrollArea' text='Run in terminal'\ + type='QCheckBox' unnamed='1' visible='1'}", runInTerminal) + switchViewTo(ViewConstants.EDIT) diff --git a/tests/system/suite_qtquick/tst_qtquick_creation2/test.py b/tests/system/suite_qtquick/tst_qtquick_creation2/test.py index fc99b709013..c87cd78ddb9 100644 --- a/tests/system/suite_qtquick/tst_qtquick_creation2/test.py +++ b/tests/system/suite_qtquick/tst_qtquick_creation2/test.py @@ -46,8 +46,7 @@ def subprocessFunction(): dragItemBy(textEdit, 30, 30, 50, 50, 0, Qt.LeftButton) test.log("Test editing") textEdit.cursorPosition = 0 - type(textEdit, "This text is entered by Squish...") - type(textEdit, "<Return>") + typeLines(textEdit, "This text is entered by Squish...") test.log("Closing QmlApplicationViewer") sendEvent("QCloseEvent", "{type='QmlApplicationViewer' unnamed='1' visible='1'}") -- GitLab