Squish: Update tst_HELP04 for current Qt versions

Change-Id: I944f824807d47bcfaf9cabd2b15b678d858db15f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Robert Loehning
2018-04-18 20:36:06 +02:00
parent 0e216fda3e
commit 356a2fd855
2 changed files with 65 additions and 48 deletions

View File

@@ -88,6 +88,7 @@
:Help Widget_Help::Internal::HelpWidget {type='Help::Internal::HelpWidget' unnamed='1' visible='1' windowTitle?='Help -*'} :Help Widget_Help::Internal::HelpWidget {type='Help::Internal::HelpWidget' unnamed='1' visible='1' windowTitle?='Help -*'}
:Hits_QCLuceneResultWidget {aboveWidget=':Hits_QLabel' type='QCLuceneResultWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Hits_QCLuceneResultWidget {aboveWidget=':Hits_QLabel' type='QCLuceneResultWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Hits_QLabel {text~='\\\\d+ - \\\\d+ of \\\\d+ Hits' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Hits_QLabel {text~='\\\\d+ - \\\\d+ of \\\\d+ Hits' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Hits_QResultWidget {aboveWidget=':Hits_QLabel' type='QResultWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Kits_QtVersion_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' leftWidget=':QtVersionLabel_KitPage' type='QComboBox' unnamed='1' visible='1'} :Kits_QtVersion_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' leftWidget=':QtVersionLabel_KitPage' type='QComboBox' unnamed='1' visible='1'}
:Locals and Expressions_Debugger::Internal::WatchTreeView {container=':Debugger.Docks.LocalsAndWatchersDockWidget.Inspector_QFrame' name='WatchWindow' type='Debugger::Internal::WatchTreeView' visible='1'} :Locals and Expressions_Debugger::Internal::WatchTreeView {container=':Debugger.Docks.LocalsAndWatchersDockWidget.Inspector_QFrame' name='WatchWindow' type='Debugger::Internal::WatchTreeView' visible='1'}
:Minimal required Qt version:_QLabel {text='Minimal required Qt version:' type='QLabel' unnamed='1' visible='1' window=':New Text File_ProjectExplorer::JsonWizard'} :Minimal required Qt version:_QLabel {text='Minimal required Qt version:' type='QLabel' unnamed='1' visible='1' window=':New Text File_ProjectExplorer::JsonWizard'}

View File

@@ -27,14 +27,20 @@ source("../../shared/qtcreator.py")
import re import re
# test search in help mode and advanced search # test search in help mode and advanced search
searchKeywordDictionary={ "deployment":True, "deplmint":False, "build":True, "bld":False } searchKeywordDictionary={ "abundance":True, "deplmint":False, "QODBC":True, "bld":False }
urlDictionary = { "deployment":"qthelp://com.trolltech.qt.487/qdoc/gettingstarted-develop.html", urlDictionary = { "abundance":"qthelp://com.trolltech.qt.487/qdoc/gettingstarted-develop.html",
"build":"qthelp://com.trolltech.qt.487/qdoc/sql-driver.html" } "QODBC":"qthelp://com.trolltech.qt.487/qdoc/sql-driver.html" }
def __getSelectedText__(): def __getSelectedText__():
hv = getHelpViewer()
try: try:
return getHighlightsInHtml(str(getHelpViewer().toHtml())) return hv.textCursor().selectedText()
except:
pass
try:
test.log("Falling back to searching for selection in HTML.")
return getHighlightsInHtml(str(hv.toHtml()))
except: except:
test.warning("Could not get highlighted text.") test.warning("Could not get highlighted text.")
return str("") return str("")
@@ -85,9 +91,18 @@ def main():
# try to search empty string # try to search empty string
clickButton(waitForObject("{text='Search' type='QPushButton' unnamed='1' visible='1' " clickButton(waitForObject("{text='Search' type='QPushButton' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}", 600000)) "window=':Qt Creator_Core::Internal::MainWindow'}", 600000))
test.verify(waitFor("noMatch in " try:
"str(waitForObject(':Hits_QCLuceneResultWidget').plainText)", 2000), # Creator built with Qt <= 5.8.0
"Verifying if search did not match anything.") resultWidget = waitForObject(':Hits_QCLuceneResultWidget', 5000)
olderThan59 = False
except:
# Creator built with Qt >= 5.9.0
resultWidget = waitForObject(':Hits_QResultWidget', 5000)
olderThan59 = True
if not olderThan59 or not JIRA.isBugStillOpen(67737, JIRA.Bug.QT):
test.verify(waitFor("noMatch in "
"str(resultWidget.plainText)", 2000),
"Verifying if search did not match anything.")
# workaround for "endless waiting cursor" # workaround for "endless waiting cursor"
mouseClick(waitForObject("{column='0' container=':Qt Creator_QHelpContentWidget' " mouseClick(waitForObject("{column='0' container=':Qt Creator_QHelpContentWidget' "
"text='Qt Reference Documentation' type='QModelIndex'}")) "text='Qt Reference Documentation' type='QModelIndex'}"))
@@ -107,51 +122,52 @@ def main():
selText = __getSelectedText__() selText = __getSelectedText__()
url = __getUrl__() url = __getUrl__()
# click in the widget, tab to first item and press enter # click in the widget, tab to first item and press enter
mouseClick(waitForObject(":Hits_QCLuceneResultWidget"), 1, 1, 0, Qt.LeftButton) mouseClick(resultWidget)
type(waitForObject(":Hits_QCLuceneResultWidget"), "<Tab>") type(resultWidget, "<Tab>")
type(waitForObject(":Hits_QCLuceneResultWidget"), "<Return>") type(resultWidget, "<Return>")
waitFor("__getUrl__() != url or selText != __getSelectedText__()", 20000) waitFor("__getUrl__() != url or selText != __getSelectedText__()", 20000)
verifySelection(searchKeyword) verifySelection(searchKeyword)
verifyUrl(urlDictionary[searchKeyword]) verifyUrl(urlDictionary[searchKeyword])
else: else:
test.verify(waitFor("noMatch in " if not olderThan59 or not JIRA.isBugStillOpen(67737, JIRA.Bug.QT):
"str(waitForObject(':Hits_QCLuceneResultWidget').plainText)", 1000), test.verify(waitFor("noMatch in "
"Verifying if search did not match anything for: " + searchKeyword) "str(resultWidget.plainText)", 1000),
# advanced search - setup "Verifying if search did not match anything for: " + searchKeyword)
clickButton(waitForObject("{text='+' type='QToolButton' unnamed='1' visible='1' " if not olderThan59:
"window=':Qt Creator_Core::Internal::MainWindow'}")) # advanced search - setup
label = ("{text='%s' type='QLabel' unnamed='1' visible='1' " clickButton(waitForObject("{text='+' type='QToolButton' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}") "window=':Qt Creator_Core::Internal::MainWindow'}"))
lineEdit = ("{leftWidget=%s type='QLineEdit' unnamed='1' visible='1' " label = ("{text='%s' type='QLabel' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}") "window=':Qt Creator_Core::Internal::MainWindow'}")
labelTextsToSearchStr = {"words <B>similar</B> to:":"deploy", lineEdit = ("{leftWidget=%s type='QLineEdit' unnamed='1' visible='1' "
"<B>without</B> the words:":"bookmark", "window=':Qt Creator_Core::Internal::MainWindow'}")
"with <B>exact phrase</B>:":"sql in qt", labelTextsToSearchStr = {"words <B>similar</B> to:":"deploy",
"with <B>all</B> of the words:":"designer sql", "<B>without</B> the words:":"bookmark",
"with <B>at least one</B> of the words:":"printing"} "with <B>exact phrase</B>:":"sql in qt",
for labelText,searchStr in labelTextsToSearchStr.items(): "with <B>all</B> of the words:":"designer sql",
type(waitForObject(lineEdit % (label % labelText)), searchStr) "with <B>at least one</B> of the words:":"printing"}
# advanced search - do search for labelText,searchStr in labelTextsToSearchStr.items():
clickButton(waitForObject("{text='Search' type='QPushButton' unnamed='1' visible='1' " type(waitForObject(lineEdit % (label % labelText)), searchStr)
"window=':Qt Creator_Core::Internal::MainWindow'}")) # advanced search - do search
progressBarWait(warn=False) clickButton(waitForObject("{text='Search' type='QPushButton' unnamed='1' visible='1' "
# verify that advanced search results found "window=':Qt Creator_Core::Internal::MainWindow'}"))
test.verify(waitFor("re.search('1 - 2 of 2 Hits'," progressBarWait(warn=False)
"str(findObject(':Hits_QLabel').text))", 3000), # verify that advanced search results found
"Verifying if 2 search results found") test.verify(waitFor("re.search('1 - 2 of 2 Hits',"
resultsView = waitForObject(":Hits_QCLuceneResultWidget") "str(findObject(':Hits_QLabel').text))", 3000),
mouseClick(resultsView, 1, 1, 0, Qt.LeftButton) "Verifying if 2 search results found")
type(resultsView, "<Tab>") resultsView = waitForObject(":Hits_QCLuceneResultWidget")
type(resultsView, "<Return>") mouseClick(resultsView, 1, 1, 0, Qt.LeftButton)
verifySelection("printing")
verifyUrl("qthelp://com.trolltech.qt.487/qdoc/overviews.html")
for i in range(2):
type(resultsView, "<Tab>") type(resultsView, "<Tab>")
type(resultsView, "<Return>") type(resultsView, "<Return>")
verifySelection("sql") verifySelection("printing")
verifyUrl("qthelp://com.trolltech.qt.487/qdoc/best-practices.html") verifyUrl("qthelp://com.trolltech.qt.487/qdoc/overviews.html")
# verify if simple search is properly disabled for i in range(2):
test.verify(not searchLineEdit.enabled, type(resultsView, "<Tab>")
"Verifying if simple search is not active in advanced mode.") type(resultsView, "<Return>")
verifyUrl("qthelp://com.trolltech.qt.487/qdoc/best-practices.html")
# verify if simple search is properly disabled
test.verify(not searchLineEdit.enabled,
"Verifying if simple search is not active in advanced mode.")
# exit # exit
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")