diff --git a/tests/system/objects.map b/tests/system/objects.map index ee6477a6128..91d15268215 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -64,6 +64,7 @@ :Debugger Toolbar.Continue_QToolButton {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' text='Continue' type='QToolButton' unnamed='1' visible='1'} :Debugger Toolbar.Exit Debugger_QToolButton {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' text='Stop Debugger' type='QToolButton' unnamed='1' visible='1'} :Debugger Toolbar.StatusText_Utils::StatusLabel {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' type='Utils::StatusLabel' unnamed='1'} +:Description.description_Utils::CompletingTextEdit {container=':splitter.Description_QGroupBox' name='description' type='Utils::CompletingTextEdit' visible='1'} :Dialog.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Dialog_QmlJSEditor::Internal::ComponentNameDialog'} :Dialog.componentNameEdit_QLineEdit {name='componentNameEdit' type='Utils::ClassNameValidatingLineEdit' visible='1' window=':Dialog_QmlJSEditor::Internal::ComponentNameDialog'} :Dialog_Debugger::Internal::SymbolPathsDialog {name='Debugger__Internal__SymbolPathsDialog' type='Debugger::Internal::SymbolPathsDialog' visible='1' windowTitle='Dialog'} @@ -75,6 +76,7 @@ :File has been removed.Close_QPushButton {text='Close' type='QPushButton' unnamed='1' visible='1' window=':File has been removed_QMessageBox'} :File has been removed.Save_QPushButton {text='Save' type='QPushButton' unnamed='1' visible='1' window=':File has been removed_QMessageBox'} :File has been removed_QMessageBox {text?='The file * removed*. Do you want to save it under a different name, or close the editor?' type='QMessageBox' unnamed='1' visible='1'} +:Files.Check all_QCheckBox {container=':splitter.Files_QGroupBox' name='checkAllCheckBox' text='Check all' type='QCheckBox' visible='1'} :Form.Startup_QGroupBox {container=':qt_tabwidget_stackedwidget.Form_QWidget' name='startupGroupBox' title='Startup' type='QGroupBox' visible='1'} :FormEditorStack.CheckBox_QCheckBox {container=':*Qt Creator.FormEditorStack_Designer::Internal::FormEditorStack' name='checkBox' text='CheckBox' type='QCheckBox' visible='1'} :FormEditorStack.PushButton_QPushButton {container=':*Qt Creator.FormEditorStack_Designer::Internal::FormEditorStack' name='pushButton' text='PushButton' type='QPushButton' visible='1'} @@ -98,6 +100,9 @@ :Kits_Or_Compilers_QTreeView {container=':qt_tabwidget_stackedwidget_QWidget' type='QTreeView' unnamed='1' visible='1'} :Kits_QtVersion_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' occurrence='5' type='QComboBox' unnamed='1' visible='1'} :Locals and Expressions_Debugger::Internal::WatchTreeView {container=':DebugModeWidget.Locals and Expressions_QDockWidget' name='WatchWindow' type='Debugger::Internal::WatchTreeView' visible='1' windowTitle='Locals and Expressions'} +:New Text File.Add to project:_QLabel {name='projectLabel' text='Add to project:' type='QLabel' visible='1' window=':New Text File_Utils::FileWizardDialog'} +:New Text File.nameLineEdit_Utils::FileNameValidatingLineEdit {name='nameLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1' window=':New Text File_Utils::FileWizardDialog'} +:New Text File_Utils::FileWizardDialog {type='Utils::FileWizardDialog' unnamed='1' visible='1' windowTitle='New Text File'} :New.comboBox_QComboBox {name='comboBox' type='QComboBox' visible='1' window=':New_Core::Internal::NewDialog'} :New.frame_QFrame {name='frame' type='QFrame' visible='1' window=':New_Core::Internal::NewDialog'} :New.templateCategoryView_QTreeView {name='templateCategoryView' type='QTreeView' visible='1' window=':New_Core::Internal::NewDialog'} @@ -133,6 +138,7 @@ :Qt Creator.Stop_QToolButton {text='Stop' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.replaceEdit_Utils::FilterLineEdit {name='replaceEdit' type='Utils::FilterLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.scrollArea_QScrollArea {name='scrollArea' type='QScrollArea' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator.splitter_QSplitter {name='splitter' type='QSplitter' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton {occurrence='3' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Bookmarks_TreeView {type='TreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_CloseButton {type='CloseButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} @@ -140,11 +146,13 @@ :Qt Creator_Core::Internal::CommandComboBox {type='Core::Internal::CommandComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' visible='1' windowTitle?='*Qt Creator'} :Qt Creator_Core::Internal::NavComboBox {type='Core::Internal::NavComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_Core::Internal::OutputPaneManageButton {type='Core::Internal::OutputPaneManageButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Core::Internal::ProgressBar {type='Core::Internal::ProgressBar' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Core::OutputWindow {type='Core::OutputWindow' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_CppEditor::Internal::CPPEditorWidget {type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_FilenameQComboBox {type='QComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Find::Internal::SearchResultTreeView {type='Find::Internal::SearchResultTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_Git::Internal::GitEditor {type='Git::Internal::GitEditor' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Help::Internal::HelpViewer {type='Help::Internal::HelpViewer' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_HelpSelector_QComboBox {occurrence='3' type='QComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Issues_Core::Internal::OutputPaneToggleButton {occurrence='1' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} @@ -157,8 +165,10 @@ :Qt Creator_QmlJSEditor::QmlJSTextEditorWidget {type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_SearchResult_Core::Internal::OutputPaneToggleButton {occurrence='2' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_SystemSettings.Details_Utils::DetailsButton {occurrence='4' text='Details' type='Utils::DetailsButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_TextEditor::PlainTextEditorWidget {type='TextEditor::PlainTextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Utils::NavigationTreeView::QExpandingLineEdit {container=':Qt Creator_Utils::NavigationTreeView' type='QExpandingLineEdit' unnamed='1' visible='1'} +:Qt Creator_VersionControl_Core::Internal::OutputPaneToggleButton {occurrence='6' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Gui Application.Form file:_QLabel {name='formLabel' text='Form file:' type='QLabel' visible='1' window=':Qt Gui Application_QmakeProjectManager::Internal::GuiAppWizardDialog'} :Qt Gui Application.Header file:_QLabel {name='headerLabel' text='Header file:' type='QLabel' visible='1' window=':Qt Gui Application_QmakeProjectManager::Internal::GuiAppWizardDialog'} :Qt Gui Application.Source file:_QLabel {name='sourceLabel' text='Source file:' type='QLabel' visible='1' window=':Qt Gui Application_QmakeProjectManager::Internal::GuiAppWizardDialog'} @@ -195,6 +205,7 @@ :headerFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Header file:_QLabel' name='headerFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'} :popupFrame_Proposal_QListView {container=':popupFrame_TextEditor::GenericProposalWidget' type='QListView' unnamed='1' visible='1'} :popupFrame_TextEditor::GenericProposalWidget {name='m_popupFrame' type='TextEditor::GenericProposalWidget' visible='1'} +:projectComboBox_QComboBox {buddy=':New Text File.Add to project:_QLabel' name='projectComboBox' type='QComboBox' visible='1'} :qdesigner_internal::WidgetBoxCategoryListView {container=':Widget Box_qdesigner_internal::WidgetBoxTreeWidget' occurrence='3' type='qdesigner_internal::WidgetBoxCategoryListView' unnamed='1' visible='1'} :qmakeCallEdit {container=':Qt Creator.scrollArea_QScrollArea' text?='qmake: qmake*' type='QLabel' unnamed='1' visible='1'} :qt_tabwidget_stackedwidget.Core__Internal__GeneralSettings_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='Core__Internal__GeneralSettings' type='QWidget' visible='1'} @@ -210,5 +221,8 @@ :scrollArea.qmlDebuggingLibraryCheckBox_QCheckBox {name='qmlDebuggingLibraryCheckBox' type='QCheckBox' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :scrollArea_QTableView {type='QTableView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :sourceFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Source file:_QLabel' name='sourceFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'} +:splitter.Commit File(s)_VcsBase::QActionPushButton {container=':Qt Creator.splitter_QSplitter' text~='(Commit .+/.+ File.*)' type='VcsBase::QActionPushButton' unnamed='1' visible='1'} +:splitter.Description_QGroupBox {container=':Qt Creator.splitter_QSplitter' name='descriptionBox' title='Description' type='QGroupBox' visible='1'} +:splitter.Files_QGroupBox {container=':Qt Creator.splitter_QSplitter' name='groupBox' title='Files' type='QGroupBox' visible='1'} :stackedWidget.plainTextEdit_QPlainTextEdit {container=':Send to Codepaster.stackedWidget_QStackedWidget' name='plainTextEdit' type='QPlainTextEdit' visible='1'} :uiDescription_QLineEdit {buddy=':Send to Codepaster.Description:_QLabel' name='uiDescription' type='QLineEdit' visible='1'} diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index d39f336c5c5..eca3162e575 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -277,8 +277,7 @@ def getEditorForFileSuffix(curFile): else: test.log("Trying PlainTextEditor (file suffix: %s)" % suffix) try: - editor = waitForObject("{type='TextEditor::PlainTextEditorWidget' unnamed='1' " - "visible='1' window=':Qt Creator_Core::Internal::MainWindow'}", 3000) + editor = waitForObject(":Qt Creator_TextEditor::PlainTextEditorWidget", 3000) except: test.fatal("Unsupported file suffix for file '%s'" % curFile) editor = None diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 84d99dff939..0b784304f98 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -174,16 +174,14 @@ def __selectQtVersionDesktop__(checks, available=None): clickButton(waitForObject(":Next_QPushButton")) return checkedTargets -def __createProjectHandleLastPage__(expectedFiles = None): +def __createProjectHandleLastPage__(expectedFiles = None, addToVersionControl = "", addToProject = None): if expectedFiles != None: - summary = str(waitForObject("{name='filesLabel' text?='Files to be added in
*
' " - "type='QLabel' visible='1'}").text) - lastIndex = 0 - for filename in expectedFiles: - index = summary.find(filename) - test.verify(index > lastIndex, "'" + filename + "' found at index " + str(index)) - lastIndex = index - selectFromCombo(":addToVersionControlComboBox_QComboBox", "") + summary = waitForObject("{name='filesLabel' text?='Files to be added in
*
' " + "type='QLabel' visible='1'}").text + verifyItemOrder(expectedFiles, summary) + if addToProject: + selectFromCombo(":projectComboBox_QComboBox", addToProject) + selectFromCombo(":addToVersionControlComboBox_QComboBox", addToVersionControl) clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}")) def __verifyFileCreation__(path, expectedFiles): @@ -220,7 +218,7 @@ def __modifyAvailableTargets__(available, requiredQt, asStrings=False): # param path specifies where to create the project # param projectName is the name for the new project # param checks turns tests in the function on if set to True -def createProject_Qt_GUI(path, projectName, checks = True): +def createProject_Qt_GUI(path, projectName, checks = True, addToVersionControl = ""): template = "Qt Widgets Application" available = __createProjectOrFileSelectType__(" Applications", template) __createProjectSetNameAndPath__(path, projectName, checks) @@ -250,7 +248,7 @@ def createProject_Qt_GUI(path, projectName, checks = True): path = os.path.join(path, projectName) expectedFiles = [path] expectedFiles.extend(__sortFilenamesOSDependent__(["main.cpp", cpp_file, h_file, ui_file, pro_file])) - __createProjectHandleLastPage__(expectedFiles) + __createProjectHandleLastPage__(expectedFiles, addToVersionControl) progressBarWait(20000) __verifyFileCreation__(path, expectedFiles) @@ -639,7 +637,7 @@ def compareProjectTree(rootObject, dataset): return test.passes("No errors found in project tree") -def addCPlusPlusFileToCurrentProject(name, template, forceOverwrite=False): +def addCPlusPlusFileToCurrentProject(name, template, forceOverwrite=False, addToVCS = ""): if name == None: test.fatal("File must have a name - got None.") return @@ -652,7 +650,7 @@ def addCPlusPlusFileToCurrentProject(name, template, forceOverwrite=False): replaceEditorContent(lineEdit, name) clickButton(waitForObject(":Next_QPushButton")) fileExistedBefore = os.path.exists(os.path.join(basePath, name)) - __createProjectHandleLastPage__() + __createProjectHandleLastPage__(addToVersionControl = addToVCS) if (fileExistedBefore): overwriteDialog = "{type='Core::Internal::PromptOverwriteDialog' unnamed='1' visible='1'}" waitForObject(overwriteDialog) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 468d5eef16e..073aa981e53 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -724,3 +724,11 @@ def getQModelIndexStr(property, container): if (container.startswith(":")): container = "'%s'" % container return ("{column='0' container=%s %s type='QModelIndex'}" % (container, property)) + +def verifyItemOrder(items, text): + text = str(text) + lastIndex = 0 + for item in items: + index = text.find(item) + test.verify(index > lastIndex, "'" + item + "' found at index " + str(index)) + lastIndex = index diff --git a/tests/system/suite_tools/suite.conf b/tests/system/suite_tools/suite.conf index d031934fc3c..87ee2075018 100644 --- a/tests/system/suite_tools/suite.conf +++ b/tests/system/suite_tools/suite.conf @@ -7,6 +7,6 @@ HOOK_SUB_PROCESSES=false IMPLICITAUTSTART=0 LANGUAGE=Python OBJECTMAP=../objects.map -TEST_CASES=tst_codepasting tst_designer_autocomplete tst_designer_goto_slot tst_external_sort tst_git_clone +TEST_CASES=tst_codepasting tst_designer_autocomplete tst_designer_goto_slot tst_external_sort tst_git_clone tst_git_local VERSION=2 WRAPPERS=Qt diff --git a/tests/system/suite_tools/tst_git_local/test.py b/tests/system/suite_tools/tst_git_local/test.py new file mode 100644 index 00000000000..1d28125d7b9 --- /dev/null +++ b/tests/system/suite_tools/tst_git_local/test.py @@ -0,0 +1,97 @@ +############################################################################# +## +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## Contact: http://www.qt-project.org/legal +## +## This file is part of Qt Creator. +## +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and Digia. For licensing terms and +## conditions see http://qt.digia.com/licensing. For further information +## use the contact form at http://qt.digia.com/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 2.1 requirements +## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## In addition, as a special exception, Digia gives you certain additional +## rights. These rights are described in the Digia Qt LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +############################################################################# + +source("../../shared/qtcreator.py") + +projectName = "gitProject" + +# TODO: Make selecting changes possible +def commit(commitMessage, expectedLogMessage): + ensureChecked(waitForObject(":Qt Creator_VersionControl_Core::Internal::OutputPaneToggleButton")) + clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) + invokeMenuItem("Tools", "Git", "Local Repository", "Commit...") + replaceEditorContent(waitForObject(":Description.description_Utils::CompletingTextEdit"), commitMessage) + ensureChecked(waitForObject(":Files.Check all_QCheckBox")) + clickButton(waitForObject(":splitter.Commit File(s)_VcsBase::QActionPushButton")) + vcsLog = waitForObject("{type='QPlainTextEdit' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}").plainText + test.verify(expectedLogMessage in str(vcsLog), "Searching for '%s' in log:\n%s " % (expectedLogMessage, vcsLog)) + return commitMessage + +def main(): + startApplication("qtcreator" + SettingsPath) + if not startedWithoutPluginError(): + return + createProject_Qt_GUI(srcPath, projectName, addToVersionControl = "Git") + if isQt4Build and not object.exists(":Qt Creator_VersionControl_Core::Internal::OutputPaneToggleButton"): + clickButton(waitForObject(":Qt Creator_Core::Internal::OutputPaneManageButton")) + activateItem(waitForObjectItem("{type='QMenu' unnamed='1' visible='1'}", "Version Control")) + ensureChecked(waitForObject(":Qt Creator_VersionControl_Core::Internal::OutputPaneToggleButton")) + vcsLog = waitForObject("{type='QPlainTextEdit' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}").plainText + test.verify("Initialized empty Git repository in %s" + % os.path.join(srcPath, projectName, ".git").replace("\\", "/") in str(vcsLog), + "Has initialization of repo been logged:\n%s " % vcsLog) + commitMessages = [commit("Initial Commit", "Committed 5 file(s).")] + clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) + addCPlusPlusFileToCurrentProject("pointless_header.h", "C++ Header File", addToVCS = "Git") + commitMessages.insert(0, commit("Added pointless header file", "Committed 2 file(s).")) + __createProjectOrFileSelectType__(" General", "Text File", isProject=False) + replaceEditorContent(waitForObject(":New Text File.nameLineEdit_Utils::FileNameValidatingLineEdit"), "README") + clickButton(waitForObject(":Next_QPushButton")) + __createProjectHandleLastPage__(["README.txt"], "Git", "") + replaceEditorContent(waitForObject(":Qt Creator_TextEditor::PlainTextEditorWidget"), + "Some important advice in the README") + invokeMenuItem("File", "Save All") + commitMessages.insert(0, commit("Added README file", "Committed 2 file(s).")) # QTCREATORBUG-11074 + invokeMenuItem("File", "Close All") + invokeMenuItem("Tools", "Git", "Local Repository", "Log") + gitEditor = waitForObject(":Qt Creator_Git::Internal::GitEditor") + waitFor("str(gitEditor.plainText) != 'Waiting for data...'", 20000) + verifyItemOrder(commitMessages, gitEditor.plainText) + invokeMenuItem("File", "Close All Projects and Editors") + invokeMenuItem("File", "Exit") + +def deleteProject(): + path = os.path.join(srcPath, projectName) + if os.path.exists(path): + try: + # Make files in .git writable to remove them + for root, dirs, files in os.walk(path): + for name in files: + os.chmod(os.path.join(root, name), stat.S_IWUSR) + shutil.rmtree(path) + except: + test.warning("Error while removing '%s'" % path) + +def init(): + deleteProject() + +def cleanup(): + deleteProject()