diff options
author | Valentin Fokin <fokinv@inf.u-szeged.hu> | 2017-11-13 10:09:13 +0100 |
---|---|---|
committer | Valentin Fokin <fokinv@inf.u-szeged.hu> | 2017-12-19 10:04:39 +0000 |
commit | 78cc35d0705ef9f7b3e7785f031f77595ed71217 (patch) | |
tree | d12bcbb085cdcffc44f622fe8aec66d0c9064453 /tests/auto/quick/qmltests/data/TestWebEngineView.qml | |
parent | f71217948ba690de6943ac09380260ff5e1c11fb (diff) |
Add QML autotests for ContextMenu
Change-Id: If18bb163744b9064c0e4d97a9476851b6dee39ad
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'tests/auto/quick/qmltests/data/TestWebEngineView.qml')
-rw-r--r-- | tests/auto/quick/qmltests/data/TestWebEngineView.qml | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/auto/quick/qmltests/data/TestWebEngineView.qml b/tests/auto/quick/qmltests/data/TestWebEngineView.qml index 8304a993a..2ce8f3026 100644 --- a/tests/auto/quick/qmltests/data/TestWebEngineView.qml +++ b/tests/auto/quick/qmltests/data/TestWebEngineView.qml @@ -28,7 +28,7 @@ import QtQuick 2.0 import QtTest 1.1 -import QtWebEngine 1.3 +import QtWebEngine 1.6 WebEngineView { property var loadStatus: null @@ -82,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 } |