From 98845baf2905fe1f6485c73a88c0182e5bd09ddc Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 5 May 2020 10:26:37 +0200 Subject: 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 --- tests/auto/qquickmenu/tst_qquickmenu.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'tests/auto') 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); } } -- cgit v1.2.3