diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/quick/qquickopenglinfo/data/basic.qml | 8 | ||||
-rw-r--r-- | tests/auto/quick/qquickopenglinfo/qquickopenglinfo.pro | 15 | ||||
-rw-r--r-- | tests/auto/quick/qquickopenglinfo/tst_qquickopenglinfo.cpp | 85 | ||||
-rw-r--r-- | tests/auto/quick/quick.pro | 1 |
4 files changed, 109 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickopenglinfo/data/basic.qml b/tests/auto/quick/qquickopenglinfo/data/basic.qml new file mode 100644 index 0000000000..b48447941b --- /dev/null +++ b/tests/auto/quick/qquickopenglinfo/data/basic.qml @@ -0,0 +1,8 @@ +import QtQuick 2.4 + +Item { + property int majorVersion: OpenGLInfo.majorVersion + property int minorVersion: OpenGLInfo.minorVersion + property int profile: OpenGLInfo.profile + property int renderableType: OpenGLInfo.renderableType +} diff --git a/tests/auto/quick/qquickopenglinfo/qquickopenglinfo.pro b/tests/auto/quick/qquickopenglinfo/qquickopenglinfo.pro new file mode 100644 index 0000000000..8489dfffd2 --- /dev/null +++ b/tests/auto/quick/qquickopenglinfo/qquickopenglinfo.pro @@ -0,0 +1,15 @@ +CONFIG += testcase +TARGET = tst_qquickopenglinfo +SOURCES += tst_qquickopenglinfo.cpp + +TESTDATA = data/* +include(../../shared/util.pri) + +osx:CONFIG -= app_bundle + +CONFIG += parallel_test +QT += quick testlib + +OTHER_FILES += \ + data/basic.qml + diff --git a/tests/auto/quick/qquickopenglinfo/tst_qquickopenglinfo.cpp b/tests/auto/quick/qquickopenglinfo/tst_qquickopenglinfo.cpp new file mode 100644 index 0000000000..de28769e36 --- /dev/null +++ b/tests/auto/quick/qquickopenglinfo/tst_qquickopenglinfo.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2014 BlackBerry Ltd. +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/qtest.h> +#include <QtTest/qsignalspy.h> + +#include <QtQuick/qquickitem.h> +#include <QtQuick/qquickview.h> + +#include <QtGui/qopenglcontext.h> +#include <QtGui/qsurfaceformat.h> + +#include "../../shared/util.h" + +class tst_QQuickOpenGLInfo : public QQmlDataTest +{ + Q_OBJECT + +private slots: + void testProperties(); +}; + +void tst_QQuickOpenGLInfo::testProperties() +{ + QQuickView view; + view.setSource(QUrl::fromLocalFile("data/basic.qml")); + + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + + QSignalSpy spy(&view, SIGNAL(sceneGraphInitialized())); + spy.wait(); + + QVERIFY(view.openglContext()); + QSurfaceFormat format = view.openglContext()->format(); + + QObject* obj = view.rootObject(); + QVERIFY(obj); + QCOMPARE(obj->property("majorVersion").toInt(), format.majorVersion()); + QCOMPARE(obj->property("minorVersion").toInt(), format.minorVersion()); + QCOMPARE(obj->property("profile").toInt(), static_cast<int>(format.profile())); + QCOMPARE(obj->property("renderableType").toInt(), static_cast<int>(format.renderableType())); +} + +QTEST_MAIN(tst_QQuickOpenGLInfo) + +#include "tst_qquickopenglinfo.moc" diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro index 5f11da65e2..0a887534bd 100644 --- a/tests/auto/quick/quick.pro +++ b/tests/auto/quick/quick.pro @@ -56,6 +56,7 @@ QUICKTESTS = \ qquickloader \ qquickmousearea \ qquickmultipointtoucharea \ + qquickopenglinfo \ qquickpainteditem \ qquickpathview \ qquickpincharea \ |