forked from qt-creator/qt-creator
SquishTests: Update tst_CSUP06
Change-Id: Icbe7cae9b282dd125de46f8ba8bd265b9aa1054d Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -42,8 +42,14 @@ def performAutoCompletionTest(editor, lineToStartRegEx, linePrefix, testFunc, *f
|
|||||||
def checkIncludeCompletion(editor, isClangCodeModel):
|
def checkIncludeCompletion(editor, isClangCodeModel):
|
||||||
test.log("Check auto-completion of include statements.")
|
test.log("Check auto-completion of include statements.")
|
||||||
# define special handlings
|
# define special handlings
|
||||||
noProposal = ["detail/hea"]
|
noProposal = []
|
||||||
specialHandling = {"ios":"iostream", "cstd":"cstdio"}
|
specialHandling = {"ios":"iostream", "cstd":"cstdio"}
|
||||||
|
if isClangCodeModel:
|
||||||
|
specialHandling["QDe"] = "QDebug"
|
||||||
|
for i in specialHandling.keys():
|
||||||
|
specialHandling[i] = " %s>" % specialHandling[i]
|
||||||
|
else:
|
||||||
|
noProposal += ["detail/hea"]
|
||||||
|
|
||||||
# define test function to perform the _real_ auto completion test on the current line
|
# define test function to perform the _real_ auto completion test on the current line
|
||||||
def testIncl(currentLine, *args):
|
def testIncl(currentLine, *args):
|
||||||
@@ -69,25 +75,24 @@ def checkIncludeCompletion(editor, isClangCodeModel):
|
|||||||
def checkSymbolCompletion(editor, isClangCodeModel):
|
def checkSymbolCompletion(editor, isClangCodeModel):
|
||||||
test.log("Check auto-completion of symbols.")
|
test.log("Check auto-completion of symbols.")
|
||||||
# define special handlings
|
# define special handlings
|
||||||
expectedSuggestion = {"in":["internal", "int", "INT_MAX", "INT_MIN"],
|
expectedSuggestion = {"in":["internal", "int", "intmax_t"],
|
||||||
"Dum":["Dummy", "dummy"], "Dummy::O":["ONE","one"],
|
"Dum":["Dummy", "dummy"], "Dummy::O":["ONE","one"],
|
||||||
"dummy.":["foo", "bla", "ONE", "one", "PI", "sfunc", "v1", "v2", "v3"],
|
"dummy.":["one", "ONE", "PI", "v1", "v2", "v3"],
|
||||||
"dummy.o":["one", "ONE"], "Dummy::In":["Internal", "INT"],
|
"dummy.o":["one", "ONE"], "Dummy::In":["Internal", "INT"],
|
||||||
"Dummy::Internal::":["DOUBLE", "one"]
|
"Dummy::Internal::":["DOUBLE", "one"]
|
||||||
}
|
}
|
||||||
missing = ["Dummy::s", "Dummy::P", "dummy.b", "dummy.bla(", "internal.o", "freefunc2"]
|
missing = ["Dummy::s", "Dummy::P", "dummy.b", "dummy.bla(", "internal.o", "freefunc2"]
|
||||||
expectedResults = {"dummy.":"dummy.foo(", "Dummy::s":"Dummy::sfunc()",
|
expectedResults = {"Dummy::s":"Dummy::sfunc()",
|
||||||
"Dummy::P":"Dummy::PI", "dummy.b":"dummy.bla(", "dummy.bla(":"dummy.bla(",
|
"Dummy::P":"Dummy::PI", "dummy.b":"dummy.bla(", "dummy.bla(":"dummy.bla(",
|
||||||
"internal.o":"internal.one", "freefunc2":"freefunc2(",
|
"internal.o":"internal.one", "freefunc2":"freefunc2(",
|
||||||
"using namespace st":"using namespace std", "afun":"afunc()"}
|
"using namespace st":"using namespace std", "afun":"afunc()"}
|
||||||
if isClangCodeModel:
|
if isClangCodeModel:
|
||||||
missing.remove("internal.o")
|
missing = ["dummy.bla("]
|
||||||
expectedSuggestion["in"] = ["internal", "int"] # QTCREATORBUG-22728
|
expectedSuggestion["internal.o"] = ["one"]
|
||||||
expectedSuggestion["internal.o"] = ["one", "operator="]
|
|
||||||
if platform.system() in ('Microsoft', 'Windows'):
|
if platform.system() in ('Microsoft', 'Windows'):
|
||||||
expectedSuggestion["using namespace st"] = ["std", "stdext"]
|
expectedSuggestion["using namespace st"] = ["std", "stdext"]
|
||||||
else:
|
else:
|
||||||
expectedSuggestion["using namespace st"] = ["std", "struct ", "struct template"]
|
expectedSuggestion["using namespace st"] = ["std", "struct", "struct template"]
|
||||||
else:
|
else:
|
||||||
expectedSuggestion["using namespace st"] = ["std", "st"]
|
expectedSuggestion["using namespace st"] = ["std", "st"]
|
||||||
# define test function to perform the _real_ auto completion test on the current line
|
# define test function to perform the _real_ auto completion test on the current line
|
||||||
@@ -101,27 +106,25 @@ def checkSymbolCompletion(editor, isClangCodeModel):
|
|||||||
found = []
|
found = []
|
||||||
if propShown:
|
if propShown:
|
||||||
proposalListView = waitForObject(':popupFrame_Proposal_QListView')
|
proposalListView = waitForObject(':popupFrame_Proposal_QListView')
|
||||||
found = dumpItems(proposalListView.model())
|
found = [i.strip() for i in dumpItems(proposalListView.model())]
|
||||||
diffShownExp = set(expectedSug.get(symbol, [])) - set(found)
|
diffShownExp = set(expectedSug.get(symbol, [])) - set(found)
|
||||||
if not test.verify(len(diffShownExp) == 0,
|
if not test.verify(len(diffShownExp) == 0,
|
||||||
"Verify if all expected suggestions could be found"):
|
"Verify if all expected suggestions could be found"):
|
||||||
test.log("Expected but not found suggestions: %s" % diffShownExp,
|
test.log("Expected but not found suggestions: %s" % diffShownExp,
|
||||||
"%s | %s" % (expectedSug[symbol], str(found)))
|
"%s | %s" % (expectedSug[symbol], str(found)))
|
||||||
# select first item of the expected suggestion list
|
# select first item of the expected suggestion list
|
||||||
doubleClickItem(':popupFrame_Proposal_QListView', expectedSug.get(symbol, found)[0],
|
suggestionToClick = expectedSug.get(symbol, found)[0]
|
||||||
|
if isClangCodeModel:
|
||||||
|
suggestionToClick = " " + suggestionToClick
|
||||||
|
doubleClickItem(':popupFrame_Proposal_QListView', suggestionToClick,
|
||||||
5, 5, 0, Qt.LeftButton)
|
5, 5, 0, Qt.LeftButton)
|
||||||
changedLine = str(lineUnderCursor(editor)).strip()
|
changedLine = str(lineUnderCursor(editor)).strip()
|
||||||
if symbol in expectedRes:
|
if symbol in expectedRes:
|
||||||
exp = expectedRes[symbol]
|
exp = expectedRes[symbol]
|
||||||
else:
|
else:
|
||||||
exp = (symbol[:max(symbol.rfind(":"), symbol.rfind(".")) + 1]
|
exp = (symbol[:max(symbol.rfind(":"), symbol.rfind(".")) + 1]
|
||||||
+ expectedSug.get(symbol, found)[0])
|
+ expectedSug.get(symbol, found)[0]).strip()
|
||||||
if isClangCodeModel and changedLine != exp and JIRA.isBugStillOpen(15483):
|
test.compare(changedLine, exp, "Verify completion matches.")
|
||||||
test.xcompare(changedLine, exp, "Verify completion matches (QTCREATORBUG-15483).")
|
|
||||||
test.verify(changedLine.startswith(exp.replace("(", "").replace(")", "")),
|
|
||||||
"Verify completion starts with expected string.")
|
|
||||||
else:
|
|
||||||
test.compare(changedLine, exp, "Verify completion matches.")
|
|
||||||
|
|
||||||
performAutoCompletionTest(editor, ".*Complete symbols.*", "//",
|
performAutoCompletionTest(editor, ".*Complete symbols.*", "//",
|
||||||
testSymb, missing, expectedSuggestion, expectedResults)
|
testSymb, missing, expectedSuggestion, expectedResults)
|
||||||
@@ -143,6 +146,10 @@ def main():
|
|||||||
return
|
return
|
||||||
editor = getEditorForFileSuffix("main.cpp")
|
editor = getEditorForFileSuffix("main.cpp")
|
||||||
if editor:
|
if editor:
|
||||||
|
if useClang:
|
||||||
|
test.log("Wait for parsing to finish...")
|
||||||
|
progressBarWait(15000)
|
||||||
|
test.log("Parsing done.")
|
||||||
checkIncludeCompletion(editor, useClang)
|
checkIncludeCompletion(editor, useClang)
|
||||||
checkSymbolCompletion(editor, useClang)
|
checkSymbolCompletion(editor, useClang)
|
||||||
invokeMenuItem('File', 'Revert "main.cpp" to Saved')
|
invokeMenuItem('File', 'Revert "main.cpp" to Saved')
|
||||||
|
Reference in New Issue
Block a user