diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2013-06-26 17:18:01 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-27 08:50:35 +0200 |
commit | e0cbd7d94b604890765c0a4415d4178422f93fcc (patch) | |
tree | 008821d7a364896e2c9801b3ddd93db333a71ea6 | |
parent | dbc2ffc3110d41973daf541ab22e3e01ded91c5b (diff) | |
download | qtconnectivity-e0cbd7d94b604890765c0a4415d4178422f93fcc.tar.gz |
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 <fbumberger@rim.com>
Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
-rw-r--r-- | src/nfc/qndefrecord.h | 2 | ||||
-rw-r--r-- | tests/auto/qndefmessage/tst_qndefmessage.cpp | 6 |
2 files changed, 7 insertions, 1 deletions
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<QNdefRecord> 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 |