summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/manual.pro7
-rw-r--r--tests/manual/quick/faviconbrowser/AddressBar.qml124
-rw-r--r--tests/manual/quick/faviconbrowser/FaviconPanel.qml256
-rw-r--r--tests/manual/quick/faviconbrowser/faviconbrowser.pro23
-rw-r--r--tests/manual/quick/faviconbrowser/faviconbrowser.qrc17
-rw-r--r--tests/manual/quick/faviconbrowser/main.cpp76
-rw-r--r--tests/manual/quick/faviconbrowser/main.qml192
-rw-r--r--tests/manual/quick/faviconbrowser/utils.h70
-rw-r--r--tests/manual/quick/quick.pro4
-rw-r--r--tests/manual/widgets/inputmethods/colorpicker.cpp80
-rw-r--r--tests/manual/widgets/inputmethods/colorpicker.h56
-rw-r--r--tests/manual/widgets/inputmethods/controlview.cpp108
-rw-r--r--tests/manual/widgets/inputmethods/controlview.h66
-rw-r--r--tests/manual/widgets/inputmethods/inputmethods.pro26
-rw-r--r--tests/manual/widgets/inputmethods/main.cpp144
-rw-r--r--tests/manual/widgets/inputmethods/referenceview.cpp49
-rw-r--r--tests/manual/widgets/inputmethods/referenceview.h46
-rw-r--r--tests/manual/widgets/inputmethods/test.qrc5
-rw-r--r--tests/manual/widgets/inputmethods/testdata.csv21
-rw-r--r--tests/manual/widgets/inputmethods/testview.cpp141
-rw-r--r--tests/manual/widgets/inputmethods/testview.h60
-rw-r--r--tests/manual/widgets/inputmethods/webview.cpp50
-rw-r--r--tests/manual/widgets/inputmethods/webview.h40
-rw-r--r--tests/manual/widgets/widgets.pro4
24 files changed, 1665 insertions, 0 deletions
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
new file mode 100644
index 000000000..edf95846c
--- /dev/null
+++ b/tests/manual/manual.pro
@@ -0,0 +1,7 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ 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 @@
+<!DOCTYPE RCC><RCC version="1.0">
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>AddressBar.qml</file>
+ <file>FaviconPanel.qml</file>
+ </qresource>
+ <qresource prefix="test">
+ <file alias="favicon-multi-gray.html">../../../auto/quick/qmltests/data/favicon-multi-gray.html</file>
+ <file alias="favicon-candidates-gray.html">../../../auto/quick/qmltests/data/favicon-candidates-gray.html</file>
+ <file alias="icons/grayicons.ico">../../../auto/quick/qmltests/data/icons/grayicons.ico</file>
+ <file alias="icons/gray16.png">../../../auto/quick/qmltests/data/icons/gray16.png</file>
+ <file alias="icons/gray32.png">../../../auto/quick/qmltests/data/icons/gray32.png</file>
+ <file alias="icons/gray64.png">../../../auto/quick/qmltests/data/icons/gray64.png</file>
+ <file alias="icons/gray128.png">../../../auto/quick/qmltests/data/icons/gray128.png</file>
+ <file alias="icons/gray255.png">../../../auto/quick/qmltests/data/icons/gray255.png</file>
+ </qresource>
+</RCC>
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 <QtWidgets/QApplication>
+typedef QApplication Application;
+#else
+#include <QtGui/QGuiApplication>
+typedef QGuiApplication Application;
+#endif
+#include <QtQml/QQmlApplicationEngine>
+#include <QtQml/QQmlContext>
+#include <QtWebEngine/qtwebengineglobal.h>
+
+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 <QtCore/QFileInfo>
+#include <QtCore/QUrl>
+
+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
diff --git a/tests/manual/widgets/inputmethods/colorpicker.cpp b/tests/manual/widgets/inputmethods/colorpicker.cpp
new file mode 100644
index 000000000..f279eb418
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/colorpicker.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "colorpicker.h"
+
+#include <QColorDialog>
+#include <QHBoxLayout>
+#include <QLineEdit>
+#include <QPushButton>
+
+ColorPicker::ColorPicker(QWidget *parent)
+ : QWidget(parent)
+ , m_colorInput(new QLineEdit)
+ , m_chooseButton(new QPushButton)
+{
+ m_chooseButton->setText(tr("Choose"));
+
+ QHBoxLayout *layout = new QHBoxLayout;
+ layout->setMargin(0);
+ layout->addWidget(m_colorInput);
+ layout->addWidget(m_chooseButton);
+ setLayout(layout);
+
+ connect(m_colorInput, &QLineEdit::textChanged, this, &ColorPicker::colorStringChanged);
+ connect(m_chooseButton, &QPushButton::clicked, this, &ColorPicker::selectButtonClicked);
+}
+
+QColor ColorPicker::color() const
+{
+ return QColor(m_colorInput->text());
+}
+
+void ColorPicker::setColor(const QColor &color)
+{
+ if (color.isValid())
+ m_colorInput->setText(color.name(QColor::HexArgb));
+}
+
+void ColorPicker::colorStringChanged(const QString &colorString)
+{
+ QColor color(colorString);
+ QPalette palette;
+
+ palette.setColor(QPalette::Base, color.isValid() ? color : QColor(Qt::white));
+ m_colorInput->setPalette(palette);
+}
+
+void ColorPicker::selectButtonClicked()
+{
+ QColor selectedColor = QColorDialog::getColor(color().isValid() ? color() : Qt::white,
+ this,
+ "Select Color",
+ QColorDialog::ShowAlphaChannel);
+ setColor(selectedColor);
+}
diff --git a/tests/manual/widgets/inputmethods/colorpicker.h b/tests/manual/widgets/inputmethods/colorpicker.h
new file mode 100644
index 000000000..f5448ad2d
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/colorpicker.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef COLORPICKER_H
+#define COLORPICKER_H
+
+#include <QColor>
+#include <QWidget>
+
+class QLineEdit;
+class QPushButton;
+
+class ColorPicker : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit ColorPicker(QWidget *parent = 0);
+
+ QColor color() const;
+ void setColor(const QColor &);
+
+public slots:
+ void colorStringChanged(const QString &);
+ void selectButtonClicked();
+
+private:
+ QLineEdit *m_colorInput;
+ QPushButton *m_chooseButton;
+};
+
+#endif // COLORPICKER_H
diff --git a/tests/manual/widgets/inputmethods/controlview.cpp b/tests/manual/widgets/inputmethods/controlview.cpp
new file mode 100644
index 000000000..4538ced4b
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/controlview.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "controlview.h"
+
+#include <QComboBox>
+#include <QCoreApplication>
+#include <QFormLayout>
+#include <QInputMethodEvent>
+#include <QLabel>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QSpinBox>
+#include <QTextCharFormat>
+#include <QTextCursor>
+
+#include "colorpicker.h"
+
+ControlView::ControlView(QWidget *parent)
+ : QWidget(parent)
+ , m_underlineStyleCombo(new QComboBox)
+ , m_underlineColorPicker(new ColorPicker)
+ , m_backgroundColorPicker(new ColorPicker)
+ , m_startSpin(new QSpinBox)
+ , m_lengthSpin(new QSpinBox)
+ , m_inputLine(new QLineEdit)
+ , m_sendEventButton(new QPushButton)
+{
+ m_underlineStyleCombo->addItem(tr("No Underline"), QVariant(QTextCharFormat::NoUnderline));
+ m_underlineStyleCombo->addItem(tr("Single Underline"), QVariant(QTextCharFormat::SingleUnderline));
+
+ m_startSpin->setMinimum(-99);
+ m_lengthSpin->setMinimum(-99);
+
+ m_sendEventButton->setText(tr("Send Input Method Event"));
+
+ QFormLayout *layout = new QFormLayout;
+ layout->addRow(tr("Underline Style:"), m_underlineStyleCombo);
+ layout->addRow(tr("Underline Color:"), m_underlineColorPicker);
+ layout->addRow(tr("Background Color:"), m_backgroundColorPicker);
+ layout->addRow(tr("Start:"), m_startSpin);
+ layout->addRow(tr("Length:"), m_lengthSpin);
+ layout->addRow(tr("Input:"), m_inputLine);
+ layout->addRow(m_sendEventButton);
+ setLayout(layout);
+
+ connect(m_sendEventButton, &QPushButton::clicked, this, &ControlView::createAndSendInputMethodEvent);
+}
+
+void ControlView::receiveInputMethodData(int start,
+ int length,
+ QTextCharFormat::UnderlineStyle underlineStyle,
+ const QColor &underlineColor,
+ const QColor &backgroundColor,
+ const QString &input)
+{
+ m_startSpin->setValue(start);
+ m_lengthSpin->setValue(length);
+ m_underlineStyleCombo->setCurrentIndex(m_underlineStyleCombo->findData(underlineStyle));
+ m_underlineColorPicker->setColor(underlineColor);
+ m_backgroundColorPicker->setColor(backgroundColor);
+ m_inputLine->setText(input);
+}
+
+void ControlView::createAndSendInputMethodEvent()
+{
+ int start = m_startSpin->value();
+ int length = m_lengthSpin->value();
+
+ QTextCharFormat format;
+ format.setUnderlineStyle(static_cast<QTextCharFormat::UnderlineStyle>(m_underlineStyleCombo->currentData().toInt()));
+ format.setUnderlineColor(m_underlineColorPicker->color());
+
+ const QColor &backgroundColor = m_backgroundColorPicker->color();
+ if (backgroundColor.isValid())
+ format.setBackground(QBrush(backgroundColor));
+
+ QList<QInputMethodEvent::Attribute> attrs;
+ attrs.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, start, length, format));
+ QInputMethodEvent im(m_inputLine->text(), attrs);
+
+ emit sendInputMethodEvent(im);
+}
diff --git a/tests/manual/widgets/inputmethods/controlview.h b/tests/manual/widgets/inputmethods/controlview.h
new file mode 100644
index 000000000..0ef10f6a8
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/controlview.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CONTROLVIEW_H
+#define CONTROLVIEW_H
+
+#include <QInputMethodEvent>
+#include <QTextCharFormat>
+#include <QWidget>
+
+class ColorPicker;
+class QComboBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QSpinBox;
+
+class ControlView : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit ControlView(QWidget *parent = 0);
+
+public slots:
+ void receiveInputMethodData(int, int, QTextCharFormat::UnderlineStyle, const QColor &, const QColor &, const QString &);
+ void createAndSendInputMethodEvent();
+
+signals:
+ void sendInputMethodEvent(QInputMethodEvent);
+
+private:
+ QComboBox *m_underlineStyleCombo;
+ ColorPicker *m_underlineColorPicker;
+ ColorPicker *m_backgroundColorPicker;
+ QSpinBox *m_startSpin;
+ QSpinBox *m_lengthSpin;
+ QLineEdit *m_inputLine;
+ QPushButton *m_sendEventButton;
+};
+
+#endif // CONTROLVIEW_H
diff --git a/tests/manual/widgets/inputmethods/inputmethods.pro b/tests/manual/widgets/inputmethods/inputmethods.pro
new file mode 100644
index 000000000..72e8e12f9
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/inputmethods.pro
@@ -0,0 +1,26 @@
+QT += core gui widgets webenginewidgets testlib
+
+TARGET = inputmethods
+TEMPLATE = app
+
+
+SOURCES += \
+ colorpicker.cpp \
+ controlview.cpp \
+ main.cpp \
+ referenceview.cpp \
+ testview.cpp \
+ webview.cpp
+
+HEADERS += \
+ colorpicker.h \
+ controlview.h \
+ referenceview.h \
+ testview.h \
+ webview.h
+
+RESOURCES += \
+ test.qrc
+
+DISTFILES += \
+ testdata.csv
diff --git a/tests/manual/widgets/inputmethods/main.cpp b/tests/manual/widgets/inputmethods/main.cpp
new file mode 100644
index 000000000..a96deb83a
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/main.cpp
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QFormLayout>
+#include <QGroupBox>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QMainWindow>
+#include <QVBoxLayout>
+
+#include "controlview.h"
+#include "referenceview.h"
+#include "testview.h"
+#include "webview.h"
+
+// Test for input method events for QWebEngineView. This makes possible to
+// manually customize QInputMethodEvent and validate that it is rendered
+// properly in a web view.
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+public:
+ explicit MainWindow(QWidget *parent = 0);
+
+private:
+ ControlView *m_controlView;
+ ReferenceView *m_referenceView;
+ WebView *m_webView;
+ TestView *m_testView;
+
+ QLabel *m_referenceProcessed;
+ QLabel *m_webProcessed;
+};
+
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent)
+ , m_controlView(new ControlView)
+ , m_referenceView(new ReferenceView)
+ , m_webView(new WebView)
+ , m_testView(new TestView)
+ , m_referenceProcessed(new QLabel)
+ , m_webProcessed(new QLabel)
+{
+ m_controlView->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ m_controlView->setFixedWidth(300);
+
+ m_webView->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ m_webView->setFixedWidth(280);
+ m_webView->setFixedHeight(150);
+
+ m_testView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ m_testView->setMinimumWidth(400);
+
+ QWidget *centralWidget = new QWidget;
+
+ QGroupBox *referenceGroup = new QGroupBox(tr("Reference"));
+ referenceGroup->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+ referenceGroup->setMinimumWidth(300);
+ QFormLayout *referenceProcessedForm = new QFormLayout;
+ referenceProcessedForm->addRow(tr("Processed:"), m_referenceProcessed);
+ QVBoxLayout *referenceLayout = new QVBoxLayout;
+ referenceLayout->addWidget(m_referenceView);
+ referenceLayout->addLayout(referenceProcessedForm);
+ referenceGroup->setLayout(referenceLayout);
+
+ QGroupBox *webGroup = new QGroupBox(tr("Web"));
+ webGroup->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+ webGroup->setMinimumWidth(300);
+ QFormLayout *webProcessedForm = new QFormLayout;
+ webProcessedForm->addRow(tr("Processed:"), m_webProcessed);
+ QVBoxLayout *webLayout = new QVBoxLayout;
+ webLayout->addWidget(m_webView);
+ webLayout->addLayout(webProcessedForm);
+ webGroup->setLayout(webLayout);
+
+ QVBoxLayout *leftLayout = new QVBoxLayout;
+ leftLayout->addWidget(m_controlView);
+ leftLayout->addWidget(referenceGroup);
+ leftLayout->addWidget(webGroup);
+
+ QHBoxLayout *centralLayout = new QHBoxLayout;
+ centralLayout->addLayout(leftLayout);
+ centralLayout->addWidget(m_testView);
+
+ connect(m_testView, &TestView::sendInputMethodData, m_controlView, &ControlView::receiveInputMethodData);
+ connect(m_testView, &TestView::requestInputMethodEvent, m_controlView, &ControlView::createAndSendInputMethodEvent);
+
+ connect(m_controlView, &ControlView::sendInputMethodEvent, [=](QInputMethodEvent im) {
+ bool processed;
+ QString resultText;
+
+ processed = QApplication::sendEvent(m_referenceView->referenceInput(), &im);
+ resultText = processed ? QStringLiteral("<font color='green'>TRUE</font>")
+ : QStringLiteral("<font color='red'>FALSE</font>");
+ m_referenceProcessed->setText(resultText);
+
+ processed = QApplication::sendEvent(m_webView->focusProxy(), &im);
+ resultText = processed ? QStringLiteral("<font color='green'>TRUE</font>")
+ : QStringLiteral("<font color='red'>FALSE</font>");
+ m_webProcessed->setText(resultText);
+ });
+
+ centralWidget->setLayout(centralLayout);
+ setCentralWidget(centralWidget);
+ setWindowTitle(tr("Input Methods Format Manual Test"));
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+
+ return a.exec();
+}
+
+#include "main.moc"
diff --git a/tests/manual/widgets/inputmethods/referenceview.cpp b/tests/manual/widgets/inputmethods/referenceview.cpp
new file mode 100644
index 000000000..906a3001e
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/referenceview.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "referenceview.h"
+
+#include <QVBoxLayout>
+
+ReferenceView::ReferenceView(QWidget *parent)
+ : QWidget(parent)
+ , m_referenceInput(new QLineEdit)
+{
+ m_referenceInput->setMinimumHeight(50);
+ m_referenceInput->setMaximumWidth(250);
+ m_referenceInput->setFont(QFont(QStringLiteral("Serif"), 28));
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(m_referenceInput);
+ setLayout(layout);
+}
+
+QLineEdit *ReferenceView::referenceInput()
+{
+ return m_referenceInput;
+}
diff --git a/tests/manual/widgets/inputmethods/referenceview.h b/tests/manual/widgets/inputmethods/referenceview.h
new file mode 100644
index 000000000..4025d4886
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/referenceview.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef REFERENCEVIEW_H
+#define REFERENCEVIEW_H
+
+#include <QLineEdit>
+#include <QWidget>
+
+class ReferenceView : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit ReferenceView(QWidget *parent = 0);
+ QLineEdit *referenceInput();
+
+private:
+ QLineEdit *m_referenceInput;
+};
+
+#endif // REFERENCEVIEW_H
diff --git a/tests/manual/widgets/inputmethods/test.qrc b/tests/manual/widgets/inputmethods/test.qrc
new file mode 100644
index 000000000..bee4bec74
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/test.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>testdata.csv</file>
+ </qresource>
+</RCC>
diff --git a/tests/manual/widgets/inputmethods/testdata.csv b/tests/manual/widgets/inputmethods/testdata.csv
new file mode 100644
index 000000000..4d57e19e8
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/testdata.csv
@@ -0,0 +1,21 @@
+"", 0, 0, 1, "red", ""
+
+"Q", 0, 1, 1, "red", ""
+"Qt", 0, 1, 1, "red", ""
+"Qt", 0, 2, 1, "red", ""
+"Qt", 1, 1, 1, "red", ""
+
+"Qt ", 0, 1, 1, "red", ""
+"Qt ", 1, 1, 1, "red", ""
+"Qt ", 2, 1, 1, "red", ""
+"Qt ", 2, -1, 1, "red", ""
+"Qt ", -2, 3, 1, "red", ""
+"Qt ", -1, -1, 1, "red", ""
+
+"The Qt", 0, 1, 1, "red", ""
+"The Qt Company", 0, 1, 1, "red", ""
+
+"The Qt Company", 0, 3, 1, "green", ""
+"The Qt Company", 4, 2, 1, "green", "red"
+"The Qt Company", 7, 7, 0, "green", "red"
+"The Qt Company", 7, 7, 0, "", "red"
diff --git a/tests/manual/widgets/inputmethods/testview.cpp b/tests/manual/widgets/inputmethods/testview.cpp
new file mode 100644
index 000000000..d41734c2d
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/testview.cpp
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testview.h"
+
+#include <QDebug>
+#include <QFile>
+#include <QPushButton>
+#include <QRegExp>
+#include <QStandardItemModel>
+#include <QTableView>
+#include <QTest>
+#include <QTextCharFormat>
+#include <QVBoxLayout>
+
+TestView::TestView(QWidget *parent)
+ : QWidget(parent)
+ , m_tableView(new QTableView)
+ , m_testButton(new QPushButton)
+ , m_testRunning(false)
+{
+ m_testButton->setText(tr("Start Test"));
+ connect(m_testButton, &QPushButton::clicked, this, &TestView::startOrCancelTest);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(m_tableView);
+ layout->addWidget(m_testButton);
+ setLayout(layout);
+
+ QStandardItemModel *model = new QStandardItemModel(0, 6, this);
+ model->setHorizontalHeaderItem(0, new QStandardItem(tr("Input")));
+ model->setHorizontalHeaderItem(1, new QStandardItem(tr("Start")));
+ model->setHorizontalHeaderItem(2, new QStandardItem(tr("Length")));
+ model->setHorizontalHeaderItem(3, new QStandardItem(tr("Underline")));
+ model->setHorizontalHeaderItem(4, new QStandardItem(tr("Underline Color")));
+ model->setHorizontalHeaderItem(5, new QStandardItem(tr("Background Color")));
+
+ m_tableView->setModel(model);
+ connect(m_tableView, &QTableView::clicked, this, &TestView::collectAndSendData);
+
+ loadTestData(":/testdata.csv");
+}
+
+void TestView::loadTestData(const QString &testDataPath)
+{
+ QFile testDataFile(testDataPath);
+ if (!testDataFile.open(QIODevice::ReadOnly)) {
+ qWarning() << "Unable to open " << testDataFile.fileName() << ":" << testDataFile.errorString();
+ return;
+ }
+
+ QTextStream testDataStream(&testDataFile);
+ while (!testDataStream.atEnd()) {
+ QString line = testDataStream.readLine();
+ QRegExp data("^\"(.*)\"\\s*,\\s*(-?\\d+)\\s*,\\s*(-?\\d+)\\s*,\\s*(\\d+)\\s*,\\s*\"(.*)\"\\s*,\\s*\"(.*)\"\\s*$");
+ if (!data.exactMatch(line))
+ continue;
+
+ QStandardItemModel *model = qobject_cast<QStandardItemModel *>(m_tableView->model());
+
+ QList<QStandardItem *> row;
+ for (int i = 1; i <= data.captureCount(); ++i)
+ row.append(new QStandardItem(data.cap(i)));
+
+ model->appendRow(row);
+ }
+
+ testDataFile.close();
+}
+
+void TestView::startOrCancelTest()
+{
+ if (m_testRunning) {
+ m_testRunning = false;
+ m_testButton->setText(tr("Start Test"));
+ return;
+ }
+
+ m_testRunning = true;
+ m_testButton->setText(tr("Cancel Test"));
+
+ int firstRowIndex = m_tableView->currentIndex().row() + 1;
+ if (firstRowIndex == m_tableView->model()->rowCount())
+ firstRowIndex = 0;
+
+ for (int row = firstRowIndex; row < m_tableView->model()->rowCount(); ++row) {
+ if (!m_testRunning)
+ break;
+
+ m_tableView->selectRow(row);
+ collectAndSendData();
+ emit requestInputMethodEvent();
+
+ QTest::qWait(1000);
+ }
+
+ if (m_testRunning) {
+ m_testRunning = false;
+ m_testButton->setText(tr("Start Test"));
+ }
+}
+
+void TestView::collectAndSendData()
+{
+ int row = m_tableView->currentIndex().row();
+ QStandardItemModel *model = static_cast<QStandardItemModel *>(m_tableView->model());
+
+ const QString &input = model->data(model->index(row, 0)).toString();
+ const int start = model->data(model->index(row, 1)).toInt();
+ const int length = model->data(model->index(row, 2)).toInt();
+ const QTextCharFormat::UnderlineStyle underlineStyle = static_cast<QTextCharFormat::UnderlineStyle>(model->data(model->index(row, 3)).toInt());
+ const QColor &underlineColor = qvariant_cast<QColor>(model->data(model->index(row, 4)));
+ const QColor &backgroundColor = qvariant_cast<QColor>(model->data(model->index(row, 5)));
+
+ emit sendInputMethodData(start, length, underlineStyle, underlineColor, backgroundColor.isValid() ? backgroundColor : Qt::white, input);
+}
diff --git a/tests/manual/widgets/inputmethods/testview.h b/tests/manual/widgets/inputmethods/testview.h
new file mode 100644
index 000000000..4934a5f87
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/testview.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTVIEW_H
+#define TESTVIEW_H
+
+#include <QTextCharFormat>
+#include <QWidget>
+
+class QPushButton;
+class QTableView;
+
+class TestView : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit TestView(QWidget *parent = 0);
+
+public slots:
+ void loadTestData(const QString &);
+ void startOrCancelTest();
+ void collectAndSendData();
+
+signals:
+ void sendInputMethodData(int, int, QTextCharFormat::UnderlineStyle, const QColor &, const QColor &, const QString &);
+ void requestInputMethodEvent();
+
+private:
+ QTableView *m_tableView;
+ QPushButton *m_testButton;
+
+ bool m_testRunning;
+};
+
+#endif // TESTVIEW_H
diff --git a/tests/manual/widgets/inputmethods/webview.cpp b/tests/manual/widgets/inputmethods/webview.cpp
new file mode 100644
index 000000000..ac5dadce1
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/webview.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "webview.h"
+
+WebView::WebView(QWidget *parent)
+ : QWebEngineView(parent)
+{
+ const QString html = QStringLiteral(
+ "<html><head>"
+ " <style>"
+ " input {"
+ " width: 250px; height: 50px; font-size: 28pt;"
+ " position: absolute; top: 50%; left: 50%; margin-left: -125px; margin-top: -25px;"
+ " font-family: serif"
+ " }"
+ " body { background-color: black; }"
+ " </style>"
+ "</head>"
+ "<body onload='document.getElementById(\"input1\").focus();'>"
+ " <input type='text' id='input1' />"
+ "</body></html>");
+
+ setHtml(html);
+}
diff --git a/tests/manual/widgets/inputmethods/webview.h b/tests/manual/widgets/inputmethods/webview.h
new file mode 100644
index 000000000..be57fbf29
--- /dev/null
+++ b/tests/manual/widgets/inputmethods/webview.h
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef WEBVIEW_H
+#define WEBVIEW_H
+
+#include <QWebEngineView>
+
+class WebView : public QWebEngineView
+{
+ Q_OBJECT
+public:
+ explicit WebView(QWidget *parent = 0);
+};
+
+#endif // WEBVIEW_H
diff --git a/tests/manual/widgets/widgets.pro b/tests/manual/widgets/widgets.pro
new file mode 100644
index 000000000..f06d3e1c3
--- /dev/null
+++ b/tests/manual/widgets/widgets.pro
@@ -0,0 +1,4 @@
+TEMPLATE= subdirs
+
+SUBDIRS += \
+ inputmethods