diff options
Diffstat (limited to 'tests/auto/quick/qmltests/data/TestWebEngineView.qml')
-rw-r--r-- | tests/auto/quick/qmltests/data/TestWebEngineView.qml | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/auto/quick/qmltests/data/TestWebEngineView.qml b/tests/auto/quick/qmltests/data/TestWebEngineView.qml index a7d890072..2ce8f3026 100644 --- a/tests/auto/quick/qmltests/data/TestWebEngineView.qml +++ b/tests/auto/quick/qmltests/data/TestWebEngineView.qml @@ -28,11 +28,12 @@ import QtQuick 2.0 import QtTest 1.1 -import QtWebEngine 1.3 +import QtWebEngine 1.6 WebEngineView { property var loadStatus: null property bool windowCloseRequestedSignalEmitted: false + settings.focusOnNavigationEnabled: true function waitForLoadSucceeded() { var success = _waitFor(function() { return loadStatus == WebEngineView.LoadSucceededStatus }) @@ -81,6 +82,24 @@ WebEngineView { verifyElementHasFocus(element); } + function getElementCenter(element) { + var center; + runJavaScript("(function() {" + + " var elem = document.getElementById('" + element + "');" + + " var rect = elem.getBoundingClientRect();" + + " return { 'x': (rect.left + rect.right) / 2, 'y': (rect.top + rect.bottom) / 2 };" + + "})();", function(result) { center = result } ); + testCase.tryVerify(function() { return center !== undefined; }); + return center; + } + + function getTextSelection() { + var textSelection; + runJavaScript("window.getSelection().toString()", function(result) { textSelection = result }); + testCase.tryVerify(function() { return textSelection !== undefined; }); + return textSelection; + } + TestResult { id: testResult } TestCase { id: testCase } |