| 
									
										
										
										
											2012-03-26 14:13:39 +02:00
										 |  |  | source("../../shared/qtcreator.py") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | workingDir = None | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def main(): | 
					
						
							|  |  |  |     global workingDir | 
					
						
							|  |  |  |     startApplication("qtcreator" + SettingsPath) | 
					
						
							| 
									
										
										
										
											2012-05-11 17:38:58 +02:00
										 |  |  |     if not checkDebuggingLibrary("4.7.4", [QtQuickConstants.Targets.DESKTOP]): | 
					
						
							| 
									
										
										
										
											2012-03-26 14:13:39 +02:00
										 |  |  |         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() | 
					
						
							|  |  |  |     projectName = createNewQtQuickApplication(workingDir, targets = QtQuickConstants.Targets.DESKTOP) | 
					
						
							|  |  |  |     # wait for parsing to complete | 
					
						
							|  |  |  |     waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", | 
					
						
							|  |  |  |                   "sourceFilesRefreshed(QStringList)") | 
					
						
							| 
									
										
										
										
											2012-09-05 16:49:35 +02:00
										 |  |  |     editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") | 
					
						
							| 
									
										
										
										
											2012-03-26 14:13:39 +02:00
										 |  |  |     if placeCursorToLine(editor, "MouseArea.*", True): | 
					
						
							|  |  |  |         type(editor, '<Up>') | 
					
						
							|  |  |  |         type(editor, '<Return>') | 
					
						
							| 
									
										
										
										
											2012-05-11 17:38:58 +02:00
										 |  |  |         typeLines(editor, ['Timer {', | 
					
						
							|  |  |  |                            'interval: 1000', | 
					
						
							|  |  |  |                            'running: true', | 
					
						
							|  |  |  |                            'onTriggered: console.log("Break here")']) | 
					
						
							| 
									
										
										
										
											2012-03-26 14:13:39 +02:00
										 |  |  |         invokeMenuItem("File", "Save All") | 
					
						
							| 
									
										
										
										
											2012-05-03 11:47:35 +02:00
										 |  |  |         filesAndLines = [ | 
					
						
							|  |  |  |                         { "%s.QML.qml/%s.main\\.qml" % (projectName,projectName) : 'onTriggered.*' }, | 
					
						
							|  |  |  |                         { "%s.Sources.main\\.cpp" % projectName : "viewer.setOrientation\\(.+\\);" } | 
					
						
							|  |  |  |                         ] | 
					
						
							| 
									
										
										
										
											2012-03-26 14:13:39 +02:00
										 |  |  |         test.log("Setting breakpoints") | 
					
						
							|  |  |  |         result = setBreakpointsForCurrentProject(filesAndLines) | 
					
						
							|  |  |  |         if result: | 
					
						
							| 
									
										
										
										
											2012-08-23 15:06:39 +02:00
										 |  |  |             expectedBreakpointsOrder = [{"main.cpp":9}, {"main.qml":13}] | 
					
						
							| 
									
										
										
										
											2012-05-11 17:38:58 +02:00
										 |  |  |             # Only use 4.7.4 to work around QTBUG-25187 | 
					
						
							| 
									
										
										
										
											2012-07-20 14:18:49 +02:00
										 |  |  |             availableConfigs = iterateBuildConfigs(1, 0, "Debug") | 
					
						
							| 
									
										
										
										
											2012-03-26 14:13:39 +02:00
										 |  |  |             if not availableConfigs: | 
					
						
							| 
									
										
										
										
											2012-05-11 17:38:58 +02:00
										 |  |  |                 test.fatal("Haven't found a suitable Qt version (need Qt 4.7.4) - leaving without debugging.") | 
					
						
							| 
									
										
										
										
											2012-03-26 14:13:39 +02:00
										 |  |  |             for config in availableConfigs: | 
					
						
							|  |  |  |                 test.log("Selecting '%s' as build config" % config) | 
					
						
							|  |  |  |                 selectBuildConfig(1, 0, config) | 
					
						
							| 
									
										
										
										
											2012-05-11 17:38:58 +02:00
										 |  |  |                 verifyBuildConfig(1, 0, True, enableQmlDebug=True) | 
					
						
							| 
									
										
										
										
											2012-03-26 14:13:39 +02:00
										 |  |  |                 # 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(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") |