summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp4
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp5
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp20
-rw-r--r--tests/auto/widgets/spellchecking/tst_spellchecking.cpp3
4 files changed, 28 insertions, 4 deletions
diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
index 10aeede25..c747e6b8f 100644
--- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
+++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
@@ -463,7 +463,6 @@ void tst_QQuickWebEngineView::transparentWebEngineViews()
void tst_QQuickWebEngineView::inputMethod()
{
m_window->show();
- QTRY_VERIFY(qApp->focusObject());
QQuickItem *input;
QQuickWebEngineView *view = webEngineView();
@@ -471,18 +470,21 @@ void tst_QQuickWebEngineView::inputMethod()
view->setUrl(urlFromTestPath("html/inputmethod.html"));
QVERIFY(waitForLoadSucceeded(view));
+ QTRY_VERIFY(qobject_cast<QQuickItem *>(qApp->focusObject()));
input = qobject_cast<QQuickItem *>(qApp->focusObject());
QVERIFY(!input->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
QVERIFY(!view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
runJavaScript("document.getElementById('inputField').focus();");
QTRY_COMPARE(activeElementId(view), QStringLiteral("inputField"));
+ QTRY_VERIFY(qobject_cast<QQuickItem *>(qApp->focusObject()));
input = qobject_cast<QQuickItem *>(qApp->focusObject());
QTRY_VERIFY(input->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
QVERIFY(view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
runJavaScript("document.getElementById('inputField').blur();");
QTRY_VERIFY(activeElementId(view).isEmpty());
+ QTRY_VERIFY(qobject_cast<QQuickItem *>(qApp->focusObject()));
input = qobject_cast<QQuickItem *>(qApp->focusObject());
QTRY_VERIFY(!input->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
QVERIFY(!view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 57f6b24a8..63d39dd59 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -1441,15 +1441,18 @@ void tst_QWebEnginePage::comboBoxPopupPositionAfterChildMove()
return viewWidth;
};
+ QCOMPARE(jsViewWidth(), originalViewWidth);
+
// Resize the "spacer" widget, and implicitly change the global position of the QWebEngineView.
const int offset = 50;
spacer.setMinimumWidth(spacer.size().width() + offset);
+
QTRY_COMPARE(jsViewWidth(), originalViewWidth - offset);
makeClick(window, withTouch, view.mapTo(view.window(), elementCenter(view.page(), "foo")));
QTRY_VERIFY(popup = findNewTopLevelWindow(oldTlws));
QTRY_VERIFY(!popup->position().isNull());
- QCOMPARE(popupPos + QPoint(50, 0), popup->position());
+ QCOMPARE(popupPos + QPoint(offset, 0), popup->position());
}
#ifdef Q_OS_MAC
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
index 921b0c52f..883720490 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
@@ -106,6 +106,7 @@ private Q_SLOTS:
void changePage();
void reusePage_data();
void reusePage();
+ void setLoadedPage();
void microFocusCoordinates();
void focusInputTypes();
void unhandledKeyEventPropagation();
@@ -399,7 +400,7 @@ void tst_QWebEngineView::reusePage()
view1->show();
QVERIFY(QTest::qWaitForWindowExposed(view1));
delete view1;
- QVERIFY(page != 0); // deleting view must not have deleted the page, since it's not a child of view
+ QVERIFY(page != nullptr); // deleting view must not have deleted the page, since it's not a child of view
QWebEngineView *view2 = new QWebEngineView;
view2->setPage(page.data());
@@ -412,6 +413,23 @@ void tst_QWebEngineView::reusePage()
QDir::setCurrent(QApplication::applicationDirPath());
}
+void tst_QWebEngineView::setLoadedPage()
+{
+ // MEMO load page first to make sure that just simple attach to view would draw its content
+ QWebEnginePage page;
+ QSignalSpy loadSpy(&page, &QWebEnginePage::loadFinished);
+ page.setHtml(QString("<html><body bgcolor=\"%1\"></body></html>").arg(QColor(Qt::yellow).name()));
+ QTRY_VERIFY(loadSpy.count() == 1 && loadSpy.first().first().toBool());
+
+ QWebEngineView view;
+ view.resize(480, 320);
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ view.setPage(&page);
+ QTRY_COMPARE(view.grab().toImage().pixelColor(QPoint(view.width() / 2, view.height() / 2)), Qt::yellow);
+}
+
// Class used in crashTests
class WebViewCrashTest : public QObject {
Q_OBJECT
diff --git a/tests/auto/widgets/spellchecking/tst_spellchecking.cpp b/tests/auto/widgets/spellchecking/tst_spellchecking.cpp
index 7263904ce..738010ac8 100644
--- a/tests/auto/widgets/spellchecking/tst_spellchecking.cpp
+++ b/tests/auto/widgets/spellchecking/tst_spellchecking.cpp
@@ -170,6 +170,7 @@ void tst_Spellchecking::spellcheck()
QVariantList list = evaluateJavaScriptSync(m_view->page(), "findWordPosition('I lowe Qt ....','lowe');").toList();
QRect rect(list[0].value<int>(),list[1].value<int>(),list[2].value<int>(),list[3].value<int>());
+ QTRY_VERIFY(m_view->focusWidget());
//type text, spellchecker needs time
QTest::mouseMove(m_view->focusWidget(), QPoint(20,20));
QTest::mousePress(m_view->focusWidget(), Qt::LeftButton, {}, QPoint(20,20));
@@ -182,7 +183,7 @@ void tst_Spellchecking::spellcheck()
// make sure text is there
QString result = evaluateJavaScriptSync(m_view->page(), "text();").toString();
- QVERIFY(result == text);
+ QCOMPARE(result, text);
bool gotMisspelledWord = false; // clumsy QTRY_VERIFY still execs expr after first success
QString detail;