-import tempfile, shutil, os
+import tempfile
def neededFilePresent(path):
found = os.path.exists(path)
installLazySignalHandler(object, signal, "__callbackFunction__")
return realName
+# this function removes the user files of given pro file(s)
+# can be called with a single string object or a list of strings holding path(s) to
+# the pro file(s) returns False if it could not remove all user files or has been
+# called with an unsupported object
+def cleanUpUserFiles(pathsToProFiles=None):
+ if pathsToProFiles==None:
+ return False
+ if className(pathsToProFiles) in ("str", "unicode"):
+ filelist = glob.glob(pathsToProFiles+".user*")
+ elif className(pathsToProFiles)=="list":
+ filelist = []
+ for p in pathsToProFiles:
+ filelist.extend(glob.glob(p+".user*"))
+ else:
+ test.fatal("Got an unsupported object.")
+ return False
+ doneWithoutErrors = True
+ for file in filelist:
+ try:
+ file = os.path.abspath(file)
+ os.remove(file)
+ except:
+ doneWithoutErrors = False
+ return doneWithoutErrors
+
test.compare(lineUnderCursor(findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "Dummy::Dummy(int)")
invokeMenuItem("File", "Exit")
-
+ waitForCleanShutdown()
def init():
cleanup()
def cleanup():
# Make sure the .user files are gone
-
- if os.access(srcPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro.user", os.F_OK):
- os.remove(srcPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro.user")
+ cleanUpUserFiles(srcPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro")
BuildPath = glob.glob(srcPath + "/qtcreator-build-*")
BuildPath += glob.glob(srcPath + "/projects-build-*")
# Add a new run configuration
invokeMenuItem("File", "Exit")
+ waitForCleanShutdown()
def init():
global SpeedCrunchPath
def cleanup():
# Make sure the .user files are gone
- if os.access(SpeedCrunchPath + ".user", os.F_OK):
- os.remove(SpeedCrunchPath + ".user")
+ cleanUpUserFiles(SpeedCrunchPath)
BuildPath = glob.glob(srcPath + "/creator-test-data/speedcrunch/speedcrunch-build-*")
BuildPath += glob.glob(srcPath + "/creator-test-data/speedcrunch/qtcreator-build-*")
checkLastBuild()
invokeMenuItem("File", "Exit")
+ waitForCleanShutdown()
def init():
global SpeedCrunchPath
def cleanup():
# Make sure the .user files are gone
- if os.access(SpeedCrunchPath + ".user", os.F_OK):
- os.remove(SpeedCrunchPath + ".user")
+ cleanUpUserFiles(SpeedCrunchPath)
BuildPath = srcPath + "/creator-test-data/speedcrunch/src/qtcreator-build"
test.compare(wordUnderCursor(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "QList")
invokeMenuItem("File", "Exit")
-
+ waitForCleanShutdown()
def init():
cleanup()
def cleanup():
# Make sure the .user files are gone
+ cleanUpUserFiles([srcPath + "/creator-test-data/speedcrunch/src/speedcrunch.pro",
+ srcPath + "/creator/qtcreator.pro"])
- if os.access(srcPath + "/creator-test-data/speedcrunch/src/speedcrunch.pro.user", os.F_OK):
- os.remove(srcPath + "/creator-test-data/speedcrunch/src/speedcrunch.pro.user")
- if os.access(srcPath + "/creator/qtcreator.pro.user", os.F_OK):
- os.remove(srcPath + "/creator/qtcreator.pro.user")