diff options
Diffstat (limited to 'tests/auto/quick/qmltests')
37 files changed, 1414 insertions, 203 deletions
diff --git a/tests/auto/quick/qmltests/data/TestWebEngineView.qml b/tests/auto/quick/qmltests/data/TestWebEngineView.qml index c2ea08c6a..a97739404 100644 --- a/tests/auto/quick/qmltests/data/TestWebEngineView.qml +++ b/tests/auto/quick/qmltests/data/TestWebEngineView.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,7 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 +import QtWebEngine 1.1 import QtWebEngine.experimental 1.0 WebEngineView { diff --git a/tests/auto/quick/qmltests/data/alert.html b/tests/auto/quick/qmltests/data/alert.html new file mode 100644 index 000000000..89715a727 --- /dev/null +++ b/tests/auto/quick/qmltests/data/alert.html @@ -0,0 +1,5 @@ +<html> +<head> + <script> alert("Hello Qt"); </script> +</head> +</html> diff --git a/tests/auto/quick/qmltests/data/append-document-title.js b/tests/auto/quick/qmltests/data/append-document-title.js new file mode 100644 index 000000000..fb4a2a6f2 --- /dev/null +++ b/tests/auto/quick/qmltests/data/append-document-title.js @@ -0,0 +1 @@ +document.title += " with appendix"; diff --git a/tests/auto/quick/qmltests/data/big-user-script.js b/tests/auto/quick/qmltests/data/big-user-script.js new file mode 100644 index 000000000..e6e3d2b44 --- /dev/null +++ b/tests/auto/quick/qmltests/data/big-user-script.js @@ -0,0 +1,110 @@ +// Used to make sure serialization of user scripts between UI process and Web process can handle files bigger +// than the maximum message size defined in ConnectionXXX classes. + +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// + +document.title = "Big user script changed title"; diff --git a/tests/auto/quick/qmltests/data/change-document-title.js b/tests/auto/quick/qmltests/data/change-document-title.js new file mode 100644 index 000000000..bdae45c21 --- /dev/null +++ b/tests/auto/quick/qmltests/data/change-document-title.js @@ -0,0 +1 @@ +document.title = "New title"; diff --git a/tests/auto/quick/qmltests/data/confirm.html b/tests/auto/quick/qmltests/data/confirm.html new file mode 100644 index 000000000..a4fc5b532 --- /dev/null +++ b/tests/auto/quick/qmltests/data/confirm.html @@ -0,0 +1,10 @@ +<html> +<head> + <script> + if (confirm("Confirm test")) + document.title += " ACCEPTED"; + else + document.title += " REJECTED"; + </script> +</head> +</html> diff --git a/tests/auto/quick/qmltests/data/keyboardModifierMapping.html b/tests/auto/quick/qmltests/data/keyboardModifierMapping.html new file mode 100644 index 000000000..4652bf5da --- /dev/null +++ b/tests/auto/quick/qmltests/data/keyboardModifierMapping.html @@ -0,0 +1,38 @@ +<html> +<body> +<kbd>Alt</kbd> is <span id="alt_state">no</span><br> +<kbd>Ctrl</kbd> is <span id="ctrl_state">no</span><br> +<kbd>Meta</kbd> is <span id="meta_state">no</span><br> +last keycode: <span id="last_keycode">none</span><br> + +<script> + +document.body.onkeydown = function(e) { + if (e.altKey) + alt_state.textContent = 'pressed' + if (e.ctrlKey) + ctrl_state.textContent = 'pressed' + if (e.metaKey) + meta_state.textContent = 'pressed' + last_keycode.textContent = e.keyCode + document.title = "Key pressed"; +}; +document.body.onkeyup = function(e) { + if (e.altKey) + alt_state.textContent = 'released' + if (e.ctrlKey) + ctrl_state.textContent = 'released' + if (e.metaKey) + meta_state.textContent = 'released' + last_keycode.textContent = e.keyCode + document.title = "Key released"; +}; + +function getPressedModifiers() { + return "alt:" + alt_state.textContent + " ctrl:" + ctrl_state.textContent + " meta:" + meta_state.textContent +} + +</script> +</body> +</html> + diff --git a/tests/auto/quick/qmltests/data/prompt.html b/tests/auto/quick/qmltests/data/prompt.html new file mode 100644 index 000000000..3293c0dcf --- /dev/null +++ b/tests/auto/quick/qmltests/data/prompt.html @@ -0,0 +1,7 @@ +<html> +<head> + <script> + document.title = prompt("Please, reverse the default value", "Hello Qt"); + </script> +</head> +</html> diff --git a/tests/auto/quick/qmltests/data/tst_desktopBehaviorLoadHtml.qml b/tests/auto/quick/qmltests/data/tst_desktopBehaviorLoadHtml.qml index 7b086044f..dfb983c43 100644 --- a/tests/auto/quick/qmltests/data/tst_desktopBehaviorLoadHtml.qml +++ b/tests/auto/quick/qmltests/data/tst_desktopBehaviorLoadHtml.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,7 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 +import QtWebEngine 1.1 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_favIconLoad.qml b/tests/auto/quick/qmltests/data/tst_favIconLoad.qml index f78569f2a..73190f1bd 100644 --- a/tests/auto/quick/qmltests/data/tst_favIconLoad.qml +++ b/tests/auto/quick/qmltests/data/tst_favIconLoad.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,7 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 +import QtWebEngine 1.1 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_findText.qml b/tests/auto/quick/qmltests/data/tst_findText.qml index 921961c9f..b51da0b2e 100644 --- a/tests/auto/quick/qmltests/data/tst_findText.qml +++ b/tests/auto/quick/qmltests/data/tst_findText.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,8 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 -import QtWebEngine.experimental 1.0 +import QtWebEngine 1.1 TestWebEngineView { id: webEngineView @@ -67,12 +66,12 @@ TestWebEngineView { name: "WebViewFindText" function test_findText() { - var findFlags = WebEngineViewExperimental.FindCaseSensitively + var findFlags = WebEngineView.FindCaseSensitively webEngineView.url = Qt.resolvedUrl("test1.html") verify(webEngineView.waitForLoadSucceeded()) webEngineView.clear() - webEngineView.experimental.findText("Hello", findFlags, webEngineView.findTextCallback) + webEngineView.findText("Hello", findFlags, webEngineView.findTextCallback) tryCompare(webEngineView, "matchCount", 1) verify(!findFailed) } @@ -83,7 +82,7 @@ TestWebEngineView { verify(webEngineView.waitForLoadSucceeded()) webEngineView.clear() - webEngineView.experimental.findText("heLLo", findFlags, webEngineView.findTextCallback) + webEngineView.findText("heLLo", findFlags, webEngineView.findTextCallback) tryCompare(webEngineView, "matchCount", 1) verify(!findFailed) } @@ -94,19 +93,19 @@ TestWebEngineView { verify(webEngineView.waitForLoadSucceeded()) webEngineView.clear() - webEngineView.experimental.findText("bla", findFlags, webEngineView.findTextCallback) + webEngineView.findText("bla", findFlags, webEngineView.findTextCallback) tryCompare(webEngineView, "matchCount", 100) verify(!findFailed) } function test_findTextFailCaseSensitive() { - var findFlags = WebEngineViewExperimental.FindCaseSensitively + var findFlags = WebEngineView.FindCaseSensitively webEngineView.url = Qt.resolvedUrl("test1.html") verify(webEngineView.waitForLoadSucceeded()) webEngineView.clear() - webEngineView.experimental.findText("heLLo", findFlags, webEngineView.findTextCallback) + webEngineView.findText("heLLo", findFlags, webEngineView.findTextCallback) tryCompare(webEngineView, "matchCount", 0) verify(findFailed) } @@ -117,7 +116,7 @@ TestWebEngineView { verify(webEngineView.waitForLoadSucceeded()) webEngineView.clear() - webEngineView.experimental.findText("string-that-is-not-threre", findFlags, webEngineView.findTextCallback) + webEngineView.findText("string-that-is-not-threre", findFlags, webEngineView.findTextCallback) tryCompare(webEngineView, "matchCount", 0) verify(findFailed) } diff --git a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml new file mode 100644 index 000000000..58a49da5a --- /dev/null +++ b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtTest 1.0 +import QtWebEngine 1.0 +import "../mock-delegates/TestParams" 1.0 + +TestWebEngineView { + id: webEngineView + + TestCase { + id: test + name: "WebEngineViewJavaScriptDialogs" + + function init() { + JSDialogParams.dialogMessage = ""; + JSDialogParams.dialogTitle = ""; + JSDialogParams.dialogCount = 0; + JSDialogParams.shouldAcceptDialog = true; + } + + function test_alert() { + webEngineView.url = Qt.resolvedUrl("alert.html") + verify(webEngineView.waitForLoadSucceeded()) + compare(JSDialogParams.dialogCount, 1) + compare(JSDialogParams.dialogMessage, "Hello Qt") + verify(JSDialogParams.dialogTitle.indexOf("Javascript Alert -") === 0) + } + + function test_confirm() { + webEngineView.url = Qt.resolvedUrl("confirm.html") + verify(webEngineView.waitForLoadSucceeded()) + compare(JSDialogParams.dialogMessage, "Confirm test") + compare(JSDialogParams.dialogCount, 1) + compare(webEngineView.title, "ACCEPTED") + JSDialogParams.shouldAcceptDialog = false + webEngineView.reload() + verify(webEngineView.waitForLoadSucceeded()) + compare(JSDialogParams.dialogCount, 2) + compare(webEngineView.title, "REJECTED") + + } + + function test_prompt() { + JSDialogParams.inputForPrompt = "tQ olleH" + webEngineView.url = Qt.resolvedUrl("prompt.html") + verify(webEngineView.waitForLoadSucceeded()) + compare(JSDialogParams.dialogCount, 1) + compare(webEngineView.title, "tQ olleH") + JSDialogParams.shouldAcceptDialog = false + webEngineView.reload() + verify(webEngineView.waitForLoadSucceeded()) + compare(JSDialogParams.dialogCount, 2) + compare(webEngineView.title, "prompt.html") + } + } +} diff --git a/tests/auto/quick/qmltests/data/tst_keyboardModifierMapping.qml b/tests/auto/quick/qmltests/data/tst_keyboardModifierMapping.qml new file mode 100644 index 000000000..230ee9635 --- /dev/null +++ b/tests/auto/quick/qmltests/data/tst_keyboardModifierMapping.qml @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtTest 1.0 +import QtWebEngine 1.1 + +TestWebEngineView { + id: webEngineView + width: 400 + height: 300 + + SignalSpy { + id: titleSpy + target: webEngineView + signalName: "titleChanged" + } + + TestCase { + name: "WebEngineViewKeyboardModifierMapping" + + when: false + Timer { + running: parent.windowShown + repeat: false + interval: 1 + onTriggered: parent.when = true + } + + function test_keyboardModifierMapping() { + webEngineView.url = Qt.resolvedUrl("keyboardModifierMapping.html") + waitForLoadSucceeded(); + titleSpy.wait() + var callbackCalled = false; + + // Alt + keyPress(Qt.Key_Alt); + titleSpy.wait() + runJavaScript("getPressedModifiers()", function(result) { + compare(result, "alt:pressed ctrl:no meta:no"); + callbackCalled = true; + }); + wait(100); + verify(callbackCalled); + keyRelease(Qt.Key_Alt) + titleSpy.wait() + callbackCalled = false; + + // Ctrl + // On mac Qt automatically translates Meta to Ctrl and vice versa. + // However, if sending the events manually no mapping is being done, + // so we have to do this here manually. + // For testing we assume that the flag Qt::AA_MacDontSwapCtrlAndMeta is NOT set. + keyPress(Qt.platform.os == "osx" ? Qt.Key_Meta : Qt.Key_Control); + titleSpy.wait() + runJavaScript("getPressedModifiers()", function(result) { + compare(result, "alt:released ctrl:pressed meta:no"); + callbackCalled = true; + }); + wait(100); + verify(callbackCalled); + keyRelease(Qt.platform.os == "osx" ? Qt.Key_Meta : Qt.Key_Control); + titleSpy.wait() + callbackCalled = false; + + // Meta (Command on Mac) + keyPress(Qt.platform.os == "osx" ? Qt.Key_Control : Qt.Key_Meta); + titleSpy.wait() + runJavaScript("getPressedModifiers()", function(result) { + compare(result, "alt:released ctrl:released meta:pressed"); + callbackCalled = true; + }); + wait(100); + verify(callbackCalled); + keyRelease(Qt.platform.os == "osx" ? Qt.Key_Control : Qt.Key_Meta); + titleSpy.wait() + callbackCalled = false; + + runJavaScript("getPressedModifiers()", function(result) { + compare(result, "alt:released ctrl:released meta:released"); + callbackCalled = true; + }); + wait(100); + verify(callbackCalled); + callbackCalled = false; + } + } +} diff --git a/tests/auto/quick/qmltests/data/tst_linkHovered.qml b/tests/auto/quick/qmltests/data/tst_linkHovered.qml index 3ce5ba923..c9fbd5520 100644 --- a/tests/auto/quick/qmltests/data/tst_linkHovered.qml +++ b/tests/auto/quick/qmltests/data/tst_linkHovered.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,7 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 +import QtWebEngine 1.1 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_loadFail.qml b/tests/auto/quick/qmltests/data/tst_loadFail.qml index 694547863..0885fc193 100644 --- a/tests/auto/quick/qmltests/data/tst_loadFail.qml +++ b/tests/auto/quick/qmltests/data/tst_loadFail.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,38 +41,71 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 +import QtWebEngine 1.1 import QtWebEngine.experimental 1.0 +import QtWebEngine.testsupport 1.0 TestWebEngineView { id: webEngineView width: 400 height: 300 - property variant unavailableUrl + property var unavailableUrl: Qt.resolvedUrl("file_that_does_not_exist.html") + property var loadRequestArray: [] + + testSupport: WebEngineTestSupport { + property var errorPageLoadStatus: null + + function waitForErrorPageLoadSucceeded() { + var success = _waitFor(function() { return testSupport.errorPageLoadStatus == WebEngineView.LoadSucceededStatus }) + testSupport.errorPageLoadStatus = null + return success + } + + errorPage.onLoadingChanged: { + errorPageLoadStatus = loadRequest.status + + loadRequestArray.push({ + "status": loadRequest.status, + "url": loadRequest.url.toString(), + "errorDomain": loadRequest.errorDomain, + "isErrorPage": true + }) + } + } + + onLoadingChanged: { + if (loadRequest.status == WebEngineView.LoadFailedStatus) { + test.compare(loadRequest.url, unavailableUrl) + test.compare(loadRequest.errorDomain, WebEngineView.InternalErrorDomain) + } + + loadRequestArray.push({ + "status": loadRequest.status, + "url": loadRequest.url.toString(), + "errorDomain": loadRequest.errorDomain, + "isErrorPage": false + }) + } TestCase { id: test name: "WebEngineViewLoadFail" - function initTestCase() { - WebEngine.settings.errorPageEnabled = false - } - function test_fail() { - unavailableUrl = Qt.resolvedUrl("file_that_does_not_exist.html") + WebEngine.settings.errorPageEnabled = false webEngineView.url = unavailableUrl verify(webEngineView.waitForLoadFailed()) } function test_fail_url() { + WebEngine.settings.errorPageEnabled = false var url = Qt.resolvedUrl("test1.html") webEngineView.url = url compare(webEngineView.url, url) verify(webEngineView.waitForLoadSucceeded()) compare(webEngineView.url, url) - unavailableUrl = Qt.resolvedUrl("file_that_does_not_exist.html") webEngineView.url = unavailableUrl compare(webEngineView.url, unavailableUrl) verify(webEngineView.waitForLoadFailed()) @@ -80,12 +113,47 @@ TestWebEngineView { // We expect the url of the previously loaded page here. compare(webEngineView.url, url) } - } - onLoadingChanged: { - if (loadRequest.status == WebEngineView.LoadFailedStatus) { - test.compare(loadRequest.url, unavailableUrl) - test.compare(loadRequest.errorDomain, WebEngineView.InternalErrorDomain) + function test_error_page() { + WebEngine.settings.errorPageEnabled = true + webEngineView.url = unavailableUrl + + // Loading of the error page must be successful + verify(webEngineView.testSupport.waitForErrorPageLoadSucceeded()) + + var loadRequest = null + compare(loadRequestArray.length, 4) + + // Start to load unavailableUrl + loadRequest = loadRequestArray[0] + compare(loadRequest.status, WebEngineView.LoadStartedStatus) + compare(loadRequest.errorDomain, WebEngineView.NoErrorDomain) + compare(loadRequest.url, unavailableUrl) + verify(!loadRequest.isErrorPage) + + // Loading of the unavailableUrl must fail + loadRequest = loadRequestArray[1] + compare(loadRequest.status, WebEngineView.LoadFailedStatus) + compare(loadRequest.errorDomain, WebEngineView.InternalErrorDomain) + compare(loadRequest.url, unavailableUrl) + verify(!loadRequest.isErrorPage) + + // Start to load error page + loadRequest = loadRequestArray[2] + compare(loadRequest.status, WebEngineView.LoadStartedStatus) + compare(loadRequest.errorDomain, WebEngineView.NoErrorDomain) + compare(loadRequest.url, "data:text/html,chromewebdata") + verify(loadRequest.isErrorPage) + + // Loading of the error page must be successful + loadRequest = loadRequestArray[3] + compare(loadRequest.status, WebEngineView.LoadSucceededStatus) + compare(loadRequest.errorDomain, WebEngineView.NoErrorDomain) + compare(loadRequest.url, "data:text/html,chromewebdata") + verify(loadRequest.isErrorPage) + + compare(webEngineView.url, unavailableUrl) + compare(webEngineView.title, unavailableUrl + " is not found") } } } diff --git a/tests/auto/quick/qmltests/data/tst_loadHtml.qml b/tests/auto/quick/qmltests/data/tst_loadHtml.qml index 0bc0cbcaf..b8acd0dd7 100644 --- a/tests/auto/quick/qmltests/data/tst_loadHtml.qml +++ b/tests/auto/quick/qmltests/data/tst_loadHtml.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,7 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 +import QtWebEngine 1.1 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_loadProgress.qml b/tests/auto/quick/qmltests/data/tst_loadProgress.qml index dbf5500ef..9f8b6f6f7 100644 --- a/tests/auto/quick/qmltests/data/tst_loadProgress.qml +++ b/tests/auto/quick/qmltests/data/tst_loadProgress.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,7 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 +import QtWebEngine 1.1 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_loadProgressSignal.qml b/tests/auto/quick/qmltests/data/tst_loadProgressSignal.qml index 896ff4155..8e2e99b64 100644 --- a/tests/auto/quick/qmltests/data/tst_loadProgressSignal.qml +++ b/tests/auto/quick/qmltests/data/tst_loadProgressSignal.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,7 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 +import QtWebEngine 1.1 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_loadRecursionCrash.qml b/tests/auto/quick/qmltests/data/tst_loadRecursionCrash.qml new file mode 100644 index 000000000..2400a5ed6 --- /dev/null +++ b/tests/auto/quick/qmltests/data/tst_loadRecursionCrash.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.3 +import QtTest 1.0 +import QtWebEngine 1.1 + +Item { +width: 300 +height: 400 + TextInput { + id: textInput + anchors { + top: parent.top + left: parent.left + right: parent.right + } + focus: true + text: Qt.resolvedUrl("test1.html") + onEditingFinished: webEngineView.url = text + } + + TestWebEngineView { + id: webEngineView + anchors { + top: textInput.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } + + TestCase { + name: "WebEngineViewLoadRecursionCrash" + when:windowShown + + function test_QTBUG_42929() { + textInput.forceActiveFocus() + keyClick(Qt.Key_Return) + verify(webEngineView.waitForLoadSucceeded()) + textInput.text = "about:blank" + textInput.forceActiveFocus() + keyClick(Qt.Key_Return) + verify(webEngineView.waitForLoadSucceeded()) + textInput.text = Qt.resolvedUrl("test4.html") + textInput.forceActiveFocus() + // Don't crash now + keyClick(Qt.Key_Return) + verify(webEngineView.waitForLoadSucceeded()) + } + } + } +} diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml index e0e185eb0..922925b48 100644 --- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml +++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,7 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 +import QtWebEngine 1.1 import QtWebEngine.experimental 1.0 TestWebEngineView { diff --git a/tests/auto/quick/qmltests/data/tst_navigationHistory.qml b/tests/auto/quick/qmltests/data/tst_navigationHistory.qml index c5dd87ba4..3acde3abc 100644 --- a/tests/auto/quick/qmltests/data/tst_navigationHistory.qml +++ b/tests/auto/quick/qmltests/data/tst_navigationHistory.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,8 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 -import QtWebEngine.experimental 1.0 +import QtWebEngine 1.1 TestWebEngineView { id: webEngineView @@ -52,7 +51,7 @@ TestWebEngineView { ListView { id: backItemsList anchors.fill: parent - model: webEngineView.experimental.navigationHistory.backItems + model: webEngineView.navigationHistory.backItems currentIndex: count - 1 delegate: Text { @@ -64,7 +63,7 @@ TestWebEngineView { ListView { id: forwardItemsList anchors.fill: parent - model: webEngineView.experimental.navigationHistory.forwardItems + model: webEngineView.navigationHistory.forwardItems currentIndex: 0 delegate: Text { @@ -94,7 +93,7 @@ TestWebEngineView { compare(backItemsList.count, 1) compare(backItemsList.currentItem.text, Qt.resolvedUrl("test1.html")) - webEngineView.experimental.goBackTo(0) + webEngineView.goBackOrForward(-1) verify(webEngineView.waitForLoadSucceeded()) compare(webEngineView.url, Qt.resolvedUrl("test1.html")) compare(webEngineView.canGoBack, false) @@ -121,7 +120,7 @@ TestWebEngineView { compare(forwardItemsList.count, 0) compare(backItemsList.currentItem.text, Qt.resolvedUrl("test1.html")) - webEngineView.experimental.goBackTo(1) + webEngineView.goBackOrForward(-2) verify(webEngineView.waitForLoadSucceeded()) compare(webEngineView.url, Qt.resolvedUrl("test1.html")) compare(webEngineView.canGoBack, false) @@ -130,7 +129,7 @@ TestWebEngineView { compare(forwardItemsList.count, 2) compare(forwardItemsList.currentItem.text, Qt.resolvedUrl("test2.html")) - webEngineView.experimental.goForwardTo(1) + webEngineView.goBackOrForward(2) verify(webEngineView.waitForLoadSucceeded()) compare(webEngineView.url, Qt.resolvedUrl("javascript.html")) compare(webEngineView.canGoBack, true) diff --git a/tests/auto/quick/qmltests/data/tst_navigationRequested.qml b/tests/auto/quick/qmltests/data/tst_navigationRequested.qml index 43f84bb62..72eb0aac9 100644 --- a/tests/auto/quick/qmltests/data/tst_navigationRequested.qml +++ b/tests/auto/quick/qmltests/data/tst_navigationRequested.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,7 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 +import QtWebEngine 1.1 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_properties.qml b/tests/auto/quick/qmltests/data/tst_properties.qml index d4fdaafd1..738ef532d 100644 --- a/tests/auto/quick/qmltests/data/tst_properties.qml +++ b/tests/auto/quick/qmltests/data/tst_properties.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,7 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 +import QtWebEngine 1.1 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_runJavaScript.qml b/tests/auto/quick/qmltests/data/tst_runJavaScript.qml index 42c6928e5..6cf3a71fb 100644 --- a/tests/auto/quick/qmltests/data/tst_runJavaScript.qml +++ b/tests/auto/quick/qmltests/data/tst_runJavaScript.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,7 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 +import QtWebEngine 1.1 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_titleChanged.qml b/tests/auto/quick/qmltests/data/tst_titleChanged.qml index 7eb4b63b5..adc8564c0 100644 --- a/tests/auto/quick/qmltests/data/tst_titleChanged.qml +++ b/tests/auto/quick/qmltests/data/tst_titleChanged.qml @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -41,7 +41,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtWebEngine 1.0 +import QtWebEngine 1.1 TestWebEngineView { id: webEngineView diff --git a/tests/auto/quick/qmltests/data/tst_unhandledKeyEventPropagation.qml b/tests/auto/quick/qmltests/data/tst_unhandledKeyEventPropagation.qml new file mode 100644 index 000000000..1c32c73a9 --- /dev/null +++ b/tests/auto/quick/qmltests/data/tst_unhandledKeyEventPropagation.qml @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtTest 1.0 +import QtWebEngine 1.1 + +Item { + id: parentItem + width: 400 + height: 300 + + property var pressEvents: [] + property var releaseEvents: [] + Keys.onPressed: pressEvents.push(event.key) + Keys.onReleased: releaseEvents.push(event.key) + + TestWebEngineView { + id: webEngineView + anchors.fill: parent + focus: true + } + TestCase { + name: "WebEngineViewUnhandledKeyEventPropagation" + + when: false + Timer { + running: parent.windowShown + repeat: false + interval: 1 + onTriggered: parent.when = true + } + + function test_keyboardModifierMapping() { + webEngineView.loadHtml("<input type='text'/>") + webEngineView.waitForLoadSucceeded() + webEngineView.runJavaScript("document.body.firstChild.focus()") + + keyPress(Qt.Key_A) + keyRelease(Qt.Key_A) + keyPress(Qt.Key_Left) + keyRelease(Qt.Key_Left) + keyPress(Qt.Key_Left) + keyRelease(Qt.Key_Left) + + for (var i = 0; i < 20 && parentItem.releaseEvents.length < 3; i++) + wait(100) + + compare(parentItem.pressEvents.length, 1) + compare(parentItem.pressEvents[0], Qt.Key_Left) + compare(parentItem.releaseEvents.length, 3) + compare(parentItem.releaseEvents[0], Qt.Key_A) + compare(parentItem.releaseEvents[1], Qt.Key_Left) + compare(parentItem.releaseEvents[2], Qt.Key_Left) + } + } +} diff --git a/tests/auto/quick/qmltests/data/tst_userScripts.qml b/tests/auto/quick/qmltests/data/tst_userScripts.qml new file mode 100644 index 000000000..a9ed933d9 --- /dev/null +++ b/tests/auto/quick/qmltests/data/tst_userScripts.qml @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtTest 1.0 +import QtWebEngine 1.1 + +Item { + WebEngineScript { + id: changeDocumentTitleScript + sourceUrl: Qt.resolvedUrl("change-document-title.js") + injectionPoint: WebEngineScript.DocumentReady + } + + WebEngineScript { + id: appendDocumentTitleScript + sourceUrl: Qt.resolvedUrl("append-document-title.js") + injectionPoint: WebEngineScript.DocumentReady + } + + WebEngineScript { + id: bigUserScript + sourceUrl: Qt.resolvedUrl("big-user-script.js") + injectionPoint: WebEngineScript.DocumentReady + } + + TestWebEngineView { + id: webEngineView + width: 400 + height: 300 + } + + TestWebEngineView { + id: webEngineViewWithConditionalUserScripts + width: 400 + height: 300 + + onNavigationRequested: { + var urlString = request.url.toString(); + if (urlString.indexOf("test1.html") !== -1) + userScripts = [ changeDocumentTitleScript ]; + else if (urlString.indexOf("test2.html") !== -1) + userScripts = [ appendDocumentTitleScript ]; + else + userScripts = []; + } + } + + TestCase { + name: "WebEngineViewUserScripts" + + function init() { + webEngineView.url = ""; + webEngineView.userScripts = []; + } + + function test_oneScript() { + webEngineView.url = Qt.resolvedUrl("test1.html"); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "Test page 1"); + + webEngineView.userScripts = [ changeDocumentTitleScript ]; + compare(webEngineView.title, "Test page 1"); + + webEngineView.reload(); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "New title"); + + webEngineView.url = Qt.resolvedUrl("test2.html"); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "New title"); + + webEngineView.userScripts = []; + compare(webEngineView.title, "New title"); + + webEngineView.reload(); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "Test page with huge link area"); + } + + function test_twoScripts() { + webEngineView.url = Qt.resolvedUrl("test1.html"); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "Test page 1"); + + webEngineView.userScripts = [ changeDocumentTitleScript, appendDocumentTitleScript ]; + + // Make sure the scripts are loaded in order. + appendDocumentTitleScript.injectionPoint = WebEngineScript.Deferred + webEngineView.reload(); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "New title with appendix"); + + appendDocumentTitleScript.injectionPoint = WebEngineScript.DocumentReady + changeDocumentTitleScript.injectionPoint = WebEngineScript.Deferred + webEngineView.reload(); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "New title"); + + // Make sure we can remove scripts from the preload list. + webEngineView.userScripts = [ appendDocumentTitleScript ]; + webEngineView.reload(); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "Test page 1 with appendix"); + + changeDocumentTitleScript.injectionPoint = WebEngineScript.DocumentReady + } + + function test_setUserScriptsConditionally() { + webEngineViewWithConditionalUserScripts.url = Qt.resolvedUrl("test1.html"); + webEngineViewWithConditionalUserScripts.waitForLoadSucceeded(); + compare(webEngineViewWithConditionalUserScripts.title, "New title"); + + webEngineViewWithConditionalUserScripts.url = Qt.resolvedUrl("test2.html"); + webEngineViewWithConditionalUserScripts.waitForLoadSucceeded(); + compare(webEngineViewWithConditionalUserScripts.title, "Test page with huge link area with appendix"); + + webEngineViewWithConditionalUserScripts.url = Qt.resolvedUrl("test3.html"); + webEngineViewWithConditionalUserScripts.waitForLoadSucceeded(); + compare(webEngineViewWithConditionalUserScripts.title, "Test page 3"); + } + + function test_bigScript() { + webEngineView.userScripts = [ bigUserScript ]; + webEngineView.url = Qt.resolvedUrl("test1.html"); + webEngineView.waitForLoadSucceeded(); + compare(webEngineView.title, "Big user script changed title"); + } + } +} diff --git a/tests/auto/quick/qmltests/data/tst_webchannel.qml b/tests/auto/quick/qmltests/data/tst_webchannel.qml new file mode 100644 index 000000000..dce585b67 --- /dev/null +++ b/tests/auto/quick/qmltests/data/tst_webchannel.qml @@ -0,0 +1,114 @@ +/********************************************************************* +** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtTest 1.0 +import QtWebEngine 1.1 +import QtWebEngine.experimental 1.0 + +import QtWebChannel 1.0 + +Item { + id: test + signal barCalled(var arg) + signal clientInitializedCalled(var arg) + + QtObject { + id: testObject + WebChannel.id: "testObject" + + property var foo: 42 + + function clientInitialized(arg) + { + clientInitializedCalled(arg); + } + + function bar(arg) { + barCalled(arg); + } + + signal runTest(var foo) + } + + TestWebEngineView { + id: webView + webChannel.registeredObjects: [testObject] + } + + SignalSpy { + id: initializedSpy + target: test + signalName: "clientInitializedCalled" + } + + SignalSpy { + id: barSpy + target: test + signalName: "barCalled" + } + + TestCase { + name: "WebViewWebChannel" + property url testUrl: Qt.resolvedUrl("./webchannel-test.html") + + function init() { + initializedSpy.clear(); + barSpy.clear(); + } + + function test_basic() { + webView.url = testUrl; + verify(webView.waitForLoadSucceeded()); + + initializedSpy.wait(); + compare(initializedSpy.signalArguments.length, 1); + compare(initializedSpy.signalArguments[0][0], 42); + + var newValue = "roundtrip"; + testObject.runTest(newValue); + barSpy.wait(); + compare(barSpy.signalArguments.length, 1); + compare(barSpy.signalArguments[0][0], newValue); + + compare(testObject.foo, newValue); + } + } +} diff --git a/tests/auto/quick/qmltests/data/webchannel-test.html b/tests/auto/quick/qmltests/data/webchannel-test.html new file mode 100644 index 000000000..92966b24a --- /dev/null +++ b/tests/auto/quick/qmltests/data/webchannel-test.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script> + <script type="text/javascript"> + //BEGIN SETUP + var channel = new QWebChannel(qt.webChannelTransport, function(channel) { + window.testObject = channel.objects.testObject; + testObject.runTest.connect(function(foo) { + testObject.foo = foo; + testObject.bar(foo); + }); + testObject.clientInitialized(testObject.foo); + }); + //END SETUP + </script> + </head> + <body> + </body> +</html> diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/AlertDialog.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/AlertDialog.qml new file mode 100644 index 000000000..887962a5a --- /dev/null +++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/AlertDialog.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// Both dialogs are basically expected to behave in the same way from an API point of view +ConfirmDialog +{ +} diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/ConfirmDialog.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/ConfirmDialog.qml new file mode 100644 index 000000000..192272e3d --- /dev/null +++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/ConfirmDialog.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQml 2.0 +import QtTest 1.0 +import "../../TestParams" 1.0 + +QtObject { + property string text; + property string title; + signal accepted(); + signal rejected(); + + function open() { + JSDialogParams.dialogTitle = title; + JSDialogParams.dialogMessage = text; + JSDialogParams.dialogCount++; + if (JSDialogParams.shouldAcceptDialog) + accepted() + else + rejected() + } +} + diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/PromptDialog.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/PromptDialog.qml new file mode 100644 index 000000000..197987928 --- /dev/null +++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/PromptDialog.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQml 2.0 +import QtTest 1.0 +import "../../TestParams" 1.0 + +QtObject { + property string text; + property string title; + signal accepted(); + signal rejected(); + signal input(string text); + signal closing(); + + function open() { + JSDialogParams.dialogTitle = title; + JSDialogParams.dialogMessage = text; + JSDialogParams.dialogCount++; + if (JSDialogParams.shouldAcceptDialog) { + input(JSDialogParams.inputForPrompt) + accepted() + } else { + rejected() + } + } +} diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/qmldir b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/qmldir new file mode 100644 index 000000000..1ebabd335 --- /dev/null +++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/qmldir @@ -0,0 +1,4 @@ +module QtWebEngine.UIDelegates +AlertDialog 1.0 AlertDialog.qml +ConfirmDialog 1.0 ConfirmDialog.qml +PromptDialog 1.0 PromptDialog.qml diff --git a/tests/auto/quick/qmltests/mock-delegates/TestParams/JSDialogParams.qml b/tests/auto/quick/qmltests/mock-delegates/TestParams/JSDialogParams.qml new file mode 100644 index 000000000..e1370640b --- /dev/null +++ b/tests/auto/quick/qmltests/mock-delegates/TestParams/JSDialogParams.qml @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +pragma Singleton +import QtQml 2.0 + +QtObject { + property string dialogMessage: ""; + property string dialogTitle: ""; + property bool shouldAcceptDialog: true; + property string inputForPrompt; + property int dialogCount: 0 +} diff --git a/tests/auto/quick/qmltests/mock-delegates/TestParams/qmldir b/tests/auto/quick/qmltests/mock-delegates/TestParams/qmldir new file mode 100644 index 000000000..f2ed87a75 --- /dev/null +++ b/tests/auto/quick/qmltests/mock-delegates/TestParams/qmldir @@ -0,0 +1,4 @@ +# QML module so that the autotests can set testing parameters +module TestParams +singleton JSDialogParams 1.0 JSDialogParams.qml + diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro index b40ef3b8c..8f9274095 100644 --- a/tests/auto/quick/qmltests/qmltests.pro +++ b/tests/auto/quick/qmltests/qmltests.pro @@ -6,29 +6,69 @@ IMPORTPATH += $$PWD/data OTHER_FILES += \ $$PWD/data/TestWebEngineView.qml \ + $$PWD/data/alert.html \ + $$PWD/data/append-document-title.js \ + $$PWD/data/big-user-script.js \ + $$PWD/data/change-document-title.js \ + $$PWD/data/confirm.html \ $$PWD/data/favicon.html \ $$PWD/data/favicon.png \ $$PWD/data/favicon2.html \ $$PWD/data/javascript.html \ $$PWD/data/link.html \ + $$PWD/data/prompt.html \ $$PWD/data/redirect.html \ $$PWD/data/small-favicon.png \ $$PWD/data/test1.html \ $$PWD/data/test2.html \ $$PWD/data/test3.html \ + $$PWD/data/test4.html \ + $$PWD/data/keyboardModifierMapping.html \ $$PWD/data/tst_desktopBehaviorLoadHtml.qml \ $$PWD/data/tst_favIconLoad.qml \ + $$PWD/data/tst_javaScriptDialogs.qml \ $$PWD/data/tst_linkHovered.qml \ $$PWD/data/tst_loadFail.qml \ $$PWD/data/tst_loadHtml.qml \ $$PWD/data/tst_loadProgress.qml \ $$PWD/data/tst_loadProgressSignal.qml \ + $$PWD/data/tst_loadRecursionCrash.qml \ $$PWD/data/tst_loadUrl.qml \ $$PWD/data/tst_navigationHistory.qml \ $$PWD/data/tst_navigationRequested.qml \ $$PWD/data/tst_properties.qml \ $$PWD/data/tst_runJavaScript.qml \ - $$PWD/data/tst_titleChanged.qml + $$PWD/data/tst_titleChanged.qml \ + $$PWD/data/tst_unhandledKeyEventPropagation.qml \ + $$PWD/data/tst_userScripts.qml \ + $$PWD/data/tst_webchannel.qml \ + $$PWD/data/tst_keyboardModifierMapping.qml \ + $$PWD/mock-delegates/QtWebEngine/UIDelegates/AlertDialog.qml \ + $$PWD/mock-delegates/QtWebEngine/UIDelegates/ConfirmDialog.qml \ + $$PWD/mock-delegates/QtWebEngine/UIDelegates/PromptDialog.qml \ + $$PWD/mock-delegates/QtWebEngine/UIDelegates/qmldir \ + $$PWD/mock-delegates/TestParams/JSDialogParams.qml \ + $$PWD/mock-delegates/TestParams/qmldir \ + load(qt_build_paths) DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD$${QMAKE_DIR_SEP}data\\\"\" + +!isQMLTestSupportApiEnabled() { + PLUGIN_EXTENSION = .so + PLUGIN_PREFIX = lib + osx: PLUGIN_PREFIX = .dylib + win32 { + PLUGIN_EXTENSION = .dll + PLUGIN_PREFIX = + } + + TESTSUPPORT_MODULE = $$shell_path($$[QT_INSTALL_QML]/QtWebEngine/testsupport/$${PLUGIN_PREFIX}qtwebenginetestsupportplugin$${PLUGIN_EXTENSION}) + BUILD_DIR = $$shell_path($$clean_path($$OUT_PWD/../../../..)) + SRC_DIR = $$shell_path($$clean_path($$PWD/../../../..)) + + warning("QML Test Support API is disabled. This means some QML tests that use Test Support API will fail.") + warning("Use the following command to build Test Support module and rebuild WebEngineView API:") + warning("cd $$BUILD_DIR && qmake WEBENGINE_CONFIG+=testsupport -r $$shell_path($$SRC_DIR/qtwebengine.pro) && make -C $$shell_path($$BUILD_DIR/src/webengine) clean && make") + warning("After performing the command above make sure QML module \"QtWebEngine.testsupport\" is deployed at $$TESTSUPPORT_MODULE") +} diff --git a/tests/auto/quick/qmltests/tst_qmltests.cpp b/tests/auto/quick/qmltests/tst_qmltests.cpp index afea594fc..4f4f847be 100644 --- a/tests/auto/quick/qmltests/tst_qmltests.cpp +++ b/tests/auto/quick/qmltests/tst_qmltests.cpp @@ -1,36 +1,36 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the QtWebEngine module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** @@ -39,6 +39,19 @@ ** ****************************************************************************/ +#include <QtCore/QScopedPointer> #include <QtQuickTest/quicktest.h> #include "qt_webengine_quicktest.h" -QT_WEBENGINE_TEST_MAIN(qmltests); + +int main(int argc, char **argv) +{ + // Inject the mock ui delegates module + qputenv("QML2_IMPORT_PATH", QByteArray(TESTS_SOURCE_DIR "qmltests/mock-delegates")); + QScopedPointer<Application> app; + + if (!QCoreApplication::instance()) + app.reset(new Application(argc, argv)); + QtWebEngine::initialize(); + int i = quick_test_main(argc, argv, "qmltests", QUICK_TEST_SOURCE_DIR); + return i; +} |