forked from qt-creator/qt-creator
SquishTests: Stabilize tst_basic_cpp_support
Make sure the CppEditor is available before proceeding. Change-Id: I34ed4f581637cc3608283ac045ceb5b4e6ada55a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
committed by
Robert Löhning
parent
0be6ba955d
commit
c4164738b8
@@ -3,6 +3,11 @@
|
|||||||
|
|
||||||
source("../../shared/qtcreator.py")
|
source("../../shared/qtcreator.py")
|
||||||
|
|
||||||
|
|
||||||
|
def waitForCppEditor():
|
||||||
|
return waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
projectDir = os.path.join(srcPath, "creator", "tests", "manual", "cplusplus-tools")
|
projectDir = os.path.join(srcPath, "creator", "tests", "manual", "cplusplus-tools")
|
||||||
proFileName = "cplusplus-tools.pro"
|
proFileName = "cplusplus-tools.pro"
|
||||||
@@ -31,27 +36,26 @@ def main():
|
|||||||
# t3 = t2.file()
|
# t3 = t2.file()
|
||||||
# t4 = t3.fileName
|
# t4 = t3.fileName
|
||||||
# test.compare(editorManager.currentEditor().file().fileName, "base.cpp")
|
# test.compare(editorManager.currentEditor().file().fileName, "base.cpp")
|
||||||
cppwindow = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
|
|
||||||
|
|
||||||
# - Move the cursor to the usage of a variable.
|
# - Move the cursor to the usage of a variable.
|
||||||
# - Press F2 or select from the menu: Tools / C++ / Follow Symbol under Cursor
|
# - Press F2 or select from the menu: Tools / C++ / Follow Symbol under Cursor
|
||||||
# Creator will show you the declaration of the variable.
|
# Creator will show you the declaration of the variable.
|
||||||
|
|
||||||
type(cppwindow, "<Ctrl+f>")
|
type(waitForCppEditor(), "<Ctrl+f>")
|
||||||
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), " xi")
|
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), " xi")
|
||||||
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "<Return>")
|
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "<Return>")
|
||||||
__typeAndWaitForAction__(cppwindow, "<F2>")
|
__typeAndWaitForAction__(waitForCppEditor(), "<F2>")
|
||||||
test.compare(lineUnderCursor(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "extern int xi;")
|
test.compare(lineUnderCursor(waitForCppEditor()), "extern int xi;")
|
||||||
|
|
||||||
# - Move the cursor to a function call.
|
# - Move the cursor to a function call.
|
||||||
# - Press F2 or select from the menu: Tools / C++ / Follow Symbol under Cursor
|
# - Press F2 or select from the menu: Tools / C++ / Follow Symbol under Cursor
|
||||||
# Creator will show you the definition of the function.
|
# Creator will show you the definition of the function.
|
||||||
type(cppwindow, "<Ctrl+f>")
|
type(waitForCppEditor(), "<Ctrl+f>")
|
||||||
clickButton(waitForObject(":*Qt Creator_Utils::IconButton"))
|
clickButton(waitForObject(":*Qt Creator_Utils::IconButton"))
|
||||||
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "freefunc2")
|
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "freefunc2")
|
||||||
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "<Return>")
|
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "<Return>")
|
||||||
__typeAndWaitForAction__(cppwindow, "<F2>")
|
__typeAndWaitForAction__(waitForCppEditor(), "<F2>")
|
||||||
test.compare(lineUnderCursor(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "int freefunc2(double)")
|
test.compare(lineUnderCursor(waitForCppEditor()), "int freefunc2(double)")
|
||||||
|
|
||||||
# - Move the cursor to a function declaration
|
# - Move the cursor to a function declaration
|
||||||
# - Press Shift+F2 or select from menu: Tools / C++ / Switch Between Method Declaration/Definition
|
# - Press Shift+F2 or select from menu: Tools / C++ / Switch Between Method Declaration/Definition
|
||||||
@@ -63,20 +67,18 @@ def main():
|
|||||||
if not waitFor("str(mainWin.windowTitle).startswith('dummy.cpp ') and ' @ cplusplus-tools ' in str(mainWin.windowTitle)", 5000):
|
if not waitFor("str(mainWin.windowTitle).startswith('dummy.cpp ') and ' @ cplusplus-tools ' in str(mainWin.windowTitle)", 5000):
|
||||||
test.warning("Opening dummy.cpp seems to have failed")
|
test.warning("Opening dummy.cpp seems to have failed")
|
||||||
# Reset cursor to the start of the document
|
# Reset cursor to the start of the document
|
||||||
jumpToFirstLine(cppwindow)
|
jumpToFirstLine(waitForCppEditor())
|
||||||
|
|
||||||
type(cppwindow, "<Ctrl+f>")
|
type(waitForCppEditor(), "<Ctrl+f>")
|
||||||
clickButton(waitForObject(":*Qt Creator_Utils::IconButton"))
|
clickButton(waitForObject(":*Qt Creator_Utils::IconButton"))
|
||||||
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "Dummy::Dummy")
|
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "Dummy::Dummy")
|
||||||
# Take us to the second instance
|
# Take us to the second instance
|
||||||
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "<Return>")
|
type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "<Return>")
|
||||||
cppwindow = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
|
__typeAndWaitForAction__(waitForCppEditor(), "<Shift+F2>")
|
||||||
__typeAndWaitForAction__(cppwindow, "<Shift+F2>")
|
test.compare(lineUnderCursor(waitForCppEditor()), " Dummy(int a);")
|
||||||
test.compare(lineUnderCursor(findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), " Dummy(int a);")
|
|
||||||
cppwindow = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
|
|
||||||
snooze(2)
|
snooze(2)
|
||||||
__typeAndWaitForAction__(cppwindow, "<Shift+F2>")
|
__typeAndWaitForAction__(waitForCppEditor(), "<Shift+F2>")
|
||||||
test.compare(lineUnderCursor(findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "Dummy::Dummy(int)")
|
test.compare(lineUnderCursor(waitForCppEditor()), "Dummy::Dummy(int)")
|
||||||
invokeMenuItem("File", "Exit")
|
invokeMenuItem("File", "Exit")
|
||||||
|
|
||||||
def __typeAndWaitForAction__(editor, keyCombination):
|
def __typeAndWaitForAction__(editor, keyCombination):
|
||||||
@@ -88,7 +90,6 @@ def __typeAndWaitForAction__(editor, keyCombination):
|
|||||||
|
|
||||||
def cppEditorPositionChanged(origPos):
|
def cppEditorPositionChanged(origPos):
|
||||||
try:
|
try:
|
||||||
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget", 500)
|
return waitForCppEditor().textCursor().position() != origPos
|
||||||
return editor.textCursor().position() != origPos
|
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
Reference in New Issue
Block a user