diff options
Diffstat (limited to 'tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp')
-rw-r--r-- | tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp | 52 |
1 files changed, 18 insertions, 34 deletions
diff --git a/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp b/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp index 518ddaa0d..3644ac481 100644 --- a/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp +++ b/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp @@ -1,40 +1,14 @@ -/**************************************************************************** -** -** 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" +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +#include <quickutil.h> #include <QtTest/QtTest> #include <QQmlContext> #include <QQuickView> #include <QQuickItem> #include <QPainter> -#include <qtwebengineglobal.h> -#include <private/qquickwebengineview_p.h> +#include <QtWebEngineQuick/qtwebenginequickglobal.h> +#include <QtWebEngineQuick/private/qquickwebengineview_p.h> #include <map> @@ -98,6 +72,8 @@ static void verifyGreenSquare(QQuickWindow *window) bool ok = QTest::qWaitFor([&](){ actual = window->grabWindow(); expected = getGreenSquare(actual.format()); + if (actual.height() > 150) + actual = actual.scaledToHeight(150); return actual == expected; }, 10000); if (!ok) { @@ -110,7 +86,9 @@ static void verifyGreenSquare(QQuickWindow *window) void tst_QQuickWebEngineViewGraphics::simpleGraphics() { setHtml(greenSquare); + m_view->show(); verifyGreenSquare(m_view.data()); + m_view->hide(); } void tst_QQuickWebEngineViewGraphics::showHideShow() @@ -126,12 +104,15 @@ void tst_QQuickWebEngineViewGraphics::showHideShow() m_view->show(); QVERIFY(exposeSpy.wait()); verifyGreenSquare(m_view.data()); + m_view->hide(); } void tst_QQuickWebEngineViewGraphics::simpleAcceleratedLayer() { + m_view->show(); setHtml(acLayerGreenSquare); verifyGreenSquare(m_view.data()); + m_view->hide(); } void tst_QQuickWebEngineViewGraphics::reparentToOtherWindow() @@ -142,21 +123,24 @@ void tst_QQuickWebEngineViewGraphics::reparentToOtherWindow() window.create(); m_view->rootObject()->setParentItem(window.contentItem()); + window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); verifyGreenSquare(&window); } void tst_QQuickWebEngineViewGraphics::setHtml(const QString &html) { QString htmlData = QUrl::toPercentEncoding(html); - QString qmlData = QUrl::toPercentEncoding(QStringLiteral("import QtQuick 2.0; import QtWebEngine 1.2; WebEngineView { width: 150; height: 150 }")); + QString qmlData = QUrl::toPercentEncoding(QStringLiteral("import QtQuick; import QtWebEngine; WebEngineView { width: 150; height: 150 }")); m_view->setSource(QUrl(QStringLiteral("data:text/plain,%1").arg(qmlData))); m_view->create(); QQuickWebEngineView *webEngineView = static_cast<QQuickWebEngineView *>(m_view->rootObject()); - webEngineView->setProperty("url", QUrl(QStringLiteral("data:text/html,%1").arg(htmlData))); - QTRY_COMPARE_WITH_TIMEOUT(m_view->rootObject()->property("loading"), QVariant(false), 30000); + webEngineView->setUrl(QUrl(QStringLiteral("data:text/html,%1").arg(htmlData))); + QVERIFY(waitForLoadSucceeded(webEngineView)); } static QByteArrayList params; W_QTEST_MAIN(tst_QQuickWebEngineViewGraphics, params) #include "tst_qquickwebengineviewgraphics.moc" +#include "moc_quickutil.cpp" |