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>
bb10
Kevin Ottens 2017-06-22 08:09:59 +02:00
parent 808969527a
commit 7e7cd1c294
1 changed files with 6 additions and 1 deletions

View File

@ -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);