From 756fb87983d44ba706eb7b6db95750094a12e2e1 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 25 Aug 2011 10:05:28 +0200 Subject: [PATCH] Initial commit of squish tests for creator. Change-Id: Ic499b3c36d37f9789276f60a41642ffc7ee816d1 Reviewed-on: http://codereview.qt.nokia.com/3047 Reviewed-by: Qt Sanity Bot Reviewed-by: Bill King --- tests/system/objects.map | 13 +++ .../system/settings/unix/Nokia/QtCreator.ini | 2 + .../system/settings/unix/Nokia/qtversion.xml | 53 +++++++++ .../system/settings/unix/Nokia/toolChains.xml | 13 +++ .../settings/windows/Nokia/QtCreator.ini | 2 + .../settings/windows/Nokia/qtversion.xml | 107 ++++++++++++++++++ .../settings/windows/Nokia/toolChains.xml | 33 ++++++ tests/system/shared/mainwin.py | 13 +++ tests/system/shared/qtcreator.py | 24 ++++ tests/system/shared/utils.py | 63 +++++++++++ tests/system/suite_general/envvars | 1 + .../shared/testdata/creator_tree.tsv | 1 + .../suite_general/shared/testdata/qt_tree.tsv | 3 + .../shared/testdata/speedcrunch_tree.tsv | 1 + tests/system/suite_general/suite.conf | 12 ++ .../tst_basic_cpp_support/test.py | 97 ++++++++++++++++ .../tst_build_speedcrunch/test.py | 52 +++++++++ .../tst_cmake_speedcrunch/test.py | 61 ++++++++++ .../suite_general/tst_openqt_creator/test.py | 63 +++++++++++ 19 files changed, 614 insertions(+) create mode 100644 tests/system/objects.map create mode 100644 tests/system/settings/unix/Nokia/QtCreator.ini create mode 100644 tests/system/settings/unix/Nokia/qtversion.xml create mode 100644 tests/system/settings/unix/Nokia/toolChains.xml create mode 100644 tests/system/settings/windows/Nokia/QtCreator.ini create mode 100644 tests/system/settings/windows/Nokia/qtversion.xml create mode 100644 tests/system/settings/windows/Nokia/toolChains.xml create mode 100644 tests/system/shared/mainwin.py create mode 100644 tests/system/shared/qtcreator.py create mode 100644 tests/system/shared/utils.py create mode 100644 tests/system/suite_general/envvars create mode 100644 tests/system/suite_general/shared/testdata/creator_tree.tsv create mode 100644 tests/system/suite_general/shared/testdata/qt_tree.tsv create mode 100644 tests/system/suite_general/shared/testdata/speedcrunch_tree.tsv create mode 100644 tests/system/suite_general/suite.conf create mode 100644 tests/system/suite_general/tst_basic_cpp_support/test.py create mode 100644 tests/system/suite_general/tst_build_speedcrunch/test.py create mode 100644 tests/system/suite_general/tst_cmake_speedcrunch/test.py create mode 100644 tests/system/suite_general/tst_openqt_creator/test.py diff --git a/tests/system/objects.map b/tests/system/objects.map new file mode 100644 index 00000000000..a512dd9ed13 --- /dev/null +++ b/tests/system/objects.map @@ -0,0 +1,13 @@ +:*Qt Creator.findEdit_Utils::FilterLineEdit {name='findEdit' type='Utils::FilterLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:*Qt Creator_Utils::FilterLineEdit {type='Utils::FilterLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:*Qt Creator_Utils::IconButton {occurrence='4' type='Utils::IconButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:CMake Wizard.Finish_QPushButton {text='Finish' type='QPushButton' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} +:CMake Wizard.Next_QPushButton {name='__qt__passive_wizardbutton1' text='Next' type='QPushButton' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} +:CMake Wizard.Run CMake_QPushButton {text='Run CMake' type='QPushButton' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} +:CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard {type='CMakeProjectManager::Internal::CMakeOpenProjectWizard' unnamed='1' visible='1' windowTitle='CMake Wizard'} +:Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' unnamed='1' visible='1' windowTitle?='*Qt Creator'} +:Qt Creator_CppEditor::Internal::CPPEditorWidget {type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_Utils::IconButton {occurrence='2' type='Utils::IconButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:projects.projects.pro_QModelIndex {column='0' container=':projects_QModelIndex' text='projects.pro' type='QModelIndex'} +:projects_QModelIndex {column='0' container=':Qt Creator_Utils::NavigationTreeView' text='projects' type='QModelIndex'} diff --git a/tests/system/settings/unix/Nokia/QtCreator.ini b/tests/system/settings/unix/Nokia/QtCreator.ini new file mode 100644 index 00000000000..b77fccec036 --- /dev/null +++ b/tests/system/settings/unix/Nokia/QtCreator.ini @@ -0,0 +1,2 @@ +[%General] +OverrideLanguage=C diff --git a/tests/system/settings/unix/Nokia/qtversion.xml b/tests/system/settings/unix/Nokia/qtversion.xml new file mode 100644 index 00000000000..6b1fca2ac31 --- /dev/null +++ b/tests/system/settings/unix/Nokia/qtversion.xml @@ -0,0 +1,53 @@ + + + + + + QtVersion.0 + + 4 + Qt for Fremantle PR1.3 Devices (Qt SDK) + ~/QtSDK/Maemo/4.6.2/targets/fremantle-pr13/bin/qmake + Qt4ProjectManager.QtVersion.Maemo + false + + + + QtVersion.1 + + 5 + Desktop Qt 4.7.3 for GCC (Qt SDK) + ~/QtSDK/Desktop/Qt/473/gcc/bin/qmake + Qt4ProjectManager.QtVersion.Desktop + false + + + + QtVersion.2 + + 6 + Simulator Qt for GCC (Qt SDK) + ~/QtSDK/Simulator/Qt/gcc/bin/qmake + Qt4ProjectManager.QtVersion.Simulator + false + + + + QtVersion.3 + + 8 + 4.7.0 + /usr/bin/qmake + Qt4ProjectManager.QtVersion.Desktop + false + + + + QtVersion.Count + 4 + + + Version + 1 + + diff --git a/tests/system/settings/unix/Nokia/toolChains.xml b/tests/system/settings/unix/Nokia/toolChains.xml new file mode 100644 index 00000000000..5d641648ccb --- /dev/null +++ b/tests/system/settings/unix/Nokia/toolChains.xml @@ -0,0 +1,13 @@ + + + + + + ToolChain.Count + 0 + + + Version + 1 + + diff --git a/tests/system/settings/windows/Nokia/QtCreator.ini b/tests/system/settings/windows/Nokia/QtCreator.ini new file mode 100644 index 00000000000..b77fccec036 --- /dev/null +++ b/tests/system/settings/windows/Nokia/QtCreator.ini @@ -0,0 +1,2 @@ +[%General] +OverrideLanguage=C diff --git a/tests/system/settings/windows/Nokia/qtversion.xml b/tests/system/settings/windows/Nokia/qtversion.xml new file mode 100644 index 00000000000..88c39ab5dad --- /dev/null +++ b/tests/system/settings/windows/Nokia/qtversion.xml @@ -0,0 +1,107 @@ + + + + + + QtVersion.0 + + 2 + Qt 4.7.3 for Desktop - MinGW 4.4 (Qt SDK) + c:/qtsdk/desktop/qt/4.7.3/mingw/bin/qmake.exe + Qt4ProjectManager.QtVersion.Desktop + false + + + + QtVersion.1 + + 3 + Simulator Qt for Visual Studio 2008 (Qt SDK) + c:/qtsdk/simulator/qt/msvc2008/bin/qmake.exe + Qt4ProjectManager.QtVersion.Simulator + false + + + + QtVersion.2 + + 4 + Qt 4.7.3 for Desktop - MSVC2005 (Qt SDK) + c:/qtsdk/desktop/qt/4.7.3/msvc2005/bin/qmake.exe + Qt4ProjectManager.QtVersion.Desktop + false + + + + QtVersion.3 + + 5 + Simulator Qt for Visual Studio 2005 (Qt SDK) + c:/qtsdk/simulator/qt/msvc2005/bin/qmake.exe + Qt4ProjectManager.QtVersion.Simulator + false + + + + QtVersion.4 + + 6 + Qt 4.7.3 for Desktop - MSVC2008 (Qt SDK) + c:/qtsdk/desktop/qt/4.7.3/msvc2008/bin/qmake.exe + Qt4ProjectManager.QtVersion.Desktop + false + + + + QtVersion.5 + + 7 + Qt for Fremantle PR1.3 Devices (Qt SDK) + c:/qtsdk/maemo/4.6.2/targets/fremantle-pr13/bin/qmake.exe + Qt4ProjectManager.QtVersion.Maemo + false + + + + QtVersion.6 + + 8 + Simulator Qt for MinGW 4.4 (Qt SDK) + c:/qtsdk/simulator/qt/mingw/bin/qmake.exe + Qt4ProjectManager.QtVersion.Simulator + false + + + + QtVersion.7 + + 9 + Qt 4.7.3 for Symbian^1 (Qt SDK) + c:/qtsdk/symbian/sdks/symbian1qt473/bin/qmake.exe + Qt4ProjectManager.QtVersion.Symbian + + C:/QtSDK/Symbian/SDKs/Symbian1Qt473/ + false + + + + QtVersion.8 + + 10 + Qt 4.7.3 for Symbian^3 (Qt SDK) + c:/qtsdk/symbian/sdks/symbian3qt473/bin/qmake.exe + Qt4ProjectManager.QtVersion.Symbian + C:/QtSDK/Symbian/tools/sbs/bin + C:/QtSDK/Symbian/SDKs/Symbian3Qt473/ + false + + + + QtVersion.Count + 9 + + + Version + 1 + + diff --git a/tests/system/settings/windows/Nokia/toolChains.xml b/tests/system/settings/windows/Nokia/toolChains.xml new file mode 100644 index 00000000000..2b189f62fe8 --- /dev/null +++ b/tests/system/settings/windows/Nokia/toolChains.xml @@ -0,0 +1,33 @@ + + + + + + ToolChain.0 + + C:/QtSDK/pythongdb/python_2.7based/gdb-i686-pc-mingw32.exe + C:/QtSDK/mingw/bin/g++.exe + x86-windows-msys-pe-32bit + MinGW from SDK + ProjectExplorer.ToolChain.Mingw:C:/QtSDK/mingw/bin/g++.exe.x86-windows-msys-pe-32bit.C:/QtSDK/pythongdb/python_2.7based/gdb-i686-pc-mingw32.exe + + + + ToolChain.1 + + C:/QtSDK/pythongdb/python_2.7based/gdb-arm-none-symbianelf.exe + C:/QtSDK/Symbian/tools/gcce4/bin/arm-none-symbianelf-g++.exe + arm-symbian-device-elf-32bit + GCCE from SDK + Qt4ProjectManager.ToolChain.GCCE:C:/QtSDK/Symbian/tools/gcce4/bin/arm-none-symbianelf-g++.exe.arm-symbian-device-elf-32bit.C:/QtSDK/pythongdb/python_2.7based/gdb-arm-none-symbianelf.exe + + + + ToolChain.Count + 2 + + + Version + 1 + + diff --git a/tests/system/shared/mainwin.py b/tests/system/shared/mainwin.py new file mode 100644 index 00000000000..b08f1854976 --- /dev/null +++ b/tests/system/shared/mainwin.py @@ -0,0 +1,13 @@ + +def invokeMenuItem(menu, item): + menuObject = waitForObjectItem("{type='QMenuBar' visible='true'}", menu) + activateItem(menuObject) + activateItem(waitForObjectItem(menuObject, item)) + +def openProject(projectPath): + invokeMenuItem("File", "Open File or Project...") + waitForObject("{name='QFileDialog' type='QFileDialog' visible='1' windowTitle='Open File'}") + type(findObject("{name='fileNameEdit' type='QLineEdit'}"), projectPath) + clickButton(findObject("{text='Open' type='QPushButton'}")) + waitForObject("{type='Qt4ProjectManager::Internal::ProjectLoadWizard' visible='1' windowTitle='Project Setup'}") + clickButton(findObject("{text='Finish' type='QPushButton'}")) diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py new file mode 100644 index 00000000000..a960c9473db --- /dev/null +++ b/tests/system/shared/qtcreator.py @@ -0,0 +1,24 @@ +import platform; +import shutil; +import os; +import glob; + +SDKPath = '' +SettingsPath = '' +testSettings.logScreenshotOnFail = True + +source(findFile("scripts", "utils.py")) +source(findFile("scripts", "mainwin.py")) + +if platform.system() in ('Windows', 'Microsoft'): + SDKPath = "C:/QtSDK/src" + cwd = os.getcwd() # current dir is directory holding qtcreator.py + cwd+="/../../settings/windows" + cwd = os.path.abspath(cwd) + SettingsPath = " -settingspath %s" % cwd +else: + SDKPath = os.path.expanduser("~/QtSDK/src") + cwd = os.getcwd() # current dir is directory holding qtcreator.py + cwd+="/../../settings/unix" + cwd = os.path.abspath(cwd) + SettingsPath = " -settingspath %s" % cwd diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py new file mode 100644 index 00000000000..bc60707abae --- /dev/null +++ b/tests/system/shared/utils.py @@ -0,0 +1,63 @@ +import tempfile, shutil, os + +def tempDir(): + return tempfile.mkdtemp() + +def deleteDirIfExists(path): + shutil.rmtree(path, True) + +def verifyChecked(objectName): + object = waitForObject(objectName, 20000) + test.compare(object.checked, True) + return object + +def verifyEnabled(objectName): + object = waitForObject(objectName, 20000) + test.compare(object.enabled, True) + return object + +def selectFromCombo(objectName, itemName): + object = verifyEnabled(objectName) + mouseClick(object, 198, 7, 0, Qt.LeftButton) + mouseClick(waitForObjectItem(object, itemName), 84, 5, 0, Qt.LeftButton) + +def wordUnderCursor(window): + cursor = window.textCursor() + oldposition = cursor.position() + cursor.movePosition(QTextCursor.StartOfWord) + cursor.movePosition(QTextCursor.EndOfWord, QTextCursor.KeepAnchor) + returnValue = cursor.selectedText() + cursor.setPosition(oldposition) + return returnValue + +def lineUnderCursor(window): + cursor = window.textCursor() + oldposition = cursor.position() + cursor.movePosition(QTextCursor.StartOfLine) + cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor) + returnValue = cursor.selectedText() + cursor.setPosition(oldposition) + return returnValue + +def which(program): + def is_exe(fpath): + return os.path.exists(fpath) and os.access(fpath, os.X_OK) + + fpath, fname = os.path.split(program) + if fpath: + if is_exe(program): + return program + if platform.system() in ('Windows', 'Microsoft'): + if is_exe(program + ".exe"): + return program + ".exe" + + else: + for path in os.environ["PATH"].split(os.pathsep): + exe_file = os.path.join(path, program) + if is_exe(exe_file): + return exe_file + if platform.system() in ('Windows', 'Microsoft'): + if is_exe(exe_file + ".exe"): + return exe_file + ".exe" + + return None diff --git a/tests/system/suite_general/envvars b/tests/system/suite_general/envvars new file mode 100644 index 00000000000..00aad3eab7d --- /dev/null +++ b/tests/system/suite_general/envvars @@ -0,0 +1 @@ +QT_PLATFORM_PLUGIN=nonesuch diff --git a/tests/system/suite_general/shared/testdata/creator_tree.tsv b/tests/system/suite_general/shared/testdata/creator_tree.tsv new file mode 100644 index 00000000000..7c31458f157 --- /dev/null +++ b/tests/system/suite_general/shared/testdata/creator_tree.tsv @@ -0,0 +1 @@ +"node" "value" diff --git a/tests/system/suite_general/shared/testdata/qt_tree.tsv b/tests/system/suite_general/shared/testdata/qt_tree.tsv new file mode 100644 index 00000000000..e40c8e78f3b --- /dev/null +++ b/tests/system/suite_general/shared/testdata/qt_tree.tsv @@ -0,0 +1,3 @@ +"node" "value" +":projects.projects.pro_QModelIndex" "projects.pro" +":projects_QModelIndex" "projects" diff --git a/tests/system/suite_general/shared/testdata/speedcrunch_tree.tsv b/tests/system/suite_general/shared/testdata/speedcrunch_tree.tsv new file mode 100644 index 00000000000..7c31458f157 --- /dev/null +++ b/tests/system/suite_general/shared/testdata/speedcrunch_tree.tsv @@ -0,0 +1 @@ +"node" "value" diff --git a/tests/system/suite_general/suite.conf b/tests/system/suite_general/suite.conf new file mode 100644 index 00000000000..236351469d1 --- /dev/null +++ b/tests/system/suite_general/suite.conf @@ -0,0 +1,12 @@ +AUT=qtcreator +CLASS= +CLASSPATH= +CWD= +ENVVARS=envvars +HOOK_SUB_PROCESSES=true +IMPLICITAUTSTART=0 +LANGUAGE=Python +OBJECTMAP=../objects.map +TEST_CASES=tst_openqt_creator tst_build_speedcrunch tst_cmake_speedcrunch tst_basic_cpp_support +VERSION=2 +WRAPPERS=Qt diff --git a/tests/system/suite_general/tst_basic_cpp_support/test.py b/tests/system/suite_general/tst_basic_cpp_support/test.py new file mode 100644 index 00000000000..5ad959a98e9 --- /dev/null +++ b/tests/system/suite_general/tst_basic_cpp_support/test.py @@ -0,0 +1,97 @@ +source(findFile("scripts", "qtcreator.py")) + +refreshFinishedCount = 0 + +def handleRefreshFinished(object, fileList): + global refreshFinishedCount + refreshFinishedCount += 1 + + +def main(): + startApplication("qtcreator" + SettingsPath) + + installLazySignalHandler("{type='CppTools::Internal::CppModelManager'}", "sourceFilesRefreshed(QStringList)", "handleRefreshFinished") + test.verify(os.path.exists(SDKPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro")) + openProject(SDKPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro") + + waitFor("refreshFinishedCount == 1", 20000) + test.compare(refreshFinishedCount, 1) + + mouseClick(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), 110, 11, 0, Qt.LeftButton) + type(waitForObject(":*Qt Creator_Utils::FilterLineEdit"), "dummy.cpp") + # pause to wait for results to populate + snooze(1) + type(waitForObject(":*Qt Creator_Utils::FilterLineEdit"), "") + +# editorManager = waitForObject("{type='Core::EditorManager'}", 2000) +# t2 = editorManager.currentEditor() +# t3 = t2.file() +# t4 = t3.fileName +# test.compare(editorManager.currentEditor().file().fileName, "base.cpp") + cppwindow = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") + +# - Move the cursor to the usage of a variable. +# - Press F2 or select from the menu: Tools / C++ / Follow Symbol under Cursor +# Creator will show you the declaration of the variable. + + type(cppwindow, "") + type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), " xi") + type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "") + type(cppwindow, "") + test.compare(lineUnderCursor(findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "extern int xi;") + +# - Move the cursor to a function call. +# - Press F2 or select from the menu: Tools / C++ / Follow Symbol under Cursor +# Creator will show you the definition of the function. + type(cppwindow, "") + clickButton(waitForObject(":*Qt Creator_Utils::IconButton")) + type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "freefunc2") + type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "") + type(cppwindow, "") + test.compare(lineUnderCursor(findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "int freefunc2(double)") + +# - Move the cursor to a function declaration +# - Press Shift+F2 or select from menu: Tools / C++ / Switch Between Method Declaration/Definition +# Creator should show the definition of this function +# - Press Shift+F2 or select from menu: Tools / C++ / Switch Between Method Declaration/Definition again +# Creator should show the declaration of the function again. + mouseClick(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), 110, 11, 0, Qt.LeftButton) + clickButton(waitForObject(":Qt Creator_Utils::IconButton")) + type(waitForObject(":*Qt Creator_Utils::FilterLineEdit"), "dummy.cpp") + # pause to wait for results to populate + snooze(1) + type(waitForObject(":*Qt Creator_Utils::FilterLineEdit"), "") + + # Reset cursor to the start of the document + cursor = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget").textCursor() + cursor.movePosition(QTextCursor.Start) + cppwindow.setTextCursor(cursor) + + type(cppwindow, "") + clickButton(waitForObject(":*Qt Creator_Utils::IconButton")) + type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "Dummy::Dummy") + # Take us to the second instance + type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "") + type(cppwindow, "") + test.compare(lineUnderCursor(findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), " Dummy(int a);") + type(cppwindow, "") + test.compare(lineUnderCursor(findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "Dummy::Dummy(int)") + + invokeMenuItem("File", "Exit") + + +def init(): + cleanup() + +def cleanup(): + # Make sure the .user files are gone + + if os.access(SDKPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro.user", os.F_OK): + os.remove(SDKPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro.user") + + BuildPath = glob.glob(SDKPath + "/qtcreator-build-*") + BuildPath += glob.glob(SDKPath + "/projects-build-*") + + for dir in BuildPath: + if os.access(dir, os.F_OK): + shutil.rmtree(dir) diff --git a/tests/system/suite_general/tst_build_speedcrunch/test.py b/tests/system/suite_general/tst_build_speedcrunch/test.py new file mode 100644 index 00000000000..51730c40854 --- /dev/null +++ b/tests/system/suite_general/tst_build_speedcrunch/test.py @@ -0,0 +1,52 @@ +source(findFile("scripts", "qtcreator.py")) + +SpeedCrunchPath = "" +buildFinished = False +buildSucceeded = False + +def handleBuildFinished(object, success): + global buildFinished, buildSucceeded + buildFinished = True + buildSucceeded = success + +def main(): + startApplication("qtcreator" + SettingsPath) + + test.verify(os.path.exists(SpeedCrunchPath)) + openProject(SpeedCrunchPath) + + # Test that some of the expected items are in the navigation tree + for row, record in enumerate(testData.dataset("speedcrunch_tree.tsv")): + node = testData.field(record, "node") + value = testData.field(record, "value") + test.compare(waitForObject(node).text, value) + + # Invoke a rebuild of the application + invokeMenuItem("Build", "Rebuild All") + + # Wait for, and test if the build succeeded + installLazySignalHandler("{type='ProjectExplorer::BuildManager'}", "buildQueueFinished(bool)", "handleBuildFinished") + waitFor("buildFinished == True", 30000) + test.verify(buildSucceeded == 1) + + # Now that this has finished, test adding a new build configuration + + # Add a new run configuration + + invokeMenuItem("File", "Exit") + +def init(): + global SpeedCrunchPath + SpeedCrunchPath = SDKPath + "/creator-test-data/speedcrunch/src/speedcrunch.pro" + cleanup() + +def cleanup(): + # Make sure the .user files are gone + if os.access(SpeedCrunchPath + ".user", os.F_OK): + os.remove(SpeedCrunchPath + ".user") + + BuildPath = glob.glob(SDKPath + "/creator-test-data/speedcrunch/speedcrunch-build-*") + + for dir in BuildPath: + if os.access(dir, os.F_OK): + shutil.rmtree(dir) diff --git a/tests/system/suite_general/tst_cmake_speedcrunch/test.py b/tests/system/suite_general/tst_cmake_speedcrunch/test.py new file mode 100644 index 00000000000..6690cbd651c --- /dev/null +++ b/tests/system/suite_general/tst_cmake_speedcrunch/test.py @@ -0,0 +1,61 @@ +source(findFile("scripts", "qtcreator.py")) + +SpeedCrunchPath = "" +buildFinished = False +buildSucceeded = False + +def handleBuildFinished(object, success): + global buildFinished, buildSucceeded + buildFinished = True + buildSucceeded = success + +def main(): + if(which("cmake") == None): + test.fatal("cmake not found") + return + + startApplication("qtcreator" + SettingsPath) + + invokeMenuItem("File", "Open File or Project...") + + test.verify(os.path.exists(SpeedCrunchPath)) + waitForObject("{name='QFileDialog' type='QFileDialog' visible='1' windowTitle='Open File'}", 20000) + type(findObject("{name='fileNameEdit' type='QLineEdit'}"), SpeedCrunchPath) + clickButton(findObject("{text='Open' type='QPushButton'}")) + + clickButton(waitForObject(":CMake Wizard.Next_QPushButton", 20000)) + clickButton(waitForObject(":CMake Wizard.Run CMake_QPushButton", 20000)) + clickButton(waitForObject(":CMake Wizard.Finish_QPushButton", 60000)) + + waitFor("object.exists(':speedcrunch_QModelIndex')", 20000) + + # Test that some of the expected items are in the navigation tree + for row, record in enumerate(testData.dataset("speedcrunch_tree.tsv")): + node = testData.field(record, "node") + value = testData.field(record, "value") + test.compare(findObject(node).text, value) + + # Invoke a rebuild of the application + installLazySignalHandler("{type='ProjectExplorer::BuildManager'}", "buildQueueFinished(bool)", "handleBuildFinished") + invokeMenuItem("Build", "Rebuild All") + + # Wait for, and test if the build succeeded + waitFor("buildFinished == True", 300000) + test.verify(buildSucceeded == 1) + + invokeMenuItem("File", "Exit") + +def init(): + global SpeedCrunchPath + SpeedCrunchPath = SDKPath + "/creator-test-data/speedcrunch/src/CMakeLists.txt" + cleanup() + +def cleanup(): + # Make sure the .user files are gone + if os.access(SpeedCrunchPath + ".user", os.F_OK): + os.remove(SpeedCrunchPath + ".user") + + BuildPath = SDKPath + "/creator-test-data/speedcrunch/src/qtcreator-build" + + if os.access(BuildPath, os.F_OK): + shutil.rmtree(BuildPath) diff --git a/tests/system/suite_general/tst_openqt_creator/test.py b/tests/system/suite_general/tst_openqt_creator/test.py new file mode 100644 index 00000000000..f16ae433d68 --- /dev/null +++ b/tests/system/suite_general/tst_openqt_creator/test.py @@ -0,0 +1,63 @@ +source(findFile("scripts", "qtcreator.py")) + +refreshFinishedCount = 0 + +def handleRefreshFinished(object, fileList): + global refreshFinishedCount + refreshFinishedCount += 1 + +def main(): + startApplication("qtcreator" + SettingsPath) + + installLazySignalHandler("{type='CppTools::Internal::CppModelManager'}", "sourceFilesRefreshed(QStringList)", "handleRefreshFinished") + + test.verify(os.path.exists(SDKPath + "/qt/projects.pro")) + test.verify(os.path.exists(SDKPath + "/creator/qtcreator.pro")) + + openProject(SDKPath + "/qt/projects.pro") + openProject(SDKPath + "/creator/qtcreator.pro") + + # Test that some of the expected items are in the navigation tree + for row, record in enumerate(testData.dataset("qt_tree.tsv")): + node = testData.field(record, "node") + value = testData.field(record, "value") + test.compare(waitForObject(node).text, value) + + for row, record in enumerate(testData.dataset("creator_tree.tsv")): + node = testData.field(record, "node") + value = testData.field(record, "value") + test.compare(waitForObject(node).text, value) + + # Wait for parsing to complete + waitFor("refreshFinishedCount == 2", 300000) + test.compare(refreshFinishedCount, 2) + + # Now check some basic lookups in the search box + + mouseClick(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), 101, 7, 0, Qt.LeftButton) + type(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), ": Qlist::QList") + snooze(1) + type(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), "") + + test.compare(wordUnderCursor(findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "QList") + + invokeMenuItem("File", "Exit") + + +def init(): + cleanup() + +def cleanup(): + # Make sure the .user files are gone + + if os.access(SDKPath + "/qt/projects.pro.user", os.F_OK): + os.remove(SDKPath + "/qt/projects.pro.user") + if os.access(SDKPath + "/creator/qtcreator.pro.user", os.F_OK): + os.remove(SDKPath + "/creator/qtcreator.pro.user") + + BuildPath = glob.glob(SDKPath + "/qtcreator-build-*") + BuildPath += glob.glob(SDKPath + "/src/projects-build-*") + + for dir in BuildPath: + if os.access(dir, os.F_OK): + shutil.rmtree(dir)