aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2020-05-05 10:26:37 +0200
committerMitch Curtis <mitch.curtis@qt.io>2020-05-07 23:20:22 +0200
commit98845baf2905fe1f6485c73a88c0182e5bd09ddc (patch)
treefeb6254f731641afa26faed1ecd5e5ccff77cb34 /tests/auto
parentdd90f7be501a9545e74aaecacba1d469a8fad5aa (diff)
Revert "tst_qquickmenu: fix flakiness resulting from floating point comparison"
This reverts commit c463f09fcb63927c66bc3307ddcc88d85d38b2bc. After c78a960198d59fb9a9ddd83ad7098b1db396edfd in qtbase, this shouldn't be necessary. Pick-to: 5.15 Change-Id: I1789eae295b1ebc44630b758414087344909ea60 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qquickmenu/tst_qquickmenu.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/tests/auto/qquickmenu/tst_qquickmenu.cpp b/tests/auto/qquickmenu/tst_qquickmenu.cpp
index 39ae6ec8..22aece0c 100644
--- a/tests/auto/qquickmenu/tst_qquickmenu.cpp
+++ b/tests/auto/qquickmenu/tst_qquickmenu.cpp
@@ -1477,20 +1477,19 @@ void tst_QQuickMenu::subMenuPosition()
if (cascade) {
QCOMPARE(subMenu1->parentItem(), subMenu1Item);
// vertically aligned to the parent menu item
- // Add 1 in order to avoid flaky failures resulting from fuzzy comparison when both values are ~0.
- QCOMPARE(1 + subMenu1->popupItem()->y(), 1 + mainMenu->popupItem()->y() + subMenu1Item->y());
+ QCOMPARE(subMenu1->popupItem()->y(), mainMenu->popupItem()->y() + subMenu1Item->y());
if (mirrored) {
// on the left of the parent menu
- QCOMPARE(1 + subMenu1->popupItem()->x(), 1 + mainMenu->popupItem()->x() - subMenu1->width() + overlap);
+ QCOMPARE(subMenu1->popupItem()->x(), mainMenu->popupItem()->x() - subMenu1->width() + overlap);
} else {
// on the right of the parent menu
- QCOMPARE(1 + subMenu1->popupItem()->x(), 1 + mainMenu->popupItem()->x() + mainMenu->width() - overlap);
+ QCOMPARE(subMenu1->popupItem()->x(), mainMenu->popupItem()->x() + mainMenu->width() - overlap);
}
} else {
QCOMPARE(subMenu1->parentItem(), mainMenu->parentItem());
// centered over the parent menu
- QCOMPARE(1 + subMenu1->popupItem()->x(), 1 + mainMenu->popupItem()->x() + (mainMenu->width() - subMenu1->width()) / 2);
- QCOMPARE(1 + subMenu1->popupItem()->y(), 1 + mainMenu->popupItem()->y() + (mainMenu->height() - subMenu1->height()) / 2);
+ QCOMPARE(subMenu1->popupItem()->x(), mainMenu->popupItem()->x() + (mainMenu->width() - subMenu1->width()) / 2);
+ QCOMPARE(subMenu1->popupItem()->y(), mainMenu->popupItem()->y() + (mainMenu->height() - subMenu1->height()) / 2);
}
// open the sub-sub-menu (can flip)
@@ -1507,19 +1506,19 @@ void tst_QQuickMenu::subMenuPosition()
if (cascade) {
QCOMPARE(subSubMenu1->parentItem(), subSubMenu1Item);
// vertically aligned to the parent menu item
- QCOMPARE(1 + subSubMenu1->popupItem()->y(), 1 + subMenu1->popupItem()->y() + subSubMenu1Item->y());
+ QCOMPARE(subSubMenu1->popupItem()->y(), subMenu1->popupItem()->y() + subSubMenu1Item->y());
if (mirrored != flip) {
// on the left of the parent menu
- QCOMPARE(1 + subSubMenu1->popupItem()->x(), 1 + subMenu1->popupItem()->x() - subSubMenu1->width() + overlap);
+ QCOMPARE(subSubMenu1->popupItem()->x(), subMenu1->popupItem()->x() - subSubMenu1->width() + overlap);
} else {
// on the right of the parent menu
- QCOMPARE(1 + subSubMenu1->popupItem()->x(), 1 + subMenu1->popupItem()->x() + subMenu1->width() - overlap);
+ QCOMPARE(subSubMenu1->popupItem()->x(), subMenu1->popupItem()->x() + subMenu1->width() - overlap);
}
} else {
QCOMPARE(subSubMenu1->parentItem(), subMenu1->parentItem());
// centered over the parent menu
- QCOMPARE(1 + subSubMenu1->popupItem()->x(), 1 + subMenu1->popupItem()->x() + (subMenu1->width() - subSubMenu1->width()) / 2);
- QCOMPARE(1 + subSubMenu1->popupItem()->y(), 1 + subMenu1->popupItem()->y() + (subMenu1->height() - subSubMenu1->height()) / 2);
+ QCOMPARE(subSubMenu1->popupItem()->x(), subMenu1->popupItem()->x() + (subMenu1->width() - subSubMenu1->width()) / 2);
+ QCOMPARE(subSubMenu1->popupItem()->y(), subMenu1->popupItem()->y() + (subMenu1->height() - subSubMenu1->height()) / 2);
}
}