aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-05-26 16:04:03 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-06-01 10:32:18 +0000
commit1c6d4353f742a740e54b234db4d7b8913d515376 (patch)
tree2b0a7602cd96345240f3b021e4453ca560e932c1 /tests
parenta6d3e3afcdd8f08893cff4deed7e866a5daf3cbd (diff)
One GraphicsInfo to rule them all
Rename RendererInfo to GraphicsInfo. Deprecate OpenGLInfo and move the surface format properties into GraphicsInfo. Move also the shader info properties from ShaderEffect. Change-Id: I3b3f01080e059b3a30a132fd67de19a4bfca54ef Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquickgraphicsinfo/data/basic.qml14
-rw-r--r--tests/auto/quick/qquickgraphicsinfo/qquickgraphicsinfo.pro (renamed from tests/auto/quick/qquickrendererinfo/qquickrendererinfo.pro)4
-rw-r--r--tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp (renamed from tests/auto/quick/qquickrendererinfo/tst_qquickrendererinfo.cpp)25
-rw-r--r--tests/auto/quick/qquickrendererinfo/data/basic.qml5
-rw-r--r--tests/auto/quick/quick.pro2
-rw-r--r--tests/manual/nodetypes/Effects.qml17
6 files changed, 46 insertions, 21 deletions
diff --git a/tests/auto/quick/qquickgraphicsinfo/data/basic.qml b/tests/auto/quick/qquickgraphicsinfo/data/basic.qml
new file mode 100644
index 0000000000..6ff3b82cec
--- /dev/null
+++ b/tests/auto/quick/qquickgraphicsinfo/data/basic.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.8
+
+Item {
+ property int api: GraphicsInfo.api
+
+ property int shaderType: GraphicsInfo.shaderType
+ property int shaderCompilationType: GraphicsInfo.shaderCompilationType
+ property int shaderSourceType: GraphicsInfo.shaderSourceType
+
+ property int majorVersion: GraphicsInfo.majorVersion
+ property int minorVersion: GraphicsInfo.minorVersion
+ property int profile: GraphicsInfo.profile
+ property int renderableType: GraphicsInfo.renderableType
+}
diff --git a/tests/auto/quick/qquickrendererinfo/qquickrendererinfo.pro b/tests/auto/quick/qquickgraphicsinfo/qquickgraphicsinfo.pro
index 4f55b79961..a4296ad9a2 100644
--- a/tests/auto/quick/qquickrendererinfo/qquickrendererinfo.pro
+++ b/tests/auto/quick/qquickgraphicsinfo/qquickgraphicsinfo.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
-TARGET = tst_qquickrendererinfo
-SOURCES += tst_qquickrendererinfo.cpp
+TARGET = tst_qquickgraphicsinfo
+SOURCES += tst_qquickgraphicsinfo.cpp
TESTDATA = data/*
include(../../shared/util.pri)
diff --git a/tests/auto/quick/qquickrendererinfo/tst_qquickrendererinfo.cpp b/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp
index 5e2da76333..256fa43d2e 100644
--- a/tests/auto/quick/qquickrendererinfo/tst_qquickrendererinfo.cpp
+++ b/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp
@@ -35,7 +35,12 @@
#include "../../shared/util.h"
-class tst_QQuickRendererInfo : public QQmlDataTest
+#ifndef QT_NO_OPENGL
+#include <QtGui/qopenglcontext.h>
+#include <QtGui/qsurfaceformat.h>
+#endif
+
+class tst_QQuickGraphicsInfo : public QQmlDataTest
{
Q_OBJECT
@@ -43,7 +48,7 @@ private slots:
void testProperties();
};
-void tst_QQuickRendererInfo::testProperties()
+void tst_QQuickGraphicsInfo::testProperties()
{
QQuickView view;
view.setSource(QUrl::fromLocalFile("data/basic.qml"));
@@ -61,8 +66,20 @@ void tst_QQuickRendererInfo::testProperties()
const int expectedAPI = rif ? rif->graphicsApi() : QSGRendererInterface::Unknown;
QCOMPARE(obj->property("api").toInt(), expectedAPI);
+
+#ifndef QT_NO_OPENGL
+ if (expectedAPI == QSGRendererInterface::OpenGL) {
+ QCOMPARE(obj->property("shaderType").toInt(), int(QSGRendererInterface::GLSL));
+ QVERIFY(view.openglContext());
+ QSurfaceFormat format = view.openglContext()->format();
+ 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()));
+ }
+#endif
}
-QTEST_MAIN(tst_QQuickRendererInfo)
+QTEST_MAIN(tst_QQuickGraphicsInfo)
-#include "tst_qquickrendererinfo.moc"
+#include "tst_qquickgraphicsinfo.moc"
diff --git a/tests/auto/quick/qquickrendererinfo/data/basic.qml b/tests/auto/quick/qquickrendererinfo/data/basic.qml
deleted file mode 100644
index b7dbbb9ac9..0000000000
--- a/tests/auto/quick/qquickrendererinfo/data/basic.qml
+++ /dev/null
@@ -1,5 +0,0 @@
-import QtQuick 2.8
-
-Item {
- property int api: RendererInfo.api
-}
diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro
index fecd1aea58..70e5b8ef6a 100644
--- a/tests/auto/quick/quick.pro
+++ b/tests/auto/quick/quick.pro
@@ -57,6 +57,7 @@ QUICKTESTS = \
qquickflickable \
qquickflipable \
qquickfocusscope \
+ qquickgraphicsinfo \
qquickgridview \
qquickimage \
qquickitem \
@@ -71,7 +72,6 @@ QUICKTESTS = \
qquickpincharea \
qquickpositioners \
qquickrectangle \
- qquickrendererinfo \
qquickrepeater \
qquickshortcut \
qquicktext \
diff --git a/tests/manual/nodetypes/Effects.qml b/tests/manual/nodetypes/Effects.qml
index 4503c49df1..0d16cd1c84 100644
--- a/tests/manual/nodetypes/Effects.qml
+++ b/tests/manual/nodetypes/Effects.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-// Use QtQuick 2.8 to get shaderType and the other new properties
+// Use QtQuick 2.8 to get GraphicsInfo and the other new properties
import QtQuick 2.8
Item {
@@ -95,9 +95,9 @@ Item {
property string hlslVertexShaderByteCode: "qrc:/vs_wobble.cso"
property string hlslPixelShaderByteCode: "qrc:/ps_wobble.cso"
- vertexShader: customVertexShader ? (shaderType === ShaderEffect.HLSL ? hlslVertexShaderByteCode : (shaderType === ShaderEffect.GLSL ? glslVertexShader : "")) : ""
+ vertexShader: customVertexShader ? (GraphicsInfo.shaderType === GraphicsInfo.HLSL ? hlslVertexShaderByteCode : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? glslVertexShader : "")) : ""
- fragmentShader: shaderType === ShaderEffect.HLSL ? hlslPixelShaderByteCode : (shaderType === ShaderEffect.GLSL ? glslFragmentShader : "")
+ fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL ? hlslPixelShaderByteCode : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? glslFragmentShader : "")
}
Image {
@@ -157,10 +157,10 @@ Item {
height: eff2.height
property variant delta: Qt.size(1.0 / width, 0.0)
property variant source: effectSource2
- fragmentShader: shaderType === ShaderEffect.HLSL ? "qrc:/ps_shadow1.cso" : (shaderType === ShaderEffect.GLSL ? eff2.glslShaderPass1 : "")
+ fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL ? "qrc:/ps_shadow1.cso" : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? eff2.glslShaderPass1 : "")
}
}
- fragmentShader: shaderType === ShaderEffect.HLSL ? "qrc:/ps_shadow1.cso" : (shaderType === ShaderEffect.GLSL ? eff2.glslShaderPass1: "")
+ fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL ? "qrc:/ps_shadow1.cso" : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? eff2.glslShaderPass1: "")
}
}
property real angle: 0
@@ -168,7 +168,7 @@ Item {
NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 }
property variant delta: Qt.size(offset.x / width, offset.y / height)
property real darkness: 0.5
- fragmentShader: shaderType === ShaderEffect.HLSL ? "qrc:/ps_shadow2.cso" : (shaderType === ShaderEffect.GLSL ? glslShaderPass2 : "")
+ fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL ? "qrc:/ps_shadow2.cso" : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? glslShaderPass2 : "")
}
Column {
@@ -176,11 +176,10 @@ Item {
Text {
color: "yellow"
font.pointSize: 24
- text: "Shader effect is " + (eff.shaderType === ShaderEffect.HLSL ? "HLSL" : (eff.shaderType === ShaderEffect.GLSL ? "GLSL" : "UNKNOWN")) + " based";
+ text: "Shader effect is " + (GraphicsInfo.shaderType === GraphicsInfo.HLSL ? "HLSL" : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? "GLSL" : "UNKNOWN")) + " based";
}
Text {
- // check the inner shader effect's properties as those only get updated later on, once a window gets associated
- text: innerEff.shaderType + " " + innerEff.shaderCompilationType + " " + innerEff.shaderSourceType
+ text: GraphicsInfo.shaderType + " " + GraphicsInfo.shaderCompilationType + " " + GraphicsInfo.shaderSourceType
}
}
}