forked from qt-creator/qt-creator
Added new test cases/suite for simple project compilation
initial commit Change-Id: I06d211ba9878852839cd4774b930efd8cde244ae Reviewed-by: Christian Stenger <christian.stenger@nokia.com> Reviewed-by: Robert Löhning <robert.loehning@nokia.com>
This commit is contained in:
committed by
Robert Löhning
parent
7e4e06796e
commit
5254e3e547
36
tests/system/shared/suites_qtta.py
Executable file
36
tests/system/shared/suites_qtta.py
Executable file
@@ -0,0 +1,36 @@
|
||||
|
||||
# appends to line, by typing <typeWhat> after <insertAfterLine> text into <codeArea> widget
|
||||
def appendToLine(codeArea, insertAfterLine, typeWhat):
|
||||
if not placeCursorToLine(codeArea, insertAfterLine):
|
||||
return False
|
||||
type(codeArea, typeWhat)
|
||||
return True
|
||||
|
||||
# checks if error is properly reported, returns True if succeeded and False if not.
|
||||
# Current implementation is focused on allowing different compilers, and it is enough if one of the expected messages
|
||||
# is found in issues view. warnIfMoreIssues should warn if there are more than one issue, no matter how many
|
||||
# expected texts are in array (because they are alternatives).
|
||||
def checkSyntaxError(issuesView, expectedTextsArray, warnIfMoreIssues = True):
|
||||
issuesModel = issuesView.model()
|
||||
# wait for issues
|
||||
waitFor("issuesModel.rowCount() > 0", 5000)
|
||||
# warn if more issues reported
|
||||
if(warnIfMoreIssues and issuesModel.rowCount() > 1):
|
||||
test.warning("More than one expected issues reported")
|
||||
# iterate issues and check if there exists "Unexpected token" message
|
||||
for row in range(issuesModel.rowCount()):
|
||||
# enum Roles { File = Qt::UserRole, Line, MovedLine, Description, FileNotFound, Type, Category, Icon, Task_t };
|
||||
index = issuesModel.index(row, 0)
|
||||
description = str(index.data(Qt.UserRole + 3).toString())
|
||||
type = str(index.data(Qt.UserRole + 5).toString())
|
||||
# check if at least one of expected texts found in issue text
|
||||
for expectedText in expectedTextsArray:
|
||||
if expectedText in description:
|
||||
# check if it is error and warn if not - returns False which leads to fail
|
||||
if type is not "1":
|
||||
test.warning("Expected error text found, but is not of type: 'error'")
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
return False
|
||||
|
1
tests/system/suite_SCOM/envvars
Normal file
1
tests/system/suite_SCOM/envvars
Normal file
@@ -0,0 +1 @@
|
||||
QT_PLATFORM_PLUGIN=nonesuch
|
17
tests/system/suite_SCOM/objects.map
Normal file
17
tests/system/suite_SCOM/objects.map
Normal file
@@ -0,0 +1,17 @@
|
||||
:New Qt Quick Application.Add to version control:_QLabel {name='addToVersionControlLabel' text='Add to version control:' type='QLabel' visible='1'}
|
||||
:Next_QPushButton {name='__qt__passive_wizardbutton1' text~='(Next.*|Continue)' type='QPushButton' visible='1'}
|
||||
:Qt Creator.Build Project_Core::Internal::FancyToolButton {text='Build Project' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator.Compile Output_Core::OutputWindow {type='Core::OutputWindow' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Compile Output'}
|
||||
:Qt Creator.Issues_QListView {type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'}
|
||||
:Qt Creator.Project.Menu.Project_QMenu {name='Project.Menu.Project' type='QMenu' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator.scrollArea_QScrollArea {name='scrollArea' type='QScrollArea' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_Core::Internal::IssuesPaneToggleButton {type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' unnamed='1' visible='1'}
|
||||
:Qt Creator_Core::Internal::OutputPaneToggleButton {occurrence='4' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_CppEditor::Internal::CPPEditorWidget {type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||
:Qt Creator_QmlJSEditor::QmlJSTextEditorWidget {type='QmlJSEditor::QmlJSTextEditorWidget' 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'}
|
||||
:addToVersionControlComboBox_QComboBox {buddy=':New Qt Quick Application.Add to version control:_QLabel' name='addToVersionControlComboBox' type='QComboBox' visible='1'}
|
||||
:scrollArea.Edit build configuration:_QComboBox {container=':Qt Creator.scrollArea_QScrollArea' leftWidget=':scrollArea.Edit build configuration:_QLabel' type='QComboBox' unnamed='1' visible='1'}
|
||||
:scrollArea.Edit build configuration:_QLabel {container=':Qt Creator.scrollArea_QScrollArea' text='Edit build configuration:' type='QLabel' unnamed='1' visible='1'}
|
10
tests/system/suite_SCOM/suite.conf
Normal file
10
tests/system/suite_SCOM/suite.conf
Normal file
@@ -0,0 +1,10 @@
|
||||
AUT=qtcreator
|
||||
CLASS=
|
||||
CLASSPATH=
|
||||
ENVVARS=envvars
|
||||
HOOK_SUB_PROCESSES=false
|
||||
IMPLICITAUTSTART=0
|
||||
LANGUAGE=Python
|
||||
TEST_CASES=tst_SCOM01 tst_SCOM02 tst_SCOM04 tst_SCOM05
|
||||
VERSION=2
|
||||
WRAPPERS=Qt
|
25
tests/system/suite_SCOM/tst_SCOM01/test.py
Normal file
25
tests/system/suite_SCOM/tst_SCOM01/test.py
Normal file
@@ -0,0 +1,25 @@
|
||||
source("../../shared/qtcreator.py")
|
||||
source("../../shared/suites_qtta.py")
|
||||
|
||||
# entry of test
|
||||
def main():
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
# create qt quick application
|
||||
createNewQtQuickApplication(tempDir(), "SampleApp")
|
||||
# build it - on all (except Qt 4.7.0 (would fail)) build configurations
|
||||
for config in iterateBuildConfigs(1, 0, "(?!.*4\.7\.0.*)"):
|
||||
selectBuildConfig(1, 0, config)
|
||||
# try to compile
|
||||
test.log("Testing build configuration: " + config)
|
||||
clickButton(waitForObject(":Qt Creator.Build Project_Core::Internal::FancyToolButton"))
|
||||
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
|
||||
# check output if build successful
|
||||
ensureChecked(waitForObject(":Qt Creator_Core::Internal::OutputPaneToggleButton"))
|
||||
compileOutput = waitForObject(":Qt Creator.Compile Output_Core::OutputWindow")
|
||||
if not test.verify(str(compileOutput.plainText).endswith("exited normally."),
|
||||
"Verifying building of simple qt quick application."):
|
||||
test.log(compileOutput.plainText)
|
||||
# exit qt creator
|
||||
invokeMenuItem("File", "Exit")
|
||||
# no cleanup needed, as whole testing directory gets properly removed after test finished
|
||||
|
25
tests/system/suite_SCOM/tst_SCOM02/test.py
Normal file
25
tests/system/suite_SCOM/tst_SCOM02/test.py
Normal file
@@ -0,0 +1,25 @@
|
||||
source("../../shared/qtcreator.py")
|
||||
source("../../shared/suites_qtta.py")
|
||||
|
||||
# entry of test
|
||||
def main():
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
# create qt quick application
|
||||
createNewQtQuickApplication(tempDir(), "SampleApp")
|
||||
# create syntax error in qml file
|
||||
doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.QML.qml/SampleApp.main\\.qml", 5, 5, 0, Qt.LeftButton)
|
||||
if not appendToLine(waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget"), "Text {", "SyntaxError"):
|
||||
invokeMenuItem("File", "Exit")
|
||||
return
|
||||
# save all to invoke qml parsing
|
||||
invokeMenuItem("File", "Save All")
|
||||
# open issues list view
|
||||
ensureChecked(waitForObject(":Qt Creator_Core::Internal::IssuesPaneToggleButton"))
|
||||
issuesView = waitForObject(":Qt Creator.Issues_QListView")
|
||||
# verify that error is properly reported
|
||||
test.verify(checkSyntaxError(issuesView, ["Unexpected token"], True),
|
||||
"Verifying QML syntax error while parsing simple qt quick application.")
|
||||
# exit qt creator
|
||||
invokeMenuItem("File", "Exit")
|
||||
# no cleanup needed, as whole testing directory gets properly removed after test finished
|
||||
|
36
tests/system/suite_SCOM/tst_SCOM04/test.py
Normal file
36
tests/system/suite_SCOM/tst_SCOM04/test.py
Normal file
@@ -0,0 +1,36 @@
|
||||
source("../../shared/qtcreator.py")
|
||||
source("../../shared/suites_qtta.py")
|
||||
|
||||
# entry of test
|
||||
def main():
|
||||
# expected error texts - for different compilers
|
||||
expectedErrorAlternatives = ["'SyntaxError' was not declared in this scope",
|
||||
"'SyntaxError' : undeclared identifier"]
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
# create qt quick application
|
||||
createNewQtQuickApplication(tempDir(), "SampleApp")
|
||||
# create syntax error in cpp file
|
||||
doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton)
|
||||
if not appendToLine(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "viewer.showExpanded();", "SyntaxError"):
|
||||
invokeMenuItem("File", "Exit")
|
||||
return
|
||||
# save all
|
||||
invokeMenuItem("File", "Save All")
|
||||
# build it - on all (except Qt 4.7.0 (would fail)) build configurations
|
||||
for config in iterateBuildConfigs(1, 0, "(?!.*4\.7\.0.*)"):
|
||||
selectBuildConfig(1, 0, config)
|
||||
# try to compile
|
||||
test.log("Testing build configuration: " + config)
|
||||
clickButton(waitForObject(":Qt Creator.Build Project_Core::Internal::FancyToolButton"))
|
||||
# wait until build finished
|
||||
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
|
||||
# open issues list view
|
||||
ensureChecked(waitForObject(":Qt Creator_Core::Internal::IssuesPaneToggleButton"))
|
||||
issuesView = waitForObject(":Qt Creator.Issues_QListView")
|
||||
# verify that error is properly reported
|
||||
test.verify(checkSyntaxError(issuesView, expectedErrorAlternatives, False),
|
||||
"Verifying cpp syntax error while building simple qt quick application.")
|
||||
# exit qt creator
|
||||
invokeMenuItem("File", "Exit")
|
||||
# no cleanup needed, as whole testing directory gets properly removed after test finished
|
||||
|
44
tests/system/suite_SCOM/tst_SCOM05/test.py
Normal file
44
tests/system/suite_SCOM/tst_SCOM05/test.py
Normal file
@@ -0,0 +1,44 @@
|
||||
source("../../shared/qtcreator.py")
|
||||
source("../../shared/suites_qtta.py")
|
||||
|
||||
def verifyChangeProject(projectName):
|
||||
# select project
|
||||
projItem = waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", projectName)
|
||||
openItemContextMenu(waitForObject(":Qt Creator_Utils::NavigationTreeView"), projectName, 5, 5, 0)
|
||||
activateItem(waitForObjectItem(":Qt Creator.Project.Menu.Project_QMenu", "Set as Active Project"))
|
||||
waitFor("projItem.font.bold==True",3000)
|
||||
# check if bold is right project
|
||||
test.verify(projItem.font.bold == True,
|
||||
"Simple Qt Quick App - multiple projects - verifying if properly set to project: " + projectName)
|
||||
|
||||
def main():
|
||||
projectName1 = "SampleApp1"
|
||||
projectName2 = "SampleApp2"
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
# create qt quick application 1
|
||||
createNewQtQuickApplication(tempDir(), projectName1)
|
||||
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 5000)
|
||||
# create qt quick application 2
|
||||
createNewQtQuickApplication(tempDir(), projectName2)
|
||||
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 5000)
|
||||
# change to project 1
|
||||
verifyChangeProject(projectName1)
|
||||
# change to project 2
|
||||
verifyChangeProject(projectName2)
|
||||
# build project 2
|
||||
clickButton(waitForObject(":Qt Creator.Build Project_Core::Internal::FancyToolButton"))
|
||||
# wait for build to complete
|
||||
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
|
||||
# check output if build successful
|
||||
ensureChecked(waitForObject(":Qt Creator_Core::Internal::OutputPaneToggleButton"))
|
||||
outputLog = str(waitForObject(":Qt Creator.Compile Output_Core::OutputWindow").plainText)
|
||||
# verify that project was built successfully
|
||||
test.verify(outputLog.endswith("exited normally."),
|
||||
"Verifying building of simple qt quick application while multiple projects are open.")
|
||||
# verify that proper project (project 2) was build
|
||||
test.verify(projectName2 in outputLog and projectName1 not in outputLog,
|
||||
"Verifying that proper project " + projectName2 + " was built.")
|
||||
# exit qt creator
|
||||
invokeMenuItem("File", "Exit")
|
||||
# no cleanup needed, as whole testing directory gets properly removed after test finished
|
||||
|
Reference in New Issue
Block a user