aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp')
-rw-r--r--tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp55
1 files changed, 23 insertions, 32 deletions
diff --git a/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp b/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp
index 5a77215624..ffd6478f9c 100644
--- a/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp
+++ b/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp
@@ -1,33 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <qtest.h>
+#include <QGuiApplication>
#include <QtQuick/qquickitem.h>
#include <QtQuick/qquickview.h>
#include <qopenglcontext.h>
@@ -36,7 +12,7 @@
#include <QtQuick/QQuickFramebufferObject>
-#include "../../shared/util.h"
+#include <QtQuickTestUtils/private/qmlutils_p.h>
#ifndef GL_MAX_SAMPLES
#define GL_MAX_SAMPLES 0x8D57
@@ -53,9 +29,9 @@ struct FrameInfo {
class ColorRenderer : public QQuickFramebufferObject::Renderer, protected QOpenGLFunctions
{
public:
- void render();
- void synchronize(QQuickFramebufferObject *item);
- QOpenGLFramebufferObject *createFramebufferObject(const QSize &size);
+ void render() override;
+ void synchronize(QQuickFramebufferObject *item) override;
+ QOpenGLFramebufferObject *createFramebufferObject(const QSize &size) override;
QSize textureSize;
QColor color;
@@ -72,7 +48,7 @@ class FBOItem : public QQuickFramebufferObject
Q_PROPERTY(QSize textureSize READ textureSize WRITE setTextureSize NOTIFY textureSizeChanged)
public:
- Renderer *createRenderer() const { return new ColorRenderer(); }
+ Renderer *createRenderer() const override { return new ColorRenderer(); }
void setColor(const QColor &color) { m_color = color; colorChanged(m_color); }
QColor color() const { return m_color; }
@@ -143,6 +119,8 @@ class tst_QQuickFramebufferObject: public QQmlDataTest
{
Q_OBJECT
public:
+ tst_QQuickFramebufferObject();
+
private slots:
void initTestCase() override;
void testThatStuffWorks_data();
@@ -151,6 +129,11 @@ private slots:
void testInvalidate();
};
+tst_QQuickFramebufferObject::tst_QQuickFramebufferObject()
+ : QQmlDataTest(QT_QMLTEST_DATADIR)
+{
+}
+
void tst_QQuickFramebufferObject::initTestCase()
{
QQmlDataTest::initTestCase();
@@ -202,6 +185,10 @@ void tst_QQuickFramebufferObject::testThatStuffWorks()
view.requestActivate();
QVERIFY(QTest::qWaitForWindowExposed(&view));
+ if (QGuiApplication::platformName() == "offscreen" &&
+ view.rendererInterface()->graphicsApi() == QSGRendererInterface::Software)
+ QSKIP("offscreen software rendering doesn't work with FBOs");
+
QImage result = view.grabWindow();
QCOMPARE(frameInfo.renderCount, 1);
@@ -242,6 +229,10 @@ void tst_QQuickFramebufferObject::testInvalidate()
view.requestActivate();
QVERIFY(QTest::qWaitForWindowExposed(&view));
+ if (QGuiApplication::platformName() == "offscreen" &&
+ view.rendererInterface()->graphicsApi() == QSGRendererInterface::Software)
+ QSKIP("offscreen software rendering doesn't work with FBOs");
+
QCOMPARE(frameInfo.fboSize, QSize(200, 200));
frameInfo.createFBOCount = 0;