diff options
author | Hongyu Wang <ext-hongyu.2.wang@nokia.com> | 2011-11-09 10:10:03 +0800 |
---|---|---|
committer | Hongyu Wang <ext-hongyu.2.wang@nokia.com> | 2011-11-09 10:10:03 +0800 |
commit | 0708474a1990becb5aecb80f9f2fd7bc4987f687 (patch) | |
tree | 89abf128f94bb7297075066122ec77a330f6c071 /tests | |
parent | 77c8b73dd5103f71bc7957efd006d266e2624f49 (diff) |
Fix Tag3 and LLCP type2 test code error.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/manual/nfcsymbianbackend/qllcpsockettype2/tst_qllcpsockettype2.cpp | 10 | ||||
-rw-r--r-- | tests/manual/nfcsymbianbackend/qnearfieldtagtype3/tst_qnearfieldtagtype3.cpp | 20 |
2 files changed, 21 insertions, 9 deletions
diff --git a/tests/manual/nfcsymbianbackend/qllcpsockettype2/tst_qllcpsockettype2.cpp b/tests/manual/nfcsymbianbackend/qllcpsockettype2/tst_qllcpsockettype2.cpp index a6f0be4bbd..efbd956487 100644 --- a/tests/manual/nfcsymbianbackend/qllcpsockettype2/tst_qllcpsockettype2.cpp +++ b/tests/manual/nfcsymbianbackend/qllcpsockettype2/tst_qllcpsockettype2.cpp @@ -245,7 +245,7 @@ void tst_qllcpsockettype2::echo_data() QTest::newRow("0") << TestUri << "echo"; QString longStr4k; - for (int i = 0; i < 4000; i++) + for (int i = 0; i < 40; i++) longStr4k.append((char)(i%26 + 'a')); QTest::newRow("1") << TestUri << longStr4k; } @@ -354,7 +354,7 @@ void tst_qllcpsockettype2::echo_wait_data() QTest::newRow("0") << TestUri << "echo"; QString longStr4k; - for (int i = 0; i < 4000; i++) + for (int i = 0; i < 40; i++) longStr4k.append((char)(i%26 + 'a')); QTest::newRow("1") << TestUri << longStr4k; } @@ -546,7 +546,7 @@ void tst_qllcpsockettype2::multipleWrite_data() QTest::newRow("0") << TestUri << "1234567890"; QString longStr4k; - for (int i = 0; i < 4000; i++) + for (int i = 0; i < 40; i++) longStr4k.append((char)(i%26 + 'a')); QTest::newRow("1") << TestUri << longStr4k; } @@ -719,7 +719,7 @@ void tst_qllcpsockettype2::waitReadyReadInSlot() QTRY_VERIFY(!connectedSpy.isEmpty()); QString echo; - for (int i = 0; i < 2000; i++) + for (int i = 0; i < 20; i++) echo.append((char)(i%26 + 'a')); //Send data to server QByteArray block; @@ -819,7 +819,7 @@ void tst_qllcpsockettype2::deleteSocketWhenInUse() QTRY_VERIFY(!connectedSpy.isEmpty()); QString echo; - for (int i = 0; i < 2000; i++) + for (int i = 0; i < 20; i++) echo.append((char)(i%26 + 'a')); //Send data to server QByteArray block; diff --git a/tests/manual/nfcsymbianbackend/qnearfieldtagtype3/tst_qnearfieldtagtype3.cpp b/tests/manual/nfcsymbianbackend/qnearfieldtagtype3/tst_qnearfieldtagtype3.cpp index 5bcf1fbbaf..4c9609b18f 100644 --- a/tests/manual/nfcsymbianbackend/qnearfieldtagtype3/tst_qnearfieldtagtype3.cpp +++ b/tests/manual/nfcsymbianbackend/qnearfieldtagtype3/tst_qnearfieldtagtype3.cpp @@ -221,6 +221,8 @@ void tst_qnearfieldtagtype3::testRawAccessAndNdefAccess(const QList<QNdefMessage QNdefMessage message; QNdefNfcTextRecord textRecord; textRecord.setText("nfc"); + textRecord.setEncoding(QNdefNfcTextRecord::Utf8); + textRecord.setLocale(QString("en")); message.append(textRecord); QByteArray expectedNdefContent = message.toByteArray(); @@ -232,15 +234,25 @@ void tst_qnearfieldtagtype3::testRawAccessAndNdefAccess(const QList<QNdefMessage newAttribInfo[13] = len&0xFF; newAttribInfo[12] = (len>>8)&0xFF; newAttribInfo[11] = (len>>16)&0xFF; - newAttribInfo[9] = 0x0F; - + newAttribInfo[9] = 0x00; + + int checksum = 0; + for (int i = 0; i <= 13; ++i) + { + checksum += newAttribInfo[i]; + } + newAttribInfo[15] = checksum&0xFF; + newAttribInfo[14] = (checksum>>8)&0xFF; + + QByteArray ndefData; ndefData.append(newAttribInfo); ndefData.append(expectedNdefContent); qDebug()<<"updated ndef len = "<<len; - for (int i = 0; i < 16 - ndefData.count()%16; ++i) + int padcount = 16 - ndefData.count()%16; + for (int i = 0; i < padcount; ++i) { // appending padding data ndefData.append((char)0); @@ -261,7 +273,7 @@ void tst_qnearfieldtagtype3::testRawAccessAndNdefAccess(const QList<QNdefMessage serviceBlockList.clear(); serviceBlockList.insert(serviceCode, updatedBlockList); QNearFieldTarget::RequestId id2 = tester.target->update(serviceBlockList, ndefData); - QVERIFY(tester.target->waitForRequestCompleted(id2)); + QVERIFY(tester.target->waitForRequestCompleted(id2, 1000)); QVERIFY(tester.target->requestResponse(id2).toBool()); ++okCount; QCOMPARE(okSpy.count(), okCount); |