forked from qt-creator/qt-creator
		
	Merge remote-tracking branch 'origin/7.0'
Conflicts: src/plugins/webassembly/webassemblyrunconfiguration.cpp src/tools/processlauncher/launchersockethandler.cpp Change-Id: Iab052af98013aa59282c16f22ae6e9ecb32f50c4
This commit is contained in:
		@@ -226,11 +226,11 @@ def logApplicationOutput():
 | 
			
		||||
# get the output from a given cmdline call
 | 
			
		||||
def getOutputFromCmdline(cmdline, environment=None, acceptedError=0):
 | 
			
		||||
    try:
 | 
			
		||||
        return subprocess.check_output(cmdline, env=environment)
 | 
			
		||||
        return stringify(subprocess.check_output(cmdline, env=environment))
 | 
			
		||||
    except subprocess.CalledProcessError as e:
 | 
			
		||||
        if e.returncode != acceptedError:
 | 
			
		||||
            test.warning("Command '%s' returned %d" % (e.cmd, e.returncode))
 | 
			
		||||
        return e.output
 | 
			
		||||
        return stringify(e.output)
 | 
			
		||||
 | 
			
		||||
def selectFromFileDialog(fileName, waitForFile=False, ignoreFinalSnooze=False):
 | 
			
		||||
    def __closePopupIfNecessary__():
 | 
			
		||||
@@ -238,41 +238,29 @@ def selectFromFileDialog(fileName, waitForFile=False, ignoreFinalSnooze=False):
 | 
			
		||||
            test.log("Closing active popup widget")
 | 
			
		||||
            QApplication.activePopupWidget().close()
 | 
			
		||||
 | 
			
		||||
    if platform.system() == "Darwin":
 | 
			
		||||
    fName = os.path.basename(os.path.abspath(fileName))
 | 
			
		||||
    pName = os.path.dirname(os.path.abspath(fileName)) + os.sep
 | 
			
		||||
    try:
 | 
			
		||||
        waitForObject("{name='QFileDialog' type='QFileDialog' visible='1'}", 5000)
 | 
			
		||||
        pathLine = waitForObject("{name='fileNameEdit' type='QLineEdit' visible='1'}")
 | 
			
		||||
        replaceEditorContent(pathLine, pName)
 | 
			
		||||
        snooze(1)
 | 
			
		||||
        nativeType("<Command+Shift+g>")
 | 
			
		||||
        clickButton(waitForObject("{text='Open' type='QPushButton'}"))
 | 
			
		||||
        waitFor("str(pathLine.text)==''")
 | 
			
		||||
        replaceEditorContent(pathLine, fName)
 | 
			
		||||
        snooze(1)
 | 
			
		||||
        nativeType(fileName)
 | 
			
		||||
        snooze(2)
 | 
			
		||||
        nativeType("<Return>")
 | 
			
		||||
        snooze(3)
 | 
			
		||||
        __closePopupIfNecessary__()
 | 
			
		||||
        clickButton(waitForObject("{text='Open' type='QPushButton'}"))
 | 
			
		||||
    except:
 | 
			
		||||
        nativeType("<Ctrl+a>")
 | 
			
		||||
        nativeType("<Delete>")
 | 
			
		||||
        nativeType(pName + fName)
 | 
			
		||||
        seconds = len(pName + fName) / 20
 | 
			
		||||
        test.log("Using snooze(%d) [problems with event processing of nativeType()]" % seconds)
 | 
			
		||||
        snooze(seconds)
 | 
			
		||||
        nativeType("<Return>")
 | 
			
		||||
        if not ignoreFinalSnooze:
 | 
			
		||||
            snooze(1)
 | 
			
		||||
    else:
 | 
			
		||||
        fName = os.path.basename(os.path.abspath(fileName))
 | 
			
		||||
        pName = os.path.dirname(os.path.abspath(fileName)) + os.sep
 | 
			
		||||
        try:
 | 
			
		||||
            waitForObject("{name='QFileDialog' type='QFileDialog' visible='1'}", 5000)
 | 
			
		||||
            pathLine = waitForObject("{name='fileNameEdit' type='QLineEdit' visible='1'}")
 | 
			
		||||
            replaceEditorContent(pathLine, pName)
 | 
			
		||||
            snooze(1)
 | 
			
		||||
            clickButton(waitForObject("{text='Open' type='QPushButton'}"))
 | 
			
		||||
            waitFor("str(pathLine.text)==''")
 | 
			
		||||
            replaceEditorContent(pathLine, fName)
 | 
			
		||||
            snooze(1)
 | 
			
		||||
            __closePopupIfNecessary__()
 | 
			
		||||
            clickButton(waitForObject("{text='Open' type='QPushButton'}"))
 | 
			
		||||
        except:
 | 
			
		||||
            nativeType("<Ctrl+a>")
 | 
			
		||||
            nativeType("<Delete>")
 | 
			
		||||
            nativeType(pName + fName)
 | 
			
		||||
            seconds = len(pName + fName) / 20
 | 
			
		||||
            test.log("Using snooze(%d) [problems with event processing of nativeType()]" % seconds)
 | 
			
		||||
            snooze(seconds)
 | 
			
		||||
            nativeType("<Return>")
 | 
			
		||||
            if not ignoreFinalSnooze:
 | 
			
		||||
                snooze(3)
 | 
			
		||||
            snooze(3)
 | 
			
		||||
    if waitForFile:
 | 
			
		||||
        fileCombo = waitForObject(":Qt Creator_FilenameQComboBox")
 | 
			
		||||
        if not waitFor("str(fileCombo.currentText) in fileName", 5000):
 | 
			
		||||
@@ -447,6 +435,7 @@ def iterateQtVersions(keepOptionsOpen=False, alreadyOnOptionsDialog=False,
 | 
			
		||||
        rootChildText = str(rootIndex.data()).replace(".", "\\.").replace("_", "\\_")
 | 
			
		||||
        for subIndex in dumpIndices(model, rootIndex):
 | 
			
		||||
            subChildText = str(subIndex.data()).replace(".", "\\.").replace("_", "\\_")
 | 
			
		||||
            treeView.scrollTo(subIndex)
 | 
			
		||||
            mouseClick(waitForObjectItem(treeView, ".".join([rootChildText,subChildText])))
 | 
			
		||||
            currentText = str(waitForObject(":QtSupport__Internal__QtVersionManager.QLabel").text)
 | 
			
		||||
            matches = pattern.match(currentText)
 | 
			
		||||
@@ -684,3 +673,12 @@ def isString(sth):
 | 
			
		||||
        return isinstance(sth, str)
 | 
			
		||||
    else:
 | 
			
		||||
        return isinstance(sth, (str, unicode))
 | 
			
		||||
 | 
			
		||||
# helper function to ensure we get str, converts bytes if necessary
 | 
			
		||||
def stringify(obj):
 | 
			
		||||
    stringTypes = (str, unicode) if sys.version_info.major == 2 else (str)
 | 
			
		||||
    if isinstance(obj, stringTypes):
 | 
			
		||||
        return obj
 | 
			
		||||
    if isinstance(obj, bytes):
 | 
			
		||||
        tmp = obj.decode('cp1252') if platform.system() in ('Microsoft','Windows') else obj.decode()
 | 
			
		||||
        return tmp
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user