summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-05-10 16:58:00 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-05-10 16:58:12 +0200
commite5157941181f6bb5e906377e68af9bbe2ab55795 (patch)
treee0f109b51e8faa44cb36ca2ac95d8cd1b4387be2 /tests/auto
parentc2f7f09974959c252a5e2879adfffe6356543fff (diff)
parent023168cf91dc7ac11ced1b6a60ca7aa248987810 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/quick/qmltests/data/favicon-candidates-gray.html29
-rw-r--r--tests/auto/quick/qmltests/data/favicon-multi-gray.html16
-rw-r--r--tests/auto/quick/qmltests/data/icons/gray128.pngbin0 -> 146 bytes
-rw-r--r--tests/auto/quick/qmltests/data/icons/gray16.pngbin0 -> 72 bytes
-rw-r--r--tests/auto/quick/qmltests/data/icons/gray255.pngbin0 -> 335 bytes
-rw-r--r--tests/auto/quick/qmltests/data/icons/gray32.pngbin0 -> 79 bytes
-rw-r--r--tests/auto/quick/qmltests/data/icons/gray64.pngbin0 -> 99 bytes
-rw-r--r--tests/auto/quick/qmltests/data/tst_favicon.qml33
-rw-r--r--tests/auto/quick/qmltests/qmltests.pro6
-rw-r--r--tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp38
-rw-r--r--tests/auto/widgets/qwebenginespellcheck/dict/en-US.aff5
-rw-r--r--tests/auto/widgets/qwebenginespellcheck/dict/en-US.dic11
-rw-r--r--tests/auto/widgets/qwebenginespellcheck/qwebenginespellcheck.pro22
-rw-r--r--tests/auto/widgets/qwebenginespellcheck/resources/index.html36
-rw-r--r--tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp178
-rw-r--r--tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.qrc5
-rw-r--r--tests/auto/widgets/widgets.pro5
17 files changed, 366 insertions, 18 deletions
diff --git a/tests/auto/quick/qmltests/data/favicon-candidates-gray.html b/tests/auto/quick/qmltests/data/favicon-candidates-gray.html
new file mode 100644
index 000000000..3cbc4a4c3
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/favicon-candidates-gray.html
@@ -0,0 +1,29 @@
+<html>
+ <head>
+ <title>Gray Candidate Favicons Test</title>
+ <link rel="shortcut icon" href="icons/gray16.png" />
+ <link rel="shortcut icon" href="icons/gray32.png" />
+ <link rel="shortcut icon" href="icons/gray64.png" />
+ <link rel="shortcut icon" href="icons/gray128.png" />
+ <link rel="shortcut icon" href="icons/gray255.png" />
+ </head>
+ <body>
+ <h1>Gray Candidate Favicons Test</h1>
+ <table style="width:100%">
+ <tr>
+ <td align="center"><img src="icons/gray16.png" height="16" width="16" /></td>
+ <td align="center"><img src="icons/gray32.png" height="32" width="32" /></td>
+ <td align="center"><img src="icons/gray64.png" height="64" width="64" /></td>
+ <td align="center"><img src="icons/gray128.png" height="128" width="128" /></td>
+ <td align="center"><img src="icons/gray255.png" height="255" width="255" /></td>
+ </tr>
+ <tr>
+ <td align="center">16x16</td>
+ <td align="center">32x32</td>
+ <td align="center">64x64</td>
+ <td align="center">128x128</td>
+ <td align="center">255x255</td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/tests/auto/quick/qmltests/data/favicon-multi-gray.html b/tests/auto/quick/qmltests/data/favicon-multi-gray.html
index d6ac0909f..9b9b7432d 100644
--- a/tests/auto/quick/qmltests/data/favicon-multi-gray.html
+++ b/tests/auto/quick/qmltests/data/favicon-multi-gray.html
@@ -5,5 +5,21 @@
</head>
<body>
<h1>Gray Multi-sized Favicon Test</h1>
+ <table style="width:100%">
+ <tr>
+ <td align="center"><img src="icons/gray16.png" height="16" width="16" /></td>
+ <td align="center"><img src="icons/gray32.png" height="32" width="32" /></td>
+ <td align="center"><img src="icons/gray64.png" height="64" width="64" /></td>
+ <td align="center"><img src="icons/gray128.png" height="128" width="128" /></td>
+ <td align="center"><img src="icons/gray255.png" height="255" width="255" /></td>
+ </tr>
+ <tr>
+ <td align="center">16x16</td>
+ <td align="center">32x32</td>
+ <td align="center">64x64</td>
+ <td align="center">128x128</td>
+ <td align="center">255x255</td>
+ </tr>
+ </table>
</body>
</html>
diff --git a/tests/auto/quick/qmltests/data/icons/gray128.png b/tests/auto/quick/qmltests/data/icons/gray128.png
new file mode 100644
index 000000000..bf1cfaba0
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/icons/gray128.png
Binary files differ
diff --git a/tests/auto/quick/qmltests/data/icons/gray16.png b/tests/auto/quick/qmltests/data/icons/gray16.png
new file mode 100644
index 000000000..2a1a91a76
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/icons/gray16.png
Binary files differ
diff --git a/tests/auto/quick/qmltests/data/icons/gray255.png b/tests/auto/quick/qmltests/data/icons/gray255.png
new file mode 100644
index 000000000..549169551
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/icons/gray255.png
Binary files differ
diff --git a/tests/auto/quick/qmltests/data/icons/gray32.png b/tests/auto/quick/qmltests/data/icons/gray32.png
new file mode 100644
index 000000000..b269a528f
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/icons/gray32.png
Binary files differ
diff --git a/tests/auto/quick/qmltests/data/icons/gray64.png b/tests/auto/quick/qmltests/data/icons/gray64.png
new file mode 100644
index 000000000..e02559e5b
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/icons/gray64.png
Binary files differ
diff --git a/tests/auto/quick/qmltests/data/tst_favicon.qml b/tests/auto/quick/qmltests/data/tst_favicon.qml
index e959f19be..633859add 100644
--- a/tests/auto/quick/qmltests/data/tst_favicon.qml
+++ b/tests/auto/quick/qmltests/data/tst_favicon.qml
@@ -261,16 +261,26 @@ TestWebEngineView {
function test_faviconProvider_data() {
return [
- { tag: "8x8", size: 8, value: 16 },
- { tag: "16x16", size: 16, value: 16 },
- { tag: "17x17", size: 17, value: 32 },
- { tag: "31x31", size: 31, value: 32 },
- { tag: "32x32", size: 32, value: 32 },
- { tag: "33x33", size: 33, value: 64 },
- { tag: "64x64", size: 64, value: 64 },
- { tag: "128x128", size: 128, value: 128 },
- { tag: "255x255", size: 255, value: 255 },
- { tag: "256x256", size: 256, value: 255 },
+ { tag: "multi 8x8", url: Qt.resolvedUrl("favicon-multi-gray.html"), size: 8, value: 16 },
+ { tag: "multi 16x16", url: Qt.resolvedUrl("favicon-multi-gray.html"), size: 16, value: 16 },
+ { tag: "multi 17x17", url: Qt.resolvedUrl("favicon-multi-gray.html"), size: 17, value: 32 },
+ { tag: "multi 31x31", url: Qt.resolvedUrl("favicon-multi-gray.html"), size: 31, value: 32 },
+ { tag: "multi 32x32", url: Qt.resolvedUrl("favicon-multi-gray.html"), size: 32, value: 32 },
+ { tag: "multi 33x33", url: Qt.resolvedUrl("favicon-multi-gray.html"), size: 33, value: 64 },
+ { tag: "multi 64x64", url: Qt.resolvedUrl("favicon-multi-gray.html"), size: 64, value: 64 },
+ { tag: "multi 128x128", url: Qt.resolvedUrl("favicon-multi-gray.html"), size: 128, value: 128 },
+ { tag: "multi 255x255", url: Qt.resolvedUrl("favicon-multi-gray.html"), size: 255, value: 255 },
+ { tag: "multi 256x256", url: Qt.resolvedUrl("favicon-multi-gray.html"), size: 256, value: 255 },
+ { tag: "candidate 8x8", url: Qt.resolvedUrl("favicon-candidates-gray.html"), size: 8, value: 16 },
+ { tag: "candidate 16x16", url: Qt.resolvedUrl("favicon-candidates-gray.html"), size: 16, value: 16 },
+ { tag: "candidate 17x17", url: Qt.resolvedUrl("favicon-candidates-gray.html"), size: 17, value: 32 },
+ { tag: "candidate 31x31", url: Qt.resolvedUrl("favicon-candidates-gray.html"), size: 31, value: 32 },
+ { tag: "candidate 32x32", url: Qt.resolvedUrl("favicon-candidates-gray.html"), size: 32, value: 32 },
+ { tag: "candidate 33x33", url: Qt.resolvedUrl("favicon-candidates-gray.html"), size: 33, value: 64 },
+ { tag: "candidate 64x64", url: Qt.resolvedUrl("favicon-candidates-gray.html"), size: 64, value: 64 },
+ { tag: "candidate 128x128", url: Qt.resolvedUrl("favicon-candidates-gray.html"), size: 128, value: 128 },
+ { tag: "candidate 255x255", url: Qt.resolvedUrl("favicon-candidates-gray.html"), size: 255, value: 255 },
+ { tag: "candidate 256x256", url: Qt.resolvedUrl("favicon-candidates-gray.html"), size: 256, value: 255 },
];
}
@@ -287,8 +297,7 @@ TestWebEngineView {
compare(iconChangedSpy.count, 0)
- var url = Qt.resolvedUrl("favicon-multi-gray.html")
- webEngineView.url = url
+ webEngineView.url = row.url
verify(webEngineView.waitForLoadSucceeded())
iconChangedSpy.wait()
diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro
index b8f0f7df1..64f7414ce 100644
--- a/tests/auto/quick/qmltests/qmltests.pro
+++ b/tests/auto/quick/qmltests/qmltests.pro
@@ -16,6 +16,7 @@ OTHER_FILES += \
$$PWD/data/directoryupload.html \
$$PWD/data/favicon.html \
$$PWD/data/favicon2.html \
+ $$PWD/data/favicon-candidates-gray.html \
$$PWD/data/favicon-misc.html \
$$PWD/data/favicon-multi.html \
$$PWD/data/favicon-multi-gray.html \
@@ -65,6 +66,11 @@ OTHER_FILES += \
$$PWD/data/tst_settings.qml \
$$PWD/data/tst_keyboardModifierMapping.qml \
$$PWD/data/icons/favicon.png \
+ $$PWD/data/icons/gray128.png \
+ $$PWD/data/icons/gray16.png \
+ $$PWD/data/icons/gray255.png \
+ $$PWD/data/icons/gray32.png \
+ $$PWD/data/icons/gray64.png \
$$PWD/data/icons/grayicons.ico \
$$PWD/data/icons/small-favicon.png \
$$PWD/data/icons/qt144.png \
diff --git a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp
index b9ce0c33b..38311cad2 100644
--- a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp
+++ b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp
@@ -55,6 +55,7 @@ private Q_SLOTS:
void bestFavicon();
void touchIcon();
void multiIcon();
+ void candidateIcon();
void downloadIconsDisabled_data();
void downloadIconsDisabled();
void downloadTouchIconsEnabled_data();
@@ -323,9 +324,8 @@ void tst_QWebEngineFaviconManager::bestFavicon()
icon = m_page->icon();
QVERIFY(!icon.isNull());
- QCOMPARE(icon.availableSizes().count(), 1);
- iconSize = icon.availableSizes().first();
- QCOMPARE(iconSize, QSize(144, 144));
+ QVERIFY(icon.availableSizes().count() >= 1);
+ QVERIFY(icon.availableSizes().contains(QSize(144, 144)));
}
void tst_QWebEngineFaviconManager::touchIcon()
@@ -376,6 +376,33 @@ void tst_QWebEngineFaviconManager::multiIcon()
QVERIFY(icon.availableSizes().contains(QSize(64, 64)));
}
+void tst_QWebEngineFaviconManager::candidateIcon()
+{
+ if (!QDir(TESTS_SOURCE_DIR).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+
+ QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool)));
+ QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl)));
+ QSignalSpy iconChangedSpy(m_page, SIGNAL(iconChanged(QIcon)));
+
+ QUrl url = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebenginefaviconmanager/resources/favicon-shortcut.html"));
+ m_page->load(url);
+
+ QTRY_COMPARE(loadFinishedSpy.count(), 1);
+ QTRY_COMPARE(iconUrlChangedSpy.count(), 1);
+ QTRY_COMPARE(iconChangedSpy.count(), 1);
+
+ QUrl iconUrl = iconUrlChangedSpy.at(0).at(0).toString();
+ QCOMPARE(m_page->iconUrl(), iconUrl);
+ QCOMPARE(iconUrl, QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebenginefaviconmanager/resources/icons/qt144.png")));
+
+ const QIcon &icon = m_page->icon();
+ QVERIFY(!icon.isNull());
+ QCOMPARE(icon.availableSizes().count(), 2);
+ QVERIFY(icon.availableSizes().contains(QSize(32, 32)));
+ QVERIFY(icon.availableSizes().contains(QSize(144, 144)));
+}
+
void tst_QWebEngineFaviconManager::downloadIconsDisabled_data()
{
QTest::addColumn<QUrl>("url");
@@ -442,9 +469,8 @@ void tst_QWebEngineFaviconManager::downloadTouchIconsEnabled()
const QIcon &icon = m_page->icon();
QVERIFY(!icon.isNull());
- QCOMPARE(icon.availableSizes().count(), 1);
- QSize iconSize = icon.availableSizes().first();
- QCOMPARE(iconSize, expectedIconSize);
+ QVERIFY(icon.availableSizes().count() >= 1);
+ QVERIFY(icon.availableSizes().contains(expectedIconSize));
}
QTEST_MAIN(tst_QWebEngineFaviconManager)
diff --git a/tests/auto/widgets/qwebenginespellcheck/dict/en-US.aff b/tests/auto/widgets/qwebenginespellcheck/dict/en-US.aff
new file mode 100644
index 000000000..ff8185771
--- /dev/null
+++ b/tests/auto/widgets/qwebenginespellcheck/dict/en-US.aff
@@ -0,0 +1,5 @@
+SET UTF-8
+TRY esianrtolcdugmphbyfvkwzqESIANRTOLCDUGMPHBYFVKWZQ
+
+PFX Q Y 1
+PFX Q 0 q .
diff --git a/tests/auto/widgets/qwebenginespellcheck/dict/en-US.dic b/tests/auto/widgets/qwebenginespellcheck/dict/en-US.dic
new file mode 100644
index 000000000..3d4ecdfa4
--- /dev/null
+++ b/tests/auto/widgets/qwebenginespellcheck/dict/en-US.dic
@@ -0,0 +1,11 @@
+10
+he/Q
+I/Q
+it/Q
+love/Q
+loves/Q
+qt/Q
+she/Q
+they/Q
+we/Q
+you/Q
diff --git a/tests/auto/widgets/qwebenginespellcheck/qwebenginespellcheck.pro b/tests/auto/widgets/qwebenginespellcheck/qwebenginespellcheck.pro
new file mode 100644
index 000000000..437aad937
--- /dev/null
+++ b/tests/auto/widgets/qwebenginespellcheck/qwebenginespellcheck.pro
@@ -0,0 +1,22 @@
+include(../tests.pri)
+
+DISTFILES += \
+ dict/en-US.dic \
+ dict/en-US.aff
+
+qtPrepareTool(CONVERT_TOOL, qwebengine_convert_dict)
+
+debug_and_release {
+ CONFIG(debug, debug|release): DICTIONARIES_DIR = debug/qtwebengine_dictionaries
+ else: DICTIONARIES_DIR = release/qtwebengine_dictionaries
+} else {
+ DICTIONARIES_DIR = qtwebengine_dictionaries
+}
+
+dict.files = $$PWD/dict/en-US.dic
+dictoolbuild.input = dict.files
+dictoolbuild.output = $${DICTIONARIES_DIR}/${QMAKE_FILE_BASE}.bdic
+dictoolbuild.commands = $${CONVERT_TOOL} ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
+dictoolbuild.name = Build ${QMAKE_FILE_IN_BASE}
+dictoolbuild.CONFIG = no_link target_predeps
+QMAKE_EXTRA_COMPILERS += dictoolbuild
diff --git a/tests/auto/widgets/qwebenginespellcheck/resources/index.html b/tests/auto/widgets/qwebenginespellcheck/resources/index.html
new file mode 100644
index 000000000..520979244
--- /dev/null
+++ b/tests/auto/widgets/qwebenginespellcheck/resources/index.html
@@ -0,0 +1,36 @@
+<html>
+ <head>
+ <script type="text/javascript">
+ function makeEditable()
+ {
+ document.getElementsByClassName('textarea')[0].contentEditable = true;
+ }
+
+ function text()
+ {
+ return document.getElementsByClassName('textarea')[0].innerHTML;
+ }
+
+ function findWordPosition(text,word)
+ {
+ var divElement = document.getElementsByClassName('textarea')[0];
+ divElement.innerHTML = text;
+ var regex = new RegExp(word,'g');
+ divElement.innerHTML = divElement.innerHTML.replace(regex, '<span id="word">' + word + '</span>');
+ var spanElement = document.getElementById('word');
+ var rect = spanElement.getBoundingClientRect();
+ var array = new Array();
+ array.push(rect.left);
+ array.push(rect.top);
+ array.push(rect.right - rect.left);
+ array.push(rect.bottom - rect.top);
+ divElement.innerHTML = "";
+ return array;
+ }
+ </script>
+ </head>
+ <body>
+ <div class="textarea" style="width:300px; height:200px; border: 1px solid #ccc"></div>
+ </body>
+</html>
+
diff --git a/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp b/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp
new file mode 100644
index 000000000..2dfe3305d
--- /dev/null
+++ b/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp
@@ -0,0 +1,178 @@
+/****************************************************************************
+**
+** 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 "util.h"
+#include <QtTest/QtTest>
+#include <QtWebEngineWidgets/qwebenginecontextmenudata.h>
+#include <QtWebEngineWidgets/qwebengineprofile.h>
+#include <QtWebEngineWidgets/qwebenginepage.h>
+#include <QtWebEngineWidgets/qwebengineview.h>
+
+class WebView : public QWebEngineView
+{
+ Q_OBJECT
+public:
+ void activateMenu(const QPoint &position)
+ {
+ QTest::mouseMove(focusWidget(), position);
+ QTest::mousePress(focusWidget(), Qt::RightButton, 0, position);
+ QContextMenuEvent evcont(QContextMenuEvent::Mouse, position, mapToGlobal(position));
+ event(&evcont);
+ }
+
+ const QWebEngineContextMenuData& data()
+ {
+ return m_data;
+ }
+
+signals:
+ void menuReady();
+
+protected:
+ void contextMenuEvent(QContextMenuEvent *)
+ {
+ m_data = page()->contextMenuData();
+ emit menuReady();
+ }
+private:
+ QWebEngineContextMenuData m_data;
+};
+
+class tst_QWebEngineSpellcheck : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void init();
+ void cleanup();
+ void initTestCase();
+ void spellCheckLanguage();
+ void spellCheckEnabled();
+ void spellcheck();
+
+private:
+ void load();
+ WebView *m_view;
+};
+
+void tst_QWebEngineSpellcheck::initTestCase()
+{
+ QWebEngineProfile *profile = QWebEngineProfile::defaultProfile();
+ QVERIFY(profile);
+ QVERIFY(!profile->isSpellCheckEnabled());
+ QVERIFY(profile->spellCheckLanguage().isEmpty());
+}
+
+void tst_QWebEngineSpellcheck::init()
+{
+ QWebEngineProfile *profile = QWebEngineProfile::defaultProfile();
+ profile->setSpellCheckEnabled(false);
+ profile->setSpellCheckLanguage(QString::null);
+ m_view = new WebView();
+}
+
+void tst_QWebEngineSpellcheck::load()
+{
+ m_view->page()->load(QUrl("qrc:///resources/index.html"));
+ m_view->show();
+ waitForSignal(m_view->page(), SIGNAL(loadFinished(bool)));
+}
+
+void tst_QWebEngineSpellcheck::cleanup()
+{
+ delete m_view;
+}
+
+void tst_QWebEngineSpellcheck::spellCheckLanguage()
+{
+ QWebEngineProfile *profile = QWebEngineProfile::defaultProfile();
+ QVERIFY(profile);
+ profile->setSpellCheckLanguage("en-US");
+ QVERIFY(profile->spellCheckLanguage() == "en-US");
+}
+
+void tst_QWebEngineSpellcheck::spellCheckEnabled()
+{
+ QWebEngineProfile *profile = QWebEngineProfile::defaultProfile();
+ QVERIFY(profile);
+ profile->setSpellCheckEnabled(true);
+ QVERIFY(profile->isSpellCheckEnabled());
+}
+
+void tst_QWebEngineSpellcheck::spellcheck()
+{
+ QWebEngineProfile *profile = QWebEngineProfile::defaultProfile();
+ QVERIFY(profile);
+ profile->setSpellCheckLanguage("en-US");
+ profile->setSpellCheckEnabled(true);
+ load();
+
+ // make textarea editable
+ evaluateJavaScriptSync(m_view->page(), "makeEditable();");
+
+ // calcuate position of misspelled word
+ QVariantList list = evaluateJavaScriptSync(m_view->page(), "findWordPosition('I lovee Qt ....','lovee');").toList();
+ QRect rect(list[0].value<int>(),list[1].value<int>(),list[2].value<int>(),list[3].value<int>());
+
+ //type text, spellchecker needs time
+ QTest::mouseMove(m_view->focusWidget(), QPoint(20,20));
+ QTest::mousePress(m_view->focusWidget(), Qt::LeftButton, 0, QPoint(20,20));
+ QString text("I lovee Qt ....");
+ for (int i = 0; i < text.length(); i++) {
+ QTest::keyClicks(m_view->focusWidget(), text.at(i));
+ QTest::qWait(60);
+ }
+
+ // make sure text is there
+ QString result = evaluateJavaScriptSync(m_view->page(), "text();").toString();
+ QVERIFY(result == text);
+
+ // open menu on misspelled word
+ m_view->activateMenu(rect.center());
+ waitForSignal(m_view, SIGNAL(menuReady()));
+
+ // check if menu is valid
+ QVERIFY(m_view->data().isValid());
+ QVERIFY(m_view->data().isContentEditable());
+
+ // check misspelled word
+ QVERIFY(m_view->data().misspelledWord() == "lovee");
+
+ // check suggestions
+ QStringList expected {"love", "loves"};
+ QVERIFY(m_view->data().spellCheckerSuggestions() == expected);
+
+ // check replace word
+ m_view->page()->replaceMisspelledWord("love");
+ text = "I love Qt ....";
+ result = evaluateJavaScriptSync(m_view->page(), "text();").toString();
+ QVERIFY(result == text);
+}
+
+QTEST_MAIN(tst_QWebEngineSpellcheck)
+#include "tst_qwebenginespellcheck.moc"
diff --git a/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.qrc b/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.qrc
new file mode 100644
index 000000000..505b932c7
--- /dev/null
+++ b/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>resources/index.html</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/widgets/widgets.pro b/tests/auto/widgets/widgets.pro
index 6c516b38f..7543a4382 100644
--- a/tests/auto/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets.pro
@@ -13,6 +13,11 @@ SUBDIRS += \
qwebenginesettings \
qwebengineview
+# QTBUG-53135, osx does not use hunspell
+!contains(WEBENGINE_CONFIG, no_spellcheck):!osx:!cross_compile {
+ SUBDIRS += qwebenginespellcheck
+}
+
qtHaveModule(positioning) {
SUBDIRS += positionplugin
qwebenginepage.depends = positionplugin