Changed qcryptographichash unittest to work from installation directory

- Changed qcryptographichash to use TESTDATA and QFINDTESTDATA

Change-Id: Ic3a1bdccc9f81605c648dab2a642421d17f7fe80
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
bb10
Kurt Korbatits 2012-02-15 14:30:16 +10:00 committed by Qt by Nokia
parent 32060c2115
commit 857775f701
2 changed files with 4 additions and 12 deletions

View File

@ -3,14 +3,4 @@ TARGET = tst_qcryptographichash
QT = core testlib
SOURCES = tst_qcryptographichash.cpp
wince* {
addFiles.files = data/*
addFiles.path = data/
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\".\\\"
}
else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
TESTDATA += data/*

View File

@ -169,7 +169,9 @@ void tst_QCryptographicHash::files()
QFETCH(QCryptographicHash::Algorithm, algorithm);
QFETCH(QByteArray, md5sum);
{
QFile f(QString::fromLocal8Bit(SRCDIR) + filename);
QString testData = QFINDTESTDATA(filename);
QVERIFY2(!testData.isEmpty(), qPrintable(QString("Cannot find test data: %1").arg(filename)));
QFile f(testData);
QCryptographicHash hash(algorithm);
QVERIFY(! hash.addData(&f)); // file is not open for reading;
if (f.open(QIODevice::ReadOnly)) {