diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-06-23 10:04:16 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-06-25 10:13:12 +0200 |
commit | d1612610e650ffd7f2fbdef535c431647f57f0ac (patch) | |
tree | 6545a46b6aa7e5f89d7b2abcb959a78fa4c114ed /tests/auto/gui/util | |
parent | 8cd3ec4ee43365425be584a48ff2871bd0090ef8 (diff) | |
download | qtbase-d1612610e650ffd7f2fbdef535c431647f57f0ac.tar.gz |
Use QList instead of QVector in gui tests
Task-number: QTBUG-84469
Change-Id: Ia86f39597de418dde6cd9ae3170ef919bd27416a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/gui/util')
4 files changed, 55 insertions, 57 deletions
diff --git a/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp b/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp index 56df69dde8..58bea1b6b7 100644 --- a/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp +++ b/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp @@ -53,7 +53,8 @@ namespace return port; } - QShaderNode createNode(const QVector<QShaderNodePort> &ports, const QStringList &layers = QStringList()) + QShaderNode createNode(const QList<QShaderNodePort> &ports, + const QStringList &layers = QStringList()) { auto node = QShaderNode(); node.setUuid(QUuid::createUuid()); diff --git a/tests/auto/gui/util/qshadergraph/tst_qshadergraph.cpp b/tests/auto/gui/util/qshadergraph/tst_qshadergraph.cpp index 014a163f58..3a8d5700b4 100644 --- a/tests/auto/gui/util/qshadergraph/tst_qshadergraph.cpp +++ b/tests/auto/gui/util/qshadergraph/tst_qshadergraph.cpp @@ -41,7 +41,8 @@ namespace return port; } - QShaderNode createNode(const QVector<QShaderNodePort> &ports, const QStringList &layers = QStringList()) + QShaderNode createNode(const QList<QShaderNodePort> &ports, + const QStringList &layers = QStringList()) { auto node = QShaderNode(); node.setUuid(QUuid::createUuid()); @@ -65,8 +66,8 @@ namespace } QShaderGraph::Statement createStatement(const QShaderNode &node, - const QVector<int> &inputs = QVector<int>(), - const QVector<int> &outputs = QVector<int>()) + const QList<int> &inputs = QList<int>(), + const QList<int> &outputs = QList<int>()) { auto statement = QShaderGraph::Statement(); statement.node = node; @@ -80,7 +81,8 @@ namespace qDebug() << prefix << statement.inputs << statement.uuid().toString() << statement.outputs; } - void dumpStatementsIfNeeded(const QVector<QShaderGraph::Statement> &statements, const QVector<QShaderGraph::Statement> &expected) + void dumpStatementsIfNeeded(const QList<QShaderGraph::Statement> &statements, + const QList<QShaderGraph::Statement> &expected) { if (statements != expected) { for (int i = 0; i < qMax(statements.size(), expected.size()); i++) { @@ -464,14 +466,12 @@ void tst_QShaderGraph::shouldSerializeGraphForCodeGeneration() const auto statements = graph.createStatements(); // THEN - const auto expected = QVector<QShaderGraph::Statement>() - << createStatement(input2, {}, {1}) - << createStatement(input1, {}, {0}) - << createStatement(function2, {0, 1}, {3}) - << createStatement(function1, {0}, {2}) - << createStatement(function3, {2, 3}, {4, 5}) - << createStatement(output2, {5}, {}) - << createStatement(output1, {4}, {}); + const auto expected = QList<QShaderGraph::Statement>() + << createStatement(input2, {}, { 1 }) << createStatement(input1, {}, { 0 }) + << createStatement(function2, { 0, 1 }, { 3 }) + << createStatement(function1, { 0 }, { 2 }) + << createStatement(function3, { 2, 3 }, { 4, 5 }) << createStatement(output2, { 5 }, {}) + << createStatement(output1, { 4 }, {}); dumpStatementsIfNeeded(statements, expected); QCOMPARE(statements, expected); } @@ -517,8 +517,7 @@ void tst_QShaderGraph::shouldHandleUnboundPortsDuringGraphSerialization() // THEN // Note that no statement has any unbound input - const auto expected = QVector<QShaderGraph::Statement>() - << createStatement(input, {}, {0}); + const auto expected = QList<QShaderGraph::Statement>() << createStatement(input, {}, { 0 }); dumpStatementsIfNeeded(statements, expected); QCOMPARE(statements, expected); } @@ -566,7 +565,7 @@ void tst_QShaderGraph::shouldSurviveCyclesDuringGraphSerialization() // THEN // The cycle is ignored - const auto expected = QVector<QShaderGraph::Statement>(); + const auto expected = QList<QShaderGraph::Statement>(); dumpStatementsIfNeeded(statements, expected); QCOMPARE(statements, expected); } @@ -641,16 +640,14 @@ void tst_QShaderGraph::shouldDealWithEdgesJumpingOverLayers() const auto statements = graph.createStatements(); // THEN - const auto expected = QVector<QShaderGraph::Statement>() - << createStatement(texCoord, {}, {2}) - << createStatement(texture, {}, {1}) - << createStatement(lightIntensity, {}, {3}) - << createStatement(sampleTexture, {1, 2}, {5}) - << createStatement(worldPosition, {}, {0}) - << createStatement(exposure, {}, {4}) - << createStatement(lightFunction, {5, 0, 3}, {6}) - << createStatement(exposureFunction, {6, 4}, {7}) - << createStatement(fragColor, {7}, {}); + const auto expected = QList<QShaderGraph::Statement>() + << createStatement(texCoord, {}, { 2 }) << createStatement(texture, {}, { 1 }) + << createStatement(lightIntensity, {}, { 3 }) + << createStatement(sampleTexture, { 1, 2 }, { 5 }) + << createStatement(worldPosition, {}, { 0 }) << createStatement(exposure, {}, { 4 }) + << createStatement(lightFunction, { 5, 0, 3 }, { 6 }) + << createStatement(exposureFunction, { 6, 4 }, { 7 }) + << createStatement(fragColor, { 7 }, {}); dumpStatementsIfNeeded(statements, expected); QCOMPARE(statements, expected); } @@ -716,11 +713,11 @@ void tst_QShaderGraph::shouldGenerateDifferentStatementsDependingOnActiveLayers( const auto statements = graph.createStatements({"diffuseUniform", "normalUniform"}); // THEN - const auto expected = QVector<QShaderGraph::Statement>() - << createStatement(normalUniform, {}, {1}) - << createStatement(diffuseUniform, {}, {0}) - << createStatement(lightFunction, {0, 1}, {2}) - << createStatement(fragColor, {2}, {}); + const auto expected = QList<QShaderGraph::Statement>() + << createStatement(normalUniform, {}, { 1 }) + << createStatement(diffuseUniform, {}, { 0 }) + << createStatement(lightFunction, { 0, 1 }, { 2 }) + << createStatement(fragColor, { 2 }, {}); dumpStatementsIfNeeded(statements, expected); QCOMPARE(statements, expected); } @@ -730,12 +727,12 @@ void tst_QShaderGraph::shouldGenerateDifferentStatementsDependingOnActiveLayers( const auto statements = graph.createStatements({"diffuseUniform", "normalTexture"}); // THEN - const auto expected = QVector<QShaderGraph::Statement>() - << createStatement(texCoord, {}, {0}) - << createStatement(normalTexture, {0}, {2}) - << createStatement(diffuseUniform, {}, {1}) - << createStatement(lightFunction, {1, 2}, {3}) - << createStatement(fragColor, {3}, {}); + const auto expected = QList<QShaderGraph::Statement>() + << createStatement(texCoord, {}, { 0 }) + << createStatement(normalTexture, { 0 }, { 2 }) + << createStatement(diffuseUniform, {}, { 1 }) + << createStatement(lightFunction, { 1, 2 }, { 3 }) + << createStatement(fragColor, { 3 }, {}); dumpStatementsIfNeeded(statements, expected); QCOMPARE(statements, expected); } @@ -745,12 +742,11 @@ void tst_QShaderGraph::shouldGenerateDifferentStatementsDependingOnActiveLayers( const auto statements = graph.createStatements({"diffuseTexture", "normalUniform"}); // THEN - const auto expected = QVector<QShaderGraph::Statement>() - << createStatement(texCoord, {}, {0}) - << createStatement(normalUniform, {}, {2}) - << createStatement(diffuseTexture, {0}, {1}) - << createStatement(lightFunction, {1, 2}, {3}) - << createStatement(fragColor, {3}, {}); + const auto expected = QList<QShaderGraph::Statement>() + << createStatement(texCoord, {}, { 0 }) << createStatement(normalUniform, {}, { 2 }) + << createStatement(diffuseTexture, { 0 }, { 1 }) + << createStatement(lightFunction, { 1, 2 }, { 3 }) + << createStatement(fragColor, { 3 }, {}); dumpStatementsIfNeeded(statements, expected); QCOMPARE(statements, expected); } @@ -760,12 +756,12 @@ void tst_QShaderGraph::shouldGenerateDifferentStatementsDependingOnActiveLayers( const auto statements = graph.createStatements({"diffuseTexture", "normalTexture"}); // THEN - const auto expected = QVector<QShaderGraph::Statement>() - << createStatement(texCoord, {}, {0}) - << createStatement(normalTexture, {0}, {2}) - << createStatement(diffuseTexture, {0}, {1}) - << createStatement(lightFunction, {1, 2}, {3}) - << createStatement(fragColor, {3}, {}); + const auto expected = QList<QShaderGraph::Statement>() + << createStatement(texCoord, {}, { 0 }) + << createStatement(normalTexture, { 0 }, { 2 }) + << createStatement(diffuseTexture, { 0 }, { 1 }) + << createStatement(lightFunction, { 1, 2 }, { 3 }) + << createStatement(fragColor, { 3 }, {}); dumpStatementsIfNeeded(statements, expected); QCOMPARE(statements, expected); } @@ -806,11 +802,10 @@ void tst_QShaderGraph::shouldDealWithBranchesWithoutOutput() // THEN // Note that no edge leads to the unbound input - const auto expected = QVector<QShaderGraph::Statement>() - << createStatement(input, {}, {0}) - << createStatement(function, {0}, {1}) - << createStatement(output, {1}, {}) - << createStatement(danglingFunction, {0}, {2}); + const auto expected = QList<QShaderGraph::Statement>() + << createStatement(input, {}, { 0 }) << createStatement(function, { 0 }, { 1 }) + << createStatement(output, { 1 }, {}) + << createStatement(danglingFunction, { 0 }, { 2 }); dumpStatementsIfNeeded(statements, expected); QCOMPARE(statements, expected); } diff --git a/tests/auto/gui/util/qshadergraphloader/tst_qshadergraphloader.cpp b/tests/auto/gui/util/qshadergraphloader/tst_qshadergraphloader.cpp index 761e03a195..89cd5a7ecb 100644 --- a/tests/auto/gui/util/qshadergraphloader/tst_qshadergraphloader.cpp +++ b/tests/auto/gui/util/qshadergraphloader/tst_qshadergraphloader.cpp @@ -67,7 +67,8 @@ namespace return port; } - QShaderNode createNode(const QVector<QShaderNodePort> &ports, const QStringList &layers = QStringList()) + QShaderNode createNode(const QList<QShaderNodePort> &ports, + const QStringList &layers = QStringList()) { auto node = QShaderNode(); node.setUuid(QUuid::createUuid()); @@ -216,7 +217,8 @@ namespace qDebug() << prefix << statement.inputs << statement.uuid().toString() << statement.outputs; } - void dumpStatementsIfNeeded(const QVector<QShaderGraph::Statement> &statements, const QVector<QShaderGraph::Statement> &expected) + void dumpStatementsIfNeeded(const QList<QShaderGraph::Statement> &statements, + const QList<QShaderGraph::Statement> &expected) { if (statements != expected) { for (int i = 0; i < qMax(statements.size(), expected.size()); i++) { diff --git a/tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp b/tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp index ec1bd87a32..f3e1013a4b 100644 --- a/tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp +++ b/tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp @@ -71,7 +71,7 @@ namespace return port; } - QShaderNode createNode(const QVector<QShaderNodePort> &ports) + QShaderNode createNode(const QList<QShaderNodePort> &ports) { auto node = QShaderNode(); for (const auto &port : ports) |