From 2c3add6c320f4058d8b6c86d9b9aadc1955329e9 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 14 Nov 2016 15:44:05 +0100 Subject: Add faviconbrowser quick manual test Change-Id: I3b6353b5c58d62c968c704b20224ff8ee600a524 Reviewed-by: Allan Sandfeld Jensen --- tests/manual/manual.pro | 3 +- tests/manual/quick/faviconbrowser/AddressBar.qml | 124 ++++++++++ tests/manual/quick/faviconbrowser/FaviconPanel.qml | 256 +++++++++++++++++++++ .../manual/quick/faviconbrowser/faviconbrowser.pro | 23 ++ .../manual/quick/faviconbrowser/faviconbrowser.qrc | 17 ++ tests/manual/quick/faviconbrowser/main.cpp | 76 ++++++ tests/manual/quick/faviconbrowser/main.qml | 192 ++++++++++++++++ tests/manual/quick/faviconbrowser/utils.h | 70 ++++++ tests/manual/quick/quick.pro | 4 + 9 files changed, 764 insertions(+), 1 deletion(-) create mode 100644 tests/manual/quick/faviconbrowser/AddressBar.qml create mode 100644 tests/manual/quick/faviconbrowser/FaviconPanel.qml create mode 100644 tests/manual/quick/faviconbrowser/faviconbrowser.pro create mode 100644 tests/manual/quick/faviconbrowser/faviconbrowser.qrc create mode 100644 tests/manual/quick/faviconbrowser/main.cpp create mode 100644 tests/manual/quick/faviconbrowser/main.qml create mode 100644 tests/manual/quick/faviconbrowser/utils.h create mode 100644 tests/manual/quick/quick.pro (limited to 'tests/manual') diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro index 16f56dbe9..edf95846c 100644 --- a/tests/manual/manual.pro +++ b/tests/manual/manual.pro @@ -1,6 +1,7 @@ TEMPLATE = subdirs SUBDIRS += \ - widgets + widgets \ + quick !qtHaveModule(webenginewidgets): SUBDIRS -= widgets diff --git a/tests/manual/quick/faviconbrowser/AddressBar.qml b/tests/manual/quick/faviconbrowser/AddressBar.qml new file mode 100644 index 000000000..7122b2862 --- /dev/null +++ b/tests/manual/quick/faviconbrowser/AddressBar.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +Rectangle { + id: root + + property int progress: 0 + property url iconUrl: "" + property url pageUrl: "" + + signal accepted(url addressUrl) + + clip: true + + onActiveFocusChanged: { + if (activeFocus) + addressField.forceActiveFocus(); + } + + Rectangle { + width: addressField.width / 100 * root.progress + height: root.height + + visible: root.progress < 100 + + color: "#b6dca6" + radius: root.radius + } + + TextField { + id: addressField + anchors.fill: parent + + Image { + anchors.verticalCenter: addressField.verticalCenter + x: 5; z: parent.z + 1 + width: 16; height: 16 + sourceSize: Qt.size(width, height) + source: root.iconUrl + visible: root.progress == 100 + } + + Text { + text: root.progress < 0 ? "" : root.progress + "%" + x: 5; z: parent.z + 1 + font.bold: true + anchors.verticalCenter: parent.verticalCenter + + visible: root.progress < 100 + } + + style: TextFieldStyle { + padding.left: 30 + + background: Rectangle { + color: "transparent" + border.color: "black" + border.width: 1 + radius: root.radius + } + } + + onActiveFocusChanged: { + if (activeFocus) + selectAll(); + else + deselect(); + } + + text: root.pageUrl + onAccepted: root.accepted(utils.fromUserInput(text)) + } +} diff --git a/tests/manual/quick/faviconbrowser/FaviconPanel.qml b/tests/manual/quick/faviconbrowser/FaviconPanel.qml new file mode 100644 index 000000000..ce768b82d --- /dev/null +++ b/tests/manual/quick/faviconbrowser/FaviconPanel.qml @@ -0,0 +1,256 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Layouts 1.1 + +Item { + id: root + + property url iconUrl: "" + property int iconSize: 128 + property int iconMinimumSize: 8 + property int iconMaximumSize: 256 + + RowLayout { + anchors.fill: parent + spacing: 2 + + Rectangle { + Layout.fillWidth: true + Layout.fillHeight: true + + RowLayout { + anchors.fill: parent + spacing: 2 + + Rectangle { + Layout.fillHeight: true + Layout.preferredWidth: (parent.width - 2 * parent.spacing) / 3 + + border.color: "black" + border.width: 1 + clip: true + + Text { + z: parent.z + 1 + anchors.top: parent.top + anchors.topMargin: 5 + anchors.left: parent.left + anchors.leftMargin: 5 + font.bold: true + + text: "faviconImage" + } + + Image { + id: faviconImage + anchors.centerIn: parent + + width: root.iconSize + height: width + sourceSize: Qt.size(width, height) + + source: root.iconUrl + + onStatusChanged: { + if (status == Image.Ready) { + grabToImage(function(result) { + grabImage.source = result.url; + }); + } + + if (status == Image.Null) + grabImage.source = ""; + } + } + } + + Rectangle { + Layout.fillHeight: true + Layout.preferredWidth: (parent.width - 2 * parent.spacing) / 3 + + border.color: "black" + border.width: 1 + clip: true + + Text { + z: parent.z + 1 + anchors.top: parent.top + anchors.topMargin: 5 + anchors.left: parent.left + anchors.leftMargin: 5 + font.bold: true + + text: "grabImage" + } + + Image { + id: grabImage + anchors.centerIn: parent + + width: root.iconSize + height: width + + onStatusChanged: { + if (status == Image.Ready || status == Image.Null) + faviconCanvas.requestPaint(); + } + } + } + + Rectangle { + Layout.fillHeight: true + Layout.preferredWidth: (parent.width - 2 * parent.spacing) / 3 + + border.color: "black" + border.width: 1 + clip: true + + Text { + z: parent.z + 1 + anchors.top: parent.top + anchors.topMargin: 5 + anchors.left: parent.left + anchors.leftMargin: 5 + font.bold: true + + text: "faviconCanvas" + } + + Canvas { + id: faviconCanvas + anchors.centerIn: parent + + width: root.iconSize + height: width + + onPaint: { + var ctx = getContext("2d"); + ctx.reset(); + ctx.clearRect(0, 0, width, height); + + if (grabImage.source == "") + return; + + ctx.drawImage(grabImage, 0, 0, width, height); + + var imageData = ctx.getImageData(width/2, height/2, width/2, height/2); + var pixel = imageData.data; + + verbose.append("pixel(" + width/2 + ", " + height/2 + "): " + pixel[0] + ", " + pixel[1] + ", " + pixel[2]); + } + } + } + } + } + + Rectangle { + Layout.fillHeight: true + Layout.preferredWidth: 100 + + Slider { + id: faviconSizeSlider + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.bottom: faviconSizeSpin.top + + orientation: Qt.Vertical + minimumValue: root.iconMinimumSize + maximumValue: root.iconMaximumSize + stepSize: 1 + tickmarksEnabled: true + value: root.iconSize + + onValueChanged: { + if (pressed && value != root.iconSize) + root.iconSize = value; + } + } + + SpinBox { + id: faviconSizeSpin + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + + minimumValue: root.iconMinimumSize + maximumValue: root.iconMaximumSize + value: root.iconSize + + onEditingFinished: { + if (value != root.iconSize) + root.iconSize = value; + } + } + } + + TextArea { + id: verbose + + Layout.fillHeight: true + Layout.preferredWidth: 310 + + readOnly: true + tabChangesFocus: true + + font.family: "Monospace" + font.pointSize: 12 + + textFormat: TextEdit.RichText + frameVisible: false + + style: TextAreaStyle { + backgroundColor: "lightgray" + } + } + } +} diff --git a/tests/manual/quick/faviconbrowser/faviconbrowser.pro b/tests/manual/quick/faviconbrowser/faviconbrowser.pro new file mode 100644 index 000000000..d4368ab3e --- /dev/null +++ b/tests/manual/quick/faviconbrowser/faviconbrowser.pro @@ -0,0 +1,23 @@ +QT += qml quick webengine +qtHaveModule(widgets) { + QT += widgets # QApplication is required to get native styling with QtQuickControls +} + +TARGET = faviconbrowser +TEMPLATE = app + + +SOURCES = \ + main.cpp + +HEADERS = \ + utils.h + +OTHER_FILES += \ + main.qml \ + AddressBar.qml \ + FaviconPanel.qml + +RESOURCES += \ + faviconbrowser.qrc + diff --git a/tests/manual/quick/faviconbrowser/faviconbrowser.qrc b/tests/manual/quick/faviconbrowser/faviconbrowser.qrc new file mode 100644 index 000000000..95d0dc2c4 --- /dev/null +++ b/tests/manual/quick/faviconbrowser/faviconbrowser.qrc @@ -0,0 +1,17 @@ + + + main.qml + AddressBar.qml + FaviconPanel.qml + + + ../../../auto/quick/qmltests/data/favicon-multi-gray.html + ../../../auto/quick/qmltests/data/favicon-candidates-gray.html + ../../../auto/quick/qmltests/data/icons/grayicons.ico + ../../../auto/quick/qmltests/data/icons/gray16.png + ../../../auto/quick/qmltests/data/icons/gray32.png + ../../../auto/quick/qmltests/data/icons/gray64.png + ../../../auto/quick/qmltests/data/icons/gray128.png + ../../../auto/quick/qmltests/data/icons/gray255.png + + diff --git a/tests/manual/quick/faviconbrowser/main.cpp b/tests/manual/quick/faviconbrowser/main.cpp new file mode 100644 index 000000000..b75be2483 --- /dev/null +++ b/tests/manual/quick/faviconbrowser/main.cpp @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "utils.h" + +#ifndef QT_NO_WIDGETS +#include +typedef QApplication Application; +#else +#include +typedef QGuiApplication Application; +#endif +#include +#include +#include + +int main(int argc, char **argv) +{ + Application app(argc, argv); + + QtWebEngine::initialize(); + + QQmlApplicationEngine appEngine; + Utils utils; + appEngine.rootContext()->setContextProperty("utils", &utils); + appEngine.load(QUrl("qrc:/main.qml")); + + return app.exec(); +} diff --git a/tests/manual/quick/faviconbrowser/main.qml b/tests/manual/quick/faviconbrowser/main.qml new file mode 100644 index 000000000..1ad5fc2e8 --- /dev/null +++ b/tests/manual/quick/faviconbrowser/main.qml @@ -0,0 +1,192 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.1 +import QtWebEngine 1.3 +import Qt.labs.settings 1.0 + +ApplicationWindow { + width: 1300 + height: 900 + visible: true + + Item { + id: bookmarkUrls + + property url multiTest: Qt.resolvedUrl("qrc:/test/favicon-multi-gray.html") + property url candidatesTest: Qt.resolvedUrl("qrc:/test/favicon-candidates-gray.html") + property url aboutBlank: Qt.resolvedUrl("about:blank") + property url qtHome: Qt.resolvedUrl("http://www.qt.io/") + } + + Settings { + id: appSettings + + property alias autoLoadIconsForPage: autoLoadIconsForPage.checked + property alias touchIconsEnabled: touchIconsEnabled.checked + } + + SplitView { + anchors.fill: parent + orientation: Qt.Vertical + + FaviconPanel { + id: faviconPanel + + Layout.fillWidth: true + Layout.minimumHeight: 200 + + Layout.margins: 2 + + iconUrl: webEngineView && webEngineView.icon + } + + ColumnLayout { + Layout.fillWidth: true + Layout.fillHeight: true + Layout.topMargin: 2 + + AddressBar { + id: addressBar + + Layout.fillWidth: true + Layout.leftMargin: 5 + Layout.rightMargin: 5 + height: 25 + + color: "white" + radius: 4 + + progress: webEngineView && webEngineView.loadProgress + iconUrl: webEngineView && webEngineView.icon + pageUrl: webEngineView && webEngineView.url + + onAccepted: webEngineView.url = addressUrl + } + + Rectangle { + id: toolBar + + Layout.fillWidth: true + Layout.leftMargin: 5 + Layout.rightMargin: 5 + Layout.preferredHeight: 25 + + RowLayout { + anchors.verticalCenter: parent.verticalCenter + + Button { + text: "Multi-sized Favicon Test" + onClicked: webEngineView.url = bookmarkUrls.multiTest + enabled: webEngineView.url != bookmarkUrls.multiTest + } + + Button { + text: "Candidate Favicons Test" + onClicked: webEngineView.url = bookmarkUrls.candidatesTest + enabled: webEngineView.url != bookmarkUrls.candidatesTest + } + + Button { + text: "About Blank" + onClicked: webEngineView.url = bookmarkUrls.aboutBlank + enabled: webEngineView.url != bookmarkUrls.aboutBlank + } + + Button { + text: "Qt Home Page" + onClicked: webEngineView.url = bookmarkUrls.qtHome + enabled: webEngineView.url != bookmarkUrls.qtHome + } + } + + ToolButton { + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + + menu: Menu { + MenuItem { + id: autoLoadIconsForPage + text: "Icons On" + checkable: true + checked: WebEngine.settings.autoLoadIconsForPage + + onCheckedChanged: webEngineView.reload() + } + + MenuItem { + id: touchIconsEnabled + text: "Touch Icons On" + checkable: true + checked: WebEngine.settings.touchIconsEnabled + enabled: autoLoadIconsForPage.checked + + onCheckedChanged: webEngineView.reload() + } + } + } + } + + WebEngineView { + id: webEngineView + + Layout.fillWidth: true + Layout.fillHeight: true + + settings.autoLoadIconsForPage: appSettings.autoLoadIconsForPage + settings.touchIconsEnabled: appSettings.touchIconsEnabled + + Component.onCompleted: webEngineView.url = bookmarkUrls.multiTest + } + } + } +} diff --git a/tests/manual/quick/faviconbrowser/utils.h b/tests/manual/quick/faviconbrowser/utils.h new file mode 100644 index 000000000..79aa38cc7 --- /dev/null +++ b/tests/manual/quick/faviconbrowser/utils.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef UTILS_H +#define UTILS_H + +#include +#include + +class Utils : public QObject { + Q_OBJECT +public: + Q_INVOKABLE static QUrl fromUserInput(const QString& userInput); +}; + +inline QUrl Utils::fromUserInput(const QString& userInput) +{ + QFileInfo fileInfo(userInput); + if (fileInfo.exists()) + return QUrl::fromLocalFile(fileInfo.absoluteFilePath()); + return QUrl::fromUserInput(userInput); +} + +#endif // UTILS_H diff --git a/tests/manual/quick/quick.pro b/tests/manual/quick/quick.pro new file mode 100644 index 000000000..5251c4b42 --- /dev/null +++ b/tests/manual/quick/quick.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs + +SUBDIRS += \ + faviconbrowser -- cgit v1.2.3