From e0cbd7d94b604890765c0a4415d4178422f93fcc Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Wed, 26 Jun 2013 17:18:01 +0200 Subject: Export qHash(QNdefRecord) The symbol is used by the library itself. We may as well export it for wider use. The patch adds qHash usage to the unit tests to confirm the export of the function and to ensure catch changes of the hashing algorithm. Task-number: QTBUG-31951 Change-Id: Ic6e6e2a0cf7ee5aa9f5bd6c91a8a6c31030c5848 Reviewed-by: Fabian Bumberger Reviewed-by: Aaron McCarthy --- src/nfc/qndefrecord.h | 2 +- tests/auto/qndefmessage/tst_qndefmessage.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/nfc/qndefrecord.h b/src/nfc/qndefrecord.h index a896f5f1..85f18c91 100644 --- a/src/nfc/qndefrecord.h +++ b/src/nfc/qndefrecord.h @@ -112,7 +112,7 @@ private: } \ QT_END_NAMESPACE_NFC -uint qHash(const QNdefRecord &key); +Q_NFC_EXPORT uint qHash(const QNdefRecord &key); QT_END_NAMESPACE_NFC diff --git a/tests/auto/qndefmessage/tst_qndefmessage.cpp b/tests/auto/qndefmessage/tst_qndefmessage.cpp index ba0dcd18..17e29207 100644 --- a/tests/auto/qndefmessage/tst_qndefmessage.cpp +++ b/tests/auto/qndefmessage/tst_qndefmessage.cpp @@ -174,6 +174,7 @@ void tst_QNdefMessage::tst_parse_data() QList recordList; recordList.append(record); QTest::newRow("chunked") << data << QNdefMessage(recordList) << QVariantList(); + QCOMPARE(qHash(record), 1887494681LL); } // NFC-RTD Text @@ -203,6 +204,7 @@ void tst_QNdefMessage::tst_parse_data() QTest::newRow("nfc-rtd text") << data << QNdefMessage(recordList) << (QVariantList() << QLatin1String("Test String") << QLatin1String("en")); + QCOMPARE(qHash(record), 3247259560LL); } // NFC-RTD Text @@ -234,6 +236,7 @@ void tst_QNdefMessage::tst_parse_data() << (QVariantList() << QString::fromUtf8("\343\203\206\343\202\271\343\203\210\346\226" "\207\345\255\227\345\210\227") << QLatin1String("ja")); + QCOMPARE(qHash(record), 3407917933LL); } // NFC-RTD URI @@ -262,6 +265,7 @@ void tst_QNdefMessage::tst_parse_data() QTest::newRow("nfc-rtd uri http://qt.nokia.com/") << data << QNdefMessage(recordList) << (QVariantList() << QUrl(QLatin1String("http://qt.nokia.com/"))); + QCOMPARE(qHash(record), 4030951038LL); } // NFC-RTD URI @@ -290,6 +294,7 @@ void tst_QNdefMessage::tst_parse_data() QTest::newRow("nfc-rtd uri abbrev http://qt.nokia.com/") << data << QNdefMessage(recordList) << (QVariantList() << QUrl(QLatin1String("http://qt.nokia.com/"))); + QCOMPARE(qHash(record), 132405495LL); } // NFC-RTD URI @@ -318,6 +323,7 @@ void tst_QNdefMessage::tst_parse_data() QTest::newRow("nfc-rtd uri tel:+1234567890") << data << QNdefMessage(recordList) << (QVariantList() << QUrl(QLatin1String("tel:+1234567890"))); + QCOMPARE(qHash(record), 3757269174LL); } // Truncated message -- cgit v1.2.1