diff options
author | Robert Loehning <robert.loehning@qt.io> | 2016-06-13 12:49:57 +0200 |
---|---|---|
committer | Robert Loehning <robert.loehning@qt.io> | 2016-06-29 13:58:06 +0000 |
commit | e065ab2cd3481076743848892bc0c1652200a275 (patch) | |
tree | 62aa9584a5a7985b5b5fd7b3f2d525060bae81f5 /tests/system/suite_HELP | |
parent | ebffc0555e46c25a27cda2ed9016f27de351c1b3 (diff) |
Squish: Handle empty selection in QWebEngineView
Change-Id: I7e4d53483f3168e78024dcf87125b44f96453fa2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'tests/system/suite_HELP')
-rwxr-xr-x | tests/system/suite_HELP/tst_HELP04/test.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/tests/system/suite_HELP/tst_HELP04/test.py b/tests/system/suite_HELP/tst_HELP04/test.py index 5720ff3cd80..7f046e76a45 100755 --- a/tests/system/suite_HELP/tst_HELP04/test.py +++ b/tests/system/suite_HELP/tst_HELP04/test.py @@ -28,14 +28,17 @@ import re # test search in help mode and advanced search searchKeywordDictionary={ "deployment":True, "deplmint":False, "build":True, "bld":False } +urlDictionary = { "deployment":"qthelp://com.trolltech.qt.481/qdoc/gettingstarted-develop.html", + "build":"qthelp://com.trolltech.qt.481/qdoc/sql-driver.html" } def __getSelectedText__(): hv = getHelpViewer() + isWebEngineView = className(hv) == "QWebEngineView" try: selText = hv.selectedText if className(selText) != 'instancemethod': - return str(selText) + return str(selText), isWebEngineView except: pass try: @@ -43,7 +46,7 @@ def __getSelectedText__(): except: test.warning("Could not get highlighted text.") selText = '' - return str(selText) + return str(selText), isWebEngineView def __getUrl__(): helpViewer = getHelpViewer() @@ -66,12 +69,20 @@ def getHighlightsInHtml(htmlCode): return res def verifySelection(expected): - selText = str(__getSelectedText__()) + selText, isWebEngineView = __getSelectedText__() + if isWebEngineView: + test.log("The search results are not a selection in a QWebEngineView", + "Searched strings should still be highlighted") + return + selText = str(selText) if test.verify(selText, "Verify that there is a selection"): # verify if search keyword is found in results test.verify(expected.lower() in selText.lower(), "'%s' search result can be found" % expected) +def verifyUrl(expected): + return test.compare(expected, __getUrl__(), "Expected URL loaded?") + def main(): global sdkPath noMatch = "Your search did not match any documents." @@ -109,14 +120,15 @@ def main(): test.verify(waitFor("re.match('[1-9]\d* - [1-9]\d* of [1-9]\d* Hits'," "str(findObject(':Hits_QLabel').text))", 2000), "Verifying if search results found with 1+ hits for: " + searchKeyword) - selText = __getSelectedText__() + selText = __getSelectedText__()[0] url = __getUrl__() # click in the widget, tab to first item and press enter mouseClick(waitForObject(":Hits_QCLuceneResultWidget"), 1, 1, 0, Qt.LeftButton) type(waitForObject(":Hits_QCLuceneResultWidget"), "<Tab>") type(waitForObject(":Hits_QCLuceneResultWidget"), "<Return>") - waitFor("__getUrl__() != url or selText != __getSelectedText__()", 20000) + waitFor("__getUrl__() != url or selText != __getSelectedText__()[0]", 20000) verifySelection(searchKeyword) + verifyUrl(urlDictionary[searchKeyword]) else: test.verify(waitFor("noMatch in " "str(waitForObject(':Hits_QCLuceneResultWidget').plainText)", 1000), @@ -148,10 +160,12 @@ def main(): type(resultsView, "<Tab>") type(resultsView, "<Return>") verifySelection("printing") + verifyUrl("qthelp://com.trolltech.qt.481/qdoc/overviews.html") for i in range(2): type(resultsView, "<Tab>") type(resultsView, "<Return>") verifySelection("sql") + verifyUrl("qthelp://com.trolltech.qt.481/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.") |