Commit f2627ef1 authored by Mitch Curtis's avatar Mitch Curtis
Browse files

tst_gauge: try to stabilize test_gaugeTickmarkValues()


This is failing sporadically on Windows 10. Replace wait(0) with a more
reliable tryCompare() check.

Task-number: QTBUG-58859
Change-Id: Ia2010afd17051334717e944d8c303f757c14a6b0
Reviewed-by: default avatarJ-P Nurmi <jpnurmi@qt.io>
Showing with 8 additions and 10 deletions
......@@ -254,28 +254,26 @@ TestCase {
gauge.height = gaugeHeightFor100PixelHighValueBar(gauge);
compare(gauge.__panel.barLength, 100);
// Give stuff time to re-layout after the new control height, etc.,
// otherwise we'll be comparing against incorrect pixel positions.
wait(0);
for (var tickmarkIndex = 0; tickmarkIndex < data.expectedTickmarkValues.length; ++tickmarkIndex) {
var tickmark = TestUtils.findChild(gauge, "tickmark" + tickmarkIndex);
compare(tickmark.value, data.expectedTickmarkValues[tickmarkIndex],
"Value of tickmark at index " + tickmarkIndex + " is " + data.expectedTickmarkValues[tickmarkIndex]);
// QTBUG-58859: give stuff time to re-layout after the new control height, etc.,
// otherwise we'll be comparing against incorrect pixel positions.
tryCompare(tickmark, "value", data.expectedTickmarkValues[tickmarkIndex], undefined,
"Value of tickmark at index " + tickmarkIndex + " should be " + data.expectedTickmarkValues[tickmarkIndex]);
var expectedValuePos = data.expectedTickmarkValuePositions[tickmarkIndex];
compare(tickmark.valuePosition, expectedValuePos,
"Value position of tickmark at index " + tickmarkIndex + " is " + expectedValuePos);
tryCompare(tickmark, "valuePosition", expectedValuePos, undefined,
"Value position of tickmark at index " + tickmarkIndex + " should be " + expectedValuePos);
}
for (var minorTickmarkIndex = 0; minorTickmarkIndex < data.expectedMinorTickmarkValues.length; ++minorTickmarkIndex) {
var minorTickmark = TestUtils.findChild(gauge, "minorTickmark" + minorTickmarkIndex);
compare(minorTickmark.value, data.expectedMinorTickmarkValues[minorTickmarkIndex],
"Value of minor tickmark at index " + minorTickmarkIndex + " is " + data.expectedMinorTickmarkValues[minorTickmarkIndex]);
"Value of minor tickmark at index " + minorTickmarkIndex + " should be " + data.expectedMinorTickmarkValues[minorTickmarkIndex]);
expectedValuePos = data.expectedMinorTickmarkValuePositions[minorTickmarkIndex];
compare(minorTickmark.valuePosition, expectedValuePos,
"Value position of minor tickmark at index " + minorTickmarkIndex + " is " + expectedValuePos);
"Value position of minor tickmark at index " + minorTickmarkIndex + " should be " + expectedValuePos);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment