From fb65b32d7621f065ec854f1e72828720bffb3b39 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 7 Sep 2020 15:57:15 +0200 Subject: Add qHash implementation for QPoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ChangeLog][QtCore][QPoint] Added qHash() implementation. Change-Id: I65332e7aafab53af40a6e11457b9b457196d584c Fixes: QTBUG-86457 Reviewed-by: Thorbjørn Lindeijer Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qpoint/tst_qpoint.cpp | 3 +++ tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp b/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp index f25492d2db..0f3edb3eed 100644 --- a/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp +++ b/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp @@ -346,6 +346,9 @@ void tst_QPoint::operator_eq() QCOMPARE(equal, expectEqual); bool notEqual = point1 != point2; QCOMPARE(notEqual, !expectEqual); + + if (equal) + QCOMPARE(qHash(point1), qHash(point2)); } #ifndef QT_NO_DATASTREAM diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 5d4e9def83..9c5a52f2d9 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -3256,11 +3256,6 @@ void tst_QPainter::imageScaling_task206785() #define FOR_EACH_NEIGHBOR_8 for (int dx = -1; dx <= 1; ++dx) for (int dy = -1; dy <= 1; ++dy) if (dx != 0 || dy != 0) #define FOR_EACH_NEIGHBOR_4 for (int dx = -1; dx <= 1; ++dx) for (int dy = -1; dy <= 1; ++dy) if ((dx == 0) != (dy == 0)) -size_t qHash(const QPoint &point) -{ - return qHash(qMakePair(point.x(), point.y())); -} - bool verifyOutlineFillConsistency(const QImage &img, QRgb outside, QRgb inside, QRgb outline) { if (img.pixel(img.width() / 2, img.height() / 2) != inside) -- cgit v1.2.3