diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-11-18 16:54:09 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-11-22 04:57:02 +0000 |
commit | d20773824529d191e7b483b505107dce6c1b1c3d (patch) | |
tree | 3a71cbcef337eb9efb709d178af2eee1123e493b /tests/auto | |
parent | 32b99a38c563e4037362a25b2a749e2261bf16da (diff) |
Fix missing last modification time stamp in qrc content
The time stamp is added at the end of the node information and
consequently this also bumps the version.
Task-number: QTBUG-57182
Change-Id: Ia10e006f28c0b168b2bcd74ed8b7098f84d10af3
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp | 15 | ||||
-rw-r--r-- | tests/auto/tools/rcc/data/images/images.expected | 10 | ||||
-rw-r--r-- | tests/auto/tools/rcc/tst_rcc.cpp | 17 |
3 files changed, 37 insertions, 5 deletions
diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index 561ab193c6..7fdd00876f 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -55,6 +55,7 @@ private slots: void searchPath(); void doubleSlashInRoot(); void setLocale(); + void lastModified(); private: const QString m_runtimeResourceRcc; @@ -489,6 +490,20 @@ void tst_QResourceEngine::setLocale() QLocale::setDefault(QLocale::system()); } +void tst_QResourceEngine::lastModified() +{ + { + QFileInfo fi(":/"); + QVERIFY(fi.exists()); + QVERIFY2(!fi.lastModified().isValid(), qPrintable(fi.lastModified().toString())); + } + { + QFileInfo fi(":/search_file.txt"); + QVERIFY(fi.exists()); + QVERIFY(fi.lastModified().isValid()); + } +} + QTEST_MAIN(tst_QResourceEngine) #include "tst_qresourceengine.moc" diff --git a/tests/auto/tools/rcc/data/images/images.expected b/tests/auto/tools/rcc/data/images/images.expected index 1f0157d51c..eb5d9222c8 100644 --- a/tests/auto/tools/rcc/data/images/images.expected +++ b/tests/auto/tools/rcc/data/images/images.expected @@ -79,16 +79,22 @@ static const unsigned char qt_resource_name[] = { static const unsigned char qt_resource_struct[] = { // : 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, // :/images 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x2, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, // :/images/subdir 0x0,0x0,0x0,0x12,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x5, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, // :/images/square.png 0x0,0x0,0x0,0x3e,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0xa9, +TIMESTAMP:images/square.png // :/images/circle.png 0x0,0x0,0x0,0x24,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0, +TIMESTAMP:images/circle.png // :/images/subdir/triangle.png 0x0,0x0,0x0,0x58,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x1,0xb, +TIMESTAMP:images/subdir/triangle.png }; @@ -120,7 +126,7 @@ int QT_RCC_MANGLE_NAMESPACE(qInitResources)(); int QT_RCC_MANGLE_NAMESPACE(qInitResources)() { QT_RCC_PREPEND_NAMESPACE(qRegisterResourceData) - (0x01, qt_resource_struct, qt_resource_name, qt_resource_data); + (0x02, qt_resource_struct, qt_resource_name, qt_resource_data); return 1; } @@ -128,7 +134,7 @@ int QT_RCC_MANGLE_NAMESPACE(qCleanupResources)(); int QT_RCC_MANGLE_NAMESPACE(qCleanupResources)() { QT_RCC_PREPEND_NAMESPACE(qUnregisterResourceData) - (0x01, qt_resource_struct, qt_resource_name, qt_resource_data); + (0x02, qt_resource_struct, qt_resource_name, qt_resource_data); return 1; } diff --git a/tests/auto/tools/rcc/tst_rcc.cpp b/tests/auto/tools/rcc/tst_rcc.cpp index 8d95d06e30..54a2854ede 100644 --- a/tests/auto/tools/rcc/tst_rcc.cpp +++ b/tests/auto/tools/rcc/tst_rcc.cpp @@ -92,12 +92,23 @@ static QString doCompare(const QStringList &actual, const QStringList &expected) QByteArray ba; for (int i = 0, n = expected.size(); i != n; ++i) { - if (expected.at(i).startsWith("IGNORE:")) + QString expectedLine = expected.at(i); + if (expectedLine.startsWith("IGNORE:")) continue; - if (expected.at(i) != actual.at(i)) { + if (expectedLine.startsWith("TIMESTAMP:")) { + const QString relativePath = expectedLine.mid(strlen("TIMESTAMP:")); + const quint64 timeStamp = QFileInfo(relativePath).lastModified().toMSecsSinceEpoch(); + expectedLine.clear(); + for (int shift = 56; shift >= 0; shift -= 8) { + expectedLine.append(QLatin1String("0x")); + expectedLine.append(QString::number(quint8(timeStamp >> shift), 16)); + expectedLine.append(QLatin1Char(',')); + } + } + if (expectedLine != actual.at(i)) { qDebug() << "LINES" << i << "DIFFER"; ba.append( - "\n<<<<<< actual\n" + actual.at(i) + "\n======\n" + expected.at(i) + "\n<<<<<< actual\n" + actual.at(i) + "\n======\n" + expectedLine + "\n>>>>>> expected\n" ); } |