forked from qt-creator/qt-creator
		
	Change-Id: Ie74b0dd42d14e594e436408e39db20554904b84e Reviewed-by: Robert Loehning <robert.loehning@digia.com>
		
			
				
	
	
		
			65 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
source("../../shared/qtcreator.py")
 | 
						|
 | 
						|
def main():
 | 
						|
    startApplication("qtcreator" + SettingsPath)
 | 
						|
    if not startedWithoutPluginError():
 | 
						|
        return
 | 
						|
    targets = Targets.desktopTargetClasses()
 | 
						|
    if not checkDebuggingLibrary(Targets.intToArray(targets)):
 | 
						|
        test.fatal("Error while checking debugging libraries - leaving this test.")
 | 
						|
        invokeMenuItem("File", "Exit")
 | 
						|
        return
 | 
						|
    # using a temporary directory won't mess up a potentially existing
 | 
						|
    workingDir = tempDir()
 | 
						|
    checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targets)
 | 
						|
    editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
 | 
						|
    if placeCursorToLine(editor, "MouseArea.*", True):
 | 
						|
        type(editor, '<Up>')
 | 
						|
        type(editor, '<Return>')
 | 
						|
        typeLines(editor, ['Timer {',
 | 
						|
                           'interval: 1000',
 | 
						|
                           'running: true',
 | 
						|
                           'onTriggered: console.log("Break here")'])
 | 
						|
        invokeMenuItem("File", "Save All")
 | 
						|
        filesAndLines = [
 | 
						|
                        { "%s.QML.qml/%s.main\\.qml" % (projectName,projectName) : 'onTriggered.*' },
 | 
						|
                        { "%s.Sources.main\\.cpp" % projectName : "viewer.setOrientation\\(.+\\);" }
 | 
						|
                        ]
 | 
						|
        test.log("Setting breakpoints")
 | 
						|
        result = setBreakpointsForCurrentProject(filesAndLines)
 | 
						|
        if result:
 | 
						|
            expectedBreakpointsOrder = [{os.path.join(workingDir, projectName, "main.cpp"):10},
 | 
						|
                                        {os.path.join(workingDir, projectName, "qml", projectName, "main.qml"):13}]
 | 
						|
            # Only use 4.7.4 to work around QTBUG-25187
 | 
						|
            availableConfigs = iterateBuildConfigs(len(checkedTargets), "Debug")
 | 
						|
            if not availableConfigs:
 | 
						|
                test.fatal("Haven't found a suitable Qt version (need Qt 4.7.4) - leaving without debugging.")
 | 
						|
            for kit, config in availableConfigs:
 | 
						|
                test.log("Selecting '%s' as build config" % config)
 | 
						|
                selectBuildConfig(len(checkedTargets), kit, config)
 | 
						|
                verifyBuildConfig(len(checkedTargets), kit, True, enableQmlDebug=True)
 | 
						|
                # explicitly build before start debugging for adding the executable as allowed program to WinFW
 | 
						|
                invokeMenuItem("Build", "Rebuild All")
 | 
						|
                waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}",
 | 
						|
                              "buildQueueFinished(bool)", 300000)
 | 
						|
                if not checkCompile():
 | 
						|
                    test.fatal("Compile had errors... Skipping current build config")
 | 
						|
                    continue
 | 
						|
                allowAppThroughWinFW(workingDir, projectName, False)
 | 
						|
                if not doSimpleDebugging(len(checkedTargets), kit, config,
 | 
						|
                                         2, expectedBreakpointsOrder):
 | 
						|
                    try:
 | 
						|
                        stopB = findObject(':Qt Creator.Stop_QToolButton')
 | 
						|
                        if stopB.enabled:
 | 
						|
                            clickButton(stopB)
 | 
						|
                    except:
 | 
						|
                        pass
 | 
						|
                deleteAppFromWinFW(workingDir, projectName, False)
 | 
						|
                # close application output window of current run to avoid mixing older output on the next run
 | 
						|
                ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
 | 
						|
                clickButton(waitForObject("{type='CloseButton' unnamed='1' visible='1' "
 | 
						|
                                          "window=':Qt Creator_Core::Internal::MainWindow'}"))
 | 
						|
        else:
 | 
						|
            test.fatal("Setting breakpoints failed - leaving without testing.")
 | 
						|
    invokeMenuItem("File", "Exit")
 |