| 
									
										
										
										
											2016-01-15 14:55:33 +01:00
										 |  |  | ############################################################################ | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Copyright (C) 2016 The Qt Company Ltd. | 
					
						
							|  |  |  | # Contact: https://www.qt.io/licensing/ | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # This file is part of Qt Creator. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Commercial License Usage | 
					
						
							|  |  |  | # Licensees holding valid commercial Qt licenses may use this file in | 
					
						
							|  |  |  | # accordance with the commercial license agreement provided with the | 
					
						
							|  |  |  | # Software or, alternatively, in accordance with the terms contained in | 
					
						
							|  |  |  | # a written agreement between you and The Qt Company. For licensing terms | 
					
						
							|  |  |  | # and conditions see https://www.qt.io/terms-conditions. For further | 
					
						
							|  |  |  | # information use the contact form at https://www.qt.io/contact-us. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # GNU General Public License Usage | 
					
						
							|  |  |  | # Alternatively, this file may be used under the terms of the GNU | 
					
						
							|  |  |  | # General Public License version 3 as published by the Free Software | 
					
						
							|  |  |  | # Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT | 
					
						
							|  |  |  | # included in the packaging of this file. Please review the following | 
					
						
							|  |  |  | # information to ensure the GNU General Public License requirements will | 
					
						
							|  |  |  | # be met: https://www.gnu.org/licenses/gpl-3.0.html. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | ############################################################################ | 
					
						
							| 
									
										
										
										
											2013-05-15 13:17:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  | source("../../shared/qtcreator.py") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # test bookmark functionality | 
					
						
							|  |  |  | def renameBookmarkFolder(view, item, newName): | 
					
						
							| 
									
										
										
										
											2013-03-19 13:08:51 +01:00
										 |  |  |     invokeContextMenuItemOnBookmarkFolder(view, item, "Rename Folder") | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |     replaceEditorContent(waitForObject(":Add Bookmark.treeView_QExpandingLineEdit"), newName) | 
					
						
							|  |  |  |     type(waitForObject(":Add Bookmark.treeView_QExpandingLineEdit"), "<Return>") | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |     return | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-19 13:08:51 +01:00
										 |  |  | def invokeContextMenuItemOnBookmarkFolder(view, item, menuItem): | 
					
						
							|  |  |  |     aboveWidget = "{name='line' type='QFrame' visible='1' window=':Add Bookmark_BookmarkDialog'}" | 
					
						
							|  |  |  |     mouseClick(waitForObjectItem(view, item), 5, 5, 0, Qt.LeftButton) | 
					
						
							|  |  |  |     openItemContextMenu(view, item, 5, 5, 0) | 
					
						
							|  |  |  |     activateItem(waitForObject("{aboveWidget=%s type='QMenu' unnamed='1' visible='1' " | 
					
						
							|  |  |  |                                "window=':Add Bookmark_BookmarkDialog'}" % aboveWidget), menuItem) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-25 13:44:21 +02:00
										 |  |  | def textForQtVersion(text): | 
					
						
							| 
									
										
										
										
											2015-06-18 13:58:27 +02:00
										 |  |  |     suffix = "Qt Creator Manual" | 
					
						
							|  |  |  |     if text != suffix: | 
					
						
							|  |  |  |         text += " | " + suffix | 
					
						
							|  |  |  |     return text | 
					
						
							| 
									
										
										
										
											2013-09-25 13:44:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  | def main(): | 
					
						
							|  |  |  |     startApplication("qtcreator" + SettingsPath) | 
					
						
							| 
									
										
										
										
											2013-02-22 14:31:39 +01:00
										 |  |  |     if not startedWithoutPluginError(): | 
					
						
							|  |  |  |         return | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |     # goto help mode and click on topic | 
					
						
							|  |  |  |     switchViewTo(ViewConstants.HELP) | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |     manualQModelIndex = getQModelIndexStr("text?='Qt Creator Manual *'", | 
					
						
							|  |  |  |                                           ":Qt Creator_QHelpContentWidget") | 
					
						
							|  |  |  |     doubleClick(manualQModelIndex, 5, 5, 0, Qt.LeftButton) | 
					
						
							|  |  |  |     mouseClick(waitForObject(getQModelIndexStr("text='Building and Running an Example'", | 
					
						
							| 
									
										
										
										
											2013-11-26 11:03:21 +01:00
										 |  |  |                                                manualQModelIndex)), 5, 5, 0, Qt.LeftButton) | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |     # open bookmarks window | 
					
						
							|  |  |  |     clickButton(waitForObject(":Qt Creator.Add Bookmark_QToolButton")) | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |     clickButton(waitForObject(":Add Bookmark.ExpandBookmarksList_QToolButton")) | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |     # create root bookmark directory | 
					
						
							|  |  |  |     clickButton(waitForObject(":Add Bookmark.New Folder_QPushButton")) | 
					
						
							|  |  |  |     # rename root bookmark directory | 
					
						
							|  |  |  |     bookmarkView = waitForObject(":Add Bookmark.treeView_QTreeView") | 
					
						
							|  |  |  |     renameBookmarkFolder(bookmarkView, "New Folder*", "Sample") | 
					
						
							|  |  |  |     # create two more subfolders | 
					
						
							|  |  |  |     clickButton(waitForObject(":Add Bookmark.New Folder_QPushButton")) | 
					
						
							|  |  |  |     renameBookmarkFolder(bookmarkView, "Sample.New Folder*", "Folder 1") | 
					
						
							|  |  |  |     clickButton(waitForObject(":Add Bookmark.New Folder_QPushButton")) | 
					
						
							|  |  |  |     renameBookmarkFolder(bookmarkView, "Sample.Folder 1.New Folder*", "Folder 2") | 
					
						
							|  |  |  |     clickButton(waitForObject(":Add Bookmark.OK_QPushButton")) | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |     mouseClick(manualQModelIndex, 5, 5, 0, Qt.LeftButton) | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |     type(waitForObject(":Qt Creator_QHelpContentWidget"), "<Down>") | 
					
						
							|  |  |  |     clickButton(waitForObject(":Qt Creator.Add Bookmark_QToolButton")) | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |     clickButton(waitForObject(":Add Bookmark.ExpandBookmarksList_QToolButton")) | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |     # click on "Sample" and create new directory under it | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |     mouseClick(waitForObject(getQModelIndexStr("text='Sample'", ":Add Bookmark.treeView_QTreeView"))) | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |     clickButton(waitForObject(":Add Bookmark.New Folder_QPushButton")) | 
					
						
							|  |  |  |     clickButton(waitForObject(":Add Bookmark.OK_QPushButton")) | 
					
						
							|  |  |  |     # choose bookmarks | 
					
						
							|  |  |  |     mouseClick(waitForObjectItem(":Qt Creator_Core::Internal::CommandComboBox", "Bookmarks")) | 
					
						
							|  |  |  |     # verify if all folders are created and bookmarks present | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |     sampleQModelIndex = getQModelIndexStr("text='Sample'", ":Qt Creator_Bookmarks_TreeView") | 
					
						
							|  |  |  |     folder1QModelIndex = getQModelIndexStr("text='Folder 1'", sampleQModelIndex) | 
					
						
							|  |  |  |     folder2QModelIndex = getQModelIndexStr("text='Folder 2'", folder1QModelIndex) | 
					
						
							| 
									
										
										
										
											2013-09-25 13:44:21 +02:00
										 |  |  |     bldRunQModelIndex = getQModelIndexStr("text?='%s'" % textForQtVersion("Building and Running an Example*"), | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |                                           folder2QModelIndex) | 
					
						
							|  |  |  |     newFolderQModelIndex = getQModelIndexStr("text='New Folder'", sampleQModelIndex) | 
					
						
							| 
									
										
										
										
											2013-09-25 13:44:21 +02:00
										 |  |  |     manualQModelIndex = getQModelIndexStr("text='%s'" % textForQtVersion("Qt Creator Manual"), | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |                                              newFolderQModelIndex) | 
					
						
							|  |  |  |     test.verify(checkIfObjectExists(sampleQModelIndex, verboseOnFail = True) and | 
					
						
							|  |  |  |                 checkIfObjectExists(folder1QModelIndex, verboseOnFail = True) and | 
					
						
							|  |  |  |                 checkIfObjectExists(folder2QModelIndex, verboseOnFail = True) and | 
					
						
							|  |  |  |                 checkIfObjectExists(bldRunQModelIndex, verboseOnFail = True) and | 
					
						
							|  |  |  |                 checkIfObjectExists(manualQModelIndex, verboseOnFail = True), | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |                 "Verifying if all folders and bookmarks are present") | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |     mouseClick(waitForObject(":Qt Creator_Bookmarks_TreeView"), 5, 5, 0, Qt.LeftButton) | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |     for i in range(6): | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |         type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "<Right>") | 
					
						
							|  |  |  |     type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "<Return>") | 
					
						
							| 
									
										
										
										
											2014-05-20 15:56:27 +02:00
										 |  |  |     test.verify(textForQtVersion("Building and Running an Example") in getHelpTitle(), | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |                 "Verifying if first bookmark is opened") | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |     mouseClick(waitForObject(bldRunQModelIndex)) | 
					
						
							|  |  |  |     type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "<Down>") | 
					
						
							|  |  |  |     type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "<Right>") | 
					
						
							|  |  |  |     type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "<Down>") | 
					
						
							|  |  |  |     type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "<Return>") | 
					
						
							| 
									
										
										
										
											2014-05-20 15:56:27 +02:00
										 |  |  |     test.verify(textForQtVersion("Qt Creator Manual") in getHelpTitle(), | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |                 "Verifying if second bookmark is opened") | 
					
						
							|  |  |  |     # delete previously created directory | 
					
						
							|  |  |  |     clickButton(waitForObject(":Qt Creator.Add Bookmark_QToolButton")) | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |     clickButton(waitForObject(":Add Bookmark.ExpandBookmarksList_QToolButton")) | 
					
						
							| 
									
										
										
										
											2013-03-19 13:08:51 +01:00
										 |  |  |     invokeContextMenuItemOnBookmarkFolder(":Add Bookmark.treeView_QTreeView", "Sample.Folder 1", | 
					
						
							|  |  |  |                                           "Delete Folder") | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |     clickButton(waitForObject("{container=':Add Bookmark.treeView_QTreeView' text='Yes' " | 
					
						
							| 
									
										
										
										
											2013-03-19 13:08:51 +01:00
										 |  |  |                               "type='QPushButton' unnamed='1' visible='1'}")) | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |     # close bookmarks | 
					
						
							|  |  |  |     clickButton(waitForObject(":Add Bookmark.OK_QPushButton")) | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |     # choose bookmarks from command combobox | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |     mouseClick(waitForObject(":Qt Creator_Core::Internal::CommandComboBox")) | 
					
						
							|  |  |  |     mouseClick(waitForObjectItem(":Qt Creator_Core::Internal::CommandComboBox", "Bookmarks")) | 
					
						
							|  |  |  |     # verify if folders and bookmark deleted | 
					
						
							| 
									
										
										
										
											2012-09-07 14:49:16 +02:00
										 |  |  |     test.verify(checkIfObjectExists(sampleQModelIndex, verboseOnFail = True) and | 
					
						
							|  |  |  |                 checkIfObjectExists(folder1QModelIndex, shouldExist = False, verboseOnFail = True) and | 
					
						
							|  |  |  |                 checkIfObjectExists(folder2QModelIndex, shouldExist = False, verboseOnFail = True) and | 
					
						
							|  |  |  |                 checkIfObjectExists(bldRunQModelIndex, shouldExist = False, verboseOnFail = True) and | 
					
						
							|  |  |  |                 checkIfObjectExists(manualQModelIndex, verboseOnFail = True), | 
					
						
							| 
									
										
										
										
											2012-03-21 14:48:31 +01:00
										 |  |  |                 "Verifying if folder 1 and folder 2 deleted including their bookmark") | 
					
						
							|  |  |  |     # exit | 
					
						
							|  |  |  |     invokeMenuItem("File", "Exit") |