Squish: Added test case for deleting files outside of editor

Change-Id: Ib9724e0794dab7e4b2de39e72d671c8bf8f27b08
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
Robert Loehning
2012-11-02 19:15:09 +01:00
parent cd7a41ca90
commit 88d52c1d59
4 changed files with 62 additions and 1 deletions
+3
View File
@@ -42,6 +42,9 @@
:Dialog_QmlJSEditor::Internal::ComponentNameDialog {name='QmlJSEditor__Internal__ComponentNameDialog' type='QmlJSEditor::Internal::ComponentNameDialog' visible='1' windowTitle='Move Component into Separate File'}
:Edit Environment_ProjectExplorer::EnvironmentItemsDialog {type='ProjectExplorer::EnvironmentItemsDialog' unnamed='1' visible='1' windowTitle='Edit Environment'}
:Failed to start application_QMessageBox {type='QMessageBox' unnamed='1' visible='1' windowTitle='Failed to start application'}
: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'}
:Form.Startup_QGroupBox {container=':qt_tabwidget_stackedwidget.Form_QWidget' name='startupGroupBox' title='Startup' type='QGroupBox' visible='1'}
:Generator:_QComboBox {buddy=':CMake Wizard.Generator:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:Hits_QCLuceneResultWidget {aboveWidget=':Hits_QLabel' type='QCLuceneResultWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
+1 -1
View File
@@ -7,6 +7,6 @@ HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAP=../objects.map
TEST_CASES=tst_basic_cpp_support tst_memberoperator tst_modify_readonly tst_qml_editor tst_qml_indent tst_rename_macros tst_revert_changes tst_select_all
TEST_CASES=tst_basic_cpp_support tst_delete_externally tst_memberoperator tst_modify_readonly tst_qml_editor tst_qml_indent tst_rename_macros tst_revert_changes tst_select_all
VERSION=2
WRAPPERS=Qt
@@ -0,0 +1,58 @@
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
global templateDir
def readFile(filename):
f = open(filename, "r")
content = f.read()
f.close()
return content
def copyToTemplateDir(filepath):
global templateDir
dst = os.path.join(templateDir, os.path.basename(filepath))
shutil.copyfile(filepath, dst)
return dst
def main():
global templateDir
files = map(lambda record: os.path.normpath(os.path.join(srcPath, testData.field(record, "filename"))),
testData.dataset("files.tsv"))
for currentFile in files:
if not neededFilePresent(currentFile):
return
templateDir = tempDir()
files = map(copyToTemplateDir, files)
startApplication("qtcreator" + SettingsPath)
for currentFile in files:
test.log("Opening file %s" % currentFile)
invokeMenuItem("File", "Open File or Project...")
selectFromFileDialog(currentFile)
editor = getEditorForFileSuffix(currentFile)
if editor == None:
test.fatal("Could not get the editor for '%s'" % currentFile,
"Skipping this file for now.")
continue
contentBefore = readFile(currentFile)
popupText = "The file %s was removed. Do you want to save it under a different name, or close the editor?"
os.remove(currentFile)
test.compare(waitForObject(":File has been removed_QMessageBox").text,
popupText % currentFile)
clickButton(waitForObject(":File has been removed.Save_QPushButton"))
waitFor("os.path.exists(currentFile)", 5000)
# avoids a lock-up on some Linux machines, purely empiric, might have different cause
waitFor("checkIfObjectExists(':File has been removed_QMessageBox', False, 0)", 5000)
test.compare(readFile(currentFile), contentBefore,
"Verifying that file '%s' was restored correctly" % currentFile)
# Different warning because of QTCREATORBUG-8130
popupText2 = "The file %s has been removed outside Qt Creator. Do you want to save it under a different name, or close the editor?"
os.remove(currentFile)
test.compare(waitForObject(":File has been removed_QMessageBox").text,
popupText2 % currentFile)
clickButton(waitForObject(":File has been removed.Close_QPushButton"))
invokeMenuItem("File", "Exit")