diff options
author | Kevin Ottens <kevin.ottens@kdab.com> | 2017-06-22 08:09:59 +0200 |
---|---|---|
committer | Kevin Ottens <kevin.ottens@kdab.com> | 2017-06-22 11:57:33 +0000 |
commit | 7e7cd1c294e82352f50859c649963175258401da (patch) | |
tree | 07a136090c62900444b30b2f5fc162f323e694b3 | |
parent | 808969527ac379be6a13caadd5d6c350facfc9aa (diff) |
Sort the keys before comparing them in the test
The return order of the keys is random, so let's sort both first, then
we can compare the lists. Should get rid of the test flakiness.
Change-Id: I2e89d3cc603da6a4667b3677350baa4d40d59b45
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp b/tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp index 158597128b..59c476acc3 100644 --- a/tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp +++ b/tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp @@ -270,7 +270,12 @@ void tst_QShaderNodesLoader::shouldLoadFromJsonStream() QCOMPARE(loader.status(), status); QFETCH(NodeHash, nodes); - QCOMPARE(loader.nodes().keys(), nodes.keys()); + const auto sortedKeys = [](const NodeHash &nodes) { + auto res = nodes.keys(); + res.sort(); + return res; + }; + QCOMPARE(sortedKeys(loader.nodes()), sortedKeys(nodes)); for (const auto &key : nodes.keys()) { const auto actual = loader.nodes().value(key); const auto expected = nodes.value(key); |