summaryrefslogtreecommitdiffstats
path: root/tests/auto/qndefmessage
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-05-27 16:19:06 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-28 13:27:34 +0200
commit00163ae2994916fd75375e588690003130721c50 (patch)
treeab2b475374e80eb97895793abf611d94e3c7e950 /tests/auto/qndefmessage
parent552f1a164d627720942414915fb56ae7d3b7ef22 (diff)
Compare the NDef records without using qHash
It seems Windows produces a different hash value compared to other platforms. Change-Id: I73669894d63ffca08dbc6ed010e923050a0c8e8f Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'tests/auto/qndefmessage')
-rw-r--r--tests/auto/qndefmessage/tst_qndefmessage.cpp35
1 files changed, 29 insertions, 6 deletions
diff --git a/tests/auto/qndefmessage/tst_qndefmessage.cpp b/tests/auto/qndefmessage/tst_qndefmessage.cpp
index 897db5a3..c94fe46d 100644
--- a/tests/auto/qndefmessage/tst_qndefmessage.cpp
+++ b/tests/auto/qndefmessage/tst_qndefmessage.cpp
@@ -174,7 +174,10 @@ void tst_QNdefMessage::tst_parse_data()
QList<QNdefRecord> recordList;
recordList.append(record);
QTest::newRow("chunked") << data << QNdefMessage(recordList) << QVariantList();
- QCOMPARE(qHash(record), 1887494681LL);
+
+ const QByteArray recordContent = record.type() + record.id()
+ + record.payload();
+ QCOMPARE(recordContent, QByteArray::fromHex(QByteArray("7479706569647061796c6f6164")));
}
// NFC-RTD Text
@@ -204,7 +207,11 @@ void tst_QNdefMessage::tst_parse_data()
QTest::newRow("nfc-rtd text") << data << QNdefMessage(recordList)
<< (QVariantList() << QStringLiteral("Test String")
<< QStringLiteral("en"));
- QCOMPARE(qHash(record), 3247259560LL);
+
+ const QByteArray recordContent = record.type() + record.id()
+ + record.payload();
+ QCOMPARE(recordContent,
+ QByteArray::fromHex(QByteArray("5402656e5465737420537472696e67")));
}
// NFC-RTD Text
@@ -236,7 +243,11 @@ 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")
<< QStringLiteral("ja"));
- QCOMPARE(qHash(record), 3407917933LL);
+
+ const QByteArray recordContent = record.type() + record.id()
+ + record.payload();
+ QCOMPARE(recordContent,
+ QByteArray::fromHex(QByteArray("54026a61e38386e382b9e38388e69687e5ad97e58897")));
}
// NFC-RTD URI
@@ -265,7 +276,11 @@ void tst_QNdefMessage::tst_parse_data()
QTest::newRow("nfc-rtd uri http://qt-project.org/")
<< data << QNdefMessage(recordList)
<< (QVariantList() << QUrl(QStringLiteral("http://qt-project.org/")));
- QCOMPARE(qHash(record), 3736709795LL);
+
+ const QByteArray recordContent = record.type() + record.id()
+ + record.payload();
+ QCOMPARE(recordContent,
+ QByteArray::fromHex(QByteArray("5500687474703a2f2f71742d70726f6a6563742e6f72672f")));
}
// NFC-RTD URI
@@ -294,7 +309,11 @@ void tst_QNdefMessage::tst_parse_data()
QTest::newRow("nfc-rtd uri abbrev http://qt-project.org/")
<< data << QNdefMessage(recordList)
<< (QVariantList() << QUrl(QStringLiteral("http://qt-project.org/")));
- QCOMPARE(qHash(record),2445925084LL);
+
+ const QByteArray recordContent = record.type() + record.id()
+ + record.payload();
+ QCOMPARE(recordContent,
+ QByteArray::fromHex(QByteArray("550371742d70726f6a6563742e6f72672f")));
}
// NFC-RTD URI
@@ -323,7 +342,11 @@ void tst_QNdefMessage::tst_parse_data()
QTest::newRow("nfc-rtd uri tel:+1234567890")
<< data << QNdefMessage(recordList)
<< (QVariantList() << QUrl(QStringLiteral("tel:+1234567890")));
- QCOMPARE(qHash(record), 3757269174LL);
+
+ const QByteArray recordContent = record.type() + record.id()
+ + record.payload();
+ QCOMPARE(recordContent,
+ QByteArray::fromHex(QByteArray("55052b31323334353637383930")));
}
// Truncated message