diff options
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/highdpi/imageprovider.cpp | 2 | ||||
-rw-r--r-- | tests/manual/nodetypes/Effects.qml | 39 | ||||
-rw-r--r-- | tests/manual/qmlplugindump/tst_qmlplugindump.cpp | 11 | ||||
-rw-r--r-- | tests/manual/scenegraph_lancelot/scenegrabber/main.cpp | 6 | ||||
-rw-r--r-- | tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp | 6 | ||||
m--------- | tests/manual/v4/test262 | 0 |
6 files changed, 51 insertions, 13 deletions
diff --git a/tests/manual/highdpi/imageprovider.cpp b/tests/manual/highdpi/imageprovider.cpp index 33a69cb87e..069fa5998f 100644 --- a/tests/manual/highdpi/imageprovider.cpp +++ b/tests/manual/highdpi/imageprovider.cpp @@ -45,7 +45,7 @@ #include <qquickimageprovider.h> #include <QImage> #include <QPainter> -#include <qDebug.h> +#include <QDebug> class ColorImageProvider : public QQuickImageProvider { diff --git a/tests/manual/nodetypes/Effects.qml b/tests/manual/nodetypes/Effects.qml index 0d16cd1c84..85e7ab7a15 100644 --- a/tests/manual/nodetypes/Effects.qml +++ b/tests/manual/nodetypes/Effects.qml @@ -69,6 +69,7 @@ Item { NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 } property bool customVertexShader: false // the effect is fine with the default vs, but toggle this to test + property bool useHLSLSourceString: false // toggle to provide HLSL shaders as strings instead of bytecode in files property string glslVertexShader: "uniform highp mat4 qt_Matrix;" + @@ -92,12 +93,43 @@ Item { " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;" + "}" + property string hlslVertexShader: "cbuffer ConstantBuffer : register(b0) {" + + " float4x4 qt_Matrix;" + + " float qt_Opacity; }" + + "struct PSInput {" + + " float4 position : SV_POSITION;" + + " float2 coord : TEXCOORD0; };" + + "PSInput main(float4 position : POSITION, float2 coord : TEXCOORD0) {" + + " PSInput result;" + + " result.position = mul(qt_Matrix, position);" + + " result.coord = coord;" + + " return result;" + + "}"; + + property string hlslPixelShader:"cbuffer ConstantBuffer : register(b0) {" + + " float4x4 qt_Matrix;" + + " float qt_Opacity;" + + " float amplitude;" + + " float frequency;" + + " float time; }" + + "Texture2D source : register(t0);" + + "SamplerState sourceSampler : register(s0);" + + "float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET" + + "{" + + " float2 p = sin(time + frequency * coord);" + + " return source.Sample(sourceSampler, coord + amplitude * float2(p.y, -p.x)) * qt_Opacity;" + + "}"; + property string hlslVertexShaderByteCode: "qrc:/vs_wobble.cso" property string hlslPixelShaderByteCode: "qrc:/ps_wobble.cso" - vertexShader: customVertexShader ? (GraphicsInfo.shaderType === GraphicsInfo.HLSL ? hlslVertexShaderByteCode : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? glslVertexShader : "")) : "" + vertexShader: customVertexShader ? (GraphicsInfo.shaderType === GraphicsInfo.HLSL + ? (useHLSLSourceString ? hlslVertexShader : hlslVertexShaderByteCode) + : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? glslVertexShader : "")) : "" - fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL ? hlslPixelShaderByteCode : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? glslFragmentShader : "") + fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL + ? (useHLSLSourceString ? hlslPixelShader : hlslPixelShaderByteCode) + : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? glslFragmentShader : "") } Image { @@ -181,6 +213,9 @@ Item { Text { text: GraphicsInfo.shaderType + " " + GraphicsInfo.shaderCompilationType + " " + GraphicsInfo.shaderSourceType } + Text { + text: eff.status + " " + eff.log + } } } } diff --git a/tests/manual/qmlplugindump/tst_qmlplugindump.cpp b/tests/manual/qmlplugindump/tst_qmlplugindump.cpp index ed00682a83..1bedd4427b 100644 --- a/tests/manual/qmlplugindump/tst_qmlplugindump.cpp +++ b/tests/manual/qmlplugindump/tst_qmlplugindump.cpp @@ -92,7 +92,7 @@ public: { QRegularExpression re; QRegularExpressionMatch m; - Q_FOREACH (const QString &e, m_expected) { + for (const QString &e : m_expected) { re.setPattern(e); m = re.match(QString::fromLatin1(buffer)); if (!m.hasMatch()) { @@ -187,7 +187,8 @@ Test createTest(const QString &id, const QJsonObject &def) return Test(id); } QStringList patterns; - Q_FOREACH (const QJsonValue &x, expected.toArray()) { + const auto expectedArray = expected.toArray(); + for (const QJsonValue &x : expectedArray) { if (!x.isString()) { qWarning() << "Wrong definition for test: " << id << "."; return Test(id); @@ -331,7 +332,7 @@ void tst_qmlplugindump::plugin_data() QTest::addColumn<QString>("version"); QTest::addColumn<QStringList>("expected"); - Q_FOREACH (const Test &t, tests) { + for (const Test &t : qAsConst(tests)) { if (t.isNull()) QSKIP("Errors in test definition."); QTest::newRow(t.id.toLatin1().data()) << t.project << t.version << t.expected; @@ -357,9 +358,9 @@ void tst_qmlplugindump::plugin() void tst_qmlplugindump::cleanupTestCase() { QSet<const QString> projects; - Q_FOREACH (const Test &t, tests) + for (const Test &t : qAsConst(tests)) projects.insert(t.project); - Q_FOREACH (const QString &p, projects) { + for (const QString &p : qAsConst(projects)) { if (!cleanUpSample(p)) qWarning() << "Error in cleaning up project" << p << "."; } diff --git a/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp index a4b1a1be70..886cfc6599 100644 --- a/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp +++ b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp @@ -134,7 +134,7 @@ private: }; -extern uint qt_qhash_seed; +Q_CORE_EXPORT extern QBasicAtomicInt qt_qhash_seed; int main(int argc, char *argv[]) { @@ -183,8 +183,8 @@ int main(int argc, char *argv[]) v.setSource(QUrl::fromLocalFile(ifile)); if (noText) { - QList<QQuickItem*> items = v.rootObject()->findChildren<QQuickItem*>(); - foreach (QQuickItem *item, items) { + const QList<QQuickItem*> items = v.rootObject()->findChildren<QQuickItem*>(); + for (QQuickItem *item : items) { if (QByteArray(item->metaObject()->className()).contains("Text")) item->setVisible(false); } diff --git a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp index 426e06ccc2..3f28d90e7b 100644 --- a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp +++ b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp @@ -156,7 +156,7 @@ void tst_Scenegraph::setupTestSuite(const QByteArray& filter) } std::sort(itemFiles.begin(), itemFiles.end()); - foreach (const QString &filePath, itemFiles) { + for (const QString &filePath : qAsConst(itemFiles)) { QByteArray itemName = filePath.mid(testSuitePath.length() + 1).toLatin1(); QBaselineTest::newRow(itemName, checksumFileOrDir(filePath)) << filePath; numItems++; @@ -238,7 +238,9 @@ quint16 tst_Scenegraph::checksumFileOrDir(const QString &path) if (fi.isDir()) { static const QStringList nameFilters = QStringList() << "*.qml" << "*.cpp" << "*.png" << "*.jpg"; quint16 cs = 0; - foreach (QString item, QDir(fi.filePath()).entryList(nameFilters, QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)) + const auto entryList = QDir(fi.filePath()).entryList(nameFilters, + QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); + for (const QString &item : entryList) cs ^= checksumFileOrDir(path + QLatin1Char('/') + item); return cs; } diff --git a/tests/manual/v4/test262 b/tests/manual/v4/test262 -Subproject 0b5af3dcec772bb06b4d685a20b2859cda59d18 +Subproject 9741ac4655808ac46c127e3d1d8ba3d27ada618 |