Squish: Update and stabilize tst_rename_file

Change-Id: I1dae24e20d8c65b716dd988812eee013f0491603
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Robert Löhning
2021-07-08 14:22:03 +02:00
parent 1cc4cbb402
commit 47cb2e9d24

View File

@@ -111,10 +111,18 @@ def renameFile(projectDir, proFile, branch, oldname, newname):
" windowTitle='Rename More Files?'}}")) " windowTitle='Rename More Files?'}}"))
test.verify(waitFor("os.path.exists(newFilePath)", 1000), test.verify(waitFor("os.path.exists(newFilePath)", 1000),
"Verify that file with new name exists: %s" % newFilePath) "Verify that file with new name exists: %s" % newFilePath)
test.compare(readFile(newFilePath), oldFileText,
"Comparing content of file before and after renaming")
test.verify(waitFor("' ' + newname in safeReadFile(proFile)", 2000), test.verify(waitFor("' ' + newname in safeReadFile(proFile)", 2000),
"Verify that new filename '%s' was added to pro-file." % newname) "Verify that new filename '%s' was added to pro-file." % newname)
if oldname.endswith(".h"):
# Creator updates include guards in renamed header files and changes line breaks
oldFileText = oldFileText.replace("\r\n", "\n")
includeGuard = " " + newname.upper().replace(".", "_")
if not includeGuard.endswith("_H"):
includeGuard += "_H"
oldFileText = oldFileText.replace(" " + oldname.upper().replace(".", "_"), includeGuard)
waitFor("includeGuard in safeReadFile(newFilePath)", 2000)
test.compare(readFile(newFilePath), oldFileText,
"Comparing content of file before and after renaming")
if oldname not in newname: if oldname not in newname:
test.verify(oldname not in readFile(proFile), test.verify(oldname not in readFile(proFile),
"Verify that old filename '%s' was removed from pro-file." % oldname) "Verify that old filename '%s' was removed from pro-file." % oldname)