From 7e7cd1c294e82352f50859c649963175258401da Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Thu, 22 Jun 2017 08:09:59 +0200 Subject: 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 --- tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3