Commit c7764f46 authored by Michal Szymanski's avatar Michal Szymanski

Fix timestamp comparison test fail after QT5.11 by Switchng to QDatetime...

Fix timestamp comparison test fail after QT5.11 by Switchng to QDatetime comparison instead of QString. 5.11 variant changed QDateTime toString fromat to ISODateWithMs
parent 8ac8238b
......@@ -129,77 +129,77 @@ void CliRarTest::testList_data()
QTest::addColumn<QString>("symlinkTarget");
QTest::addColumn<qulonglong>("expectedSize");
QTest::addColumn<qulonglong>("expectedCompressedSize");
QTest::addColumn<QString>("expectedTimestamp");
QTest::addColumn<QDateTime>("expectedTimestamp");
// Unrar 5 tests
QTest::newRow("normal-file-unrar5")
<< QFINDTESTDATA("data/archive-with-symlink-unrar5.txt") << QString() << 8 << false << 0 << QStringList{QStringLiteral("RAR4")}
<< 2 << QStringLiteral("rartest/file2.txt") << false << false << QString() << (qulonglong) 14 << (qulonglong) 23 << QStringLiteral("2016-03-21T08:57:36");
<< 2 << QStringLiteral("rartest/file2.txt") << false << false << QString() << (qulonglong) 14 << (qulonglong) 23 << QDateTime::fromString(QStringLiteral("2016-03-21T08:57:36"),Qt::ISODateWithMs);
QTest::newRow("symlink-unrar5")
<< QFINDTESTDATA("data/archive-with-symlink-unrar5.txt") << QString() << 8 << false << 0 << QStringList{QStringLiteral("RAR4")}
<< 3 << QStringLiteral("rartest/linktofile1.txt") << false << false << QStringLiteral("file1.txt") << (qulonglong) 9 << (qulonglong) 9 << QStringLiteral("2016-03-21T08:58:16");
<< 3 << QStringLiteral("rartest/linktofile1.txt") << false << false << QStringLiteral("file1.txt") << (qulonglong) 9 << (qulonglong) 9 << QDateTime::fromString(QStringLiteral("2016-03-21T08:58:16"),Qt::ISODateWithMs);
QTest::newRow("encrypted-unrar5")
<< QFINDTESTDATA("data/archive-encrypted-unrar5.txt") << QString() << 7 << false << 0 << QStringList{QStringLiteral("RAR4")}
<< 2 << QStringLiteral("rartest/file2.txt") << false << true << QString() << (qulonglong) 14 << (qulonglong) 32 << QStringLiteral("2016-03-21T17:03:36");
<< 2 << QStringLiteral("rartest/file2.txt") << false << true << QString() << (qulonglong) 14 << (qulonglong) 32 << QDateTime::fromString(QStringLiteral("2016-03-21T17:03:36"),Qt::ISODateWithMs);
QTest::newRow("recovery-record-unrar5")
<< QFINDTESTDATA("data/archive-recovery-record-unrar5.txt") << QString() << 3 << false << 0 << QStringList{QStringLiteral("RAR4")}
<< 0 << QStringLiteral("file1.txt") << false << false << QString() << (qulonglong) 32 << (qulonglong) 33 << QStringLiteral("2015-07-26T19:04:38");
<< 0 << QStringLiteral("file1.txt") << false << false << QString() << (qulonglong) 32 << (qulonglong) 33 << QDateTime::fromString(QStringLiteral("2015-07-26T19:04:38"),Qt::ISODateWithMs);
QTest::newRow("corrupt-archive-unrar5")
<< QFINDTESTDATA("data/archive-corrupt-file-header-unrar5.txt") << QString() << 8 << false << 0 << QStringList{QStringLiteral("RAR4")}
<< 6 << QStringLiteral("dir1/") << true << false << QString() << (qulonglong) 0 << (qulonglong) 0 << QStringLiteral("2015-05-14T01:45:24");
<< 6 << QStringLiteral("dir1/") << true << false << QString() << (qulonglong) 0 << (qulonglong) 0 << QDateTime::fromString(QStringLiteral("2015-05-14T01:45:24"),Qt::ISODateWithMs);
//Note: The number of entries will be the total number of all entries in all volumes, i.e. if a file spans 3 volumes it will count as 3 entries.
QTest::newRow("multivolume-archive-unrar5")
<< QFINDTESTDATA("data/archive-multivol-unrar5.txt") << QString() << 6 << true << 5 << QStringList{QStringLiteral("RAR4")}
<< 5 << QStringLiteral("largefile2") << false << false << QString() << (qulonglong) 2097152 << (qulonglong) 11231 << QStringLiteral("2016-07-17T11:26:19");
<< 5 << QStringLiteral("largefile2") << false << false << QString() << (qulonglong) 2097152 << (qulonglong) 11231 << QDateTime::fromString(QStringLiteral("2016-07-17T11:26:19"),Qt::ISODateWithMs);
QTest::newRow("RAR5-open-with-unrar5")
<< QFINDTESTDATA("data/archive-RARv5-unrar5.txt") << QString() << 9 << false << 0 << QStringList{QStringLiteral("RAR5")}
<< 4 << QStringLiteral("testarchive/dir1/file1.txt") << false << false << QString() << (qulonglong) 32 << (qulonglong) 32 << QStringLiteral("2015-05-17T20:41:48");
<< 4 << QStringLiteral("testarchive/dir1/file1.txt") << false << false << QString() << (qulonglong) 32 << (qulonglong) 32 << QDateTime::fromString(QStringLiteral("2015-05-17T20:41:48"),Qt::ISODateWithMs);
// Unrar 4 tests
QTest::newRow("normal-file-unrar4")
<< QFINDTESTDATA("data/archive-with-symlink-unrar4.txt") << QString() << 8 << false << 0 << QStringList{QStringLiteral("RAR4")}
<< 2 << QStringLiteral("rartest/file2.txt") << false << false << QString() << (qulonglong) 14 << (qulonglong) 23 << QStringLiteral("2016-03-21T08:57:00");
<< 2 << QStringLiteral("rartest/file2.txt") << false << false << QString() << (qulonglong) 14 << (qulonglong) 23 << QDateTime::fromString(QStringLiteral("2016-03-21T08:57:00"),Qt::ISODateWithMs);
QTest::newRow("symlink-unrar4")
<< QFINDTESTDATA("data/archive-with-symlink-unrar4.txt") << QString() << 8 << false << 0 << QStringList{QStringLiteral("RAR4")}
<< 3 << QStringLiteral("rartest/linktofile1.txt") << false << false << QStringLiteral("file1.txt") << (qulonglong) 9 << (qulonglong) 9 << QStringLiteral("2016-03-21T08:58:00");
<< 3 << QStringLiteral("rartest/linktofile1.txt") << false << false << QStringLiteral("file1.txt") << (qulonglong) 9 << (qulonglong) 9 << QDateTime::fromString(QStringLiteral("2016-03-21T08:58:00"),Qt::ISODateWithMs);
QTest::newRow("encrypted-unrar4")
<< QFINDTESTDATA("data/archive-encrypted-unrar4.txt") << QString() << 7 << false << 0 << QStringList{QStringLiteral("RAR4")}
<< 2 << QStringLiteral("rartest/file2.txt") << false << true << QString() << (qulonglong) 14 << (qulonglong) 32 << QStringLiteral("2016-03-21T17:03:00");
<< 2 << QStringLiteral("rartest/file2.txt") << false << true << QString() << (qulonglong) 14 << (qulonglong) 32 << QDateTime::fromString(QStringLiteral("2016-03-21T17:03:00"),Qt::ISODateWithMs);
QTest::newRow("recovery-record-unrar4")
<< QFINDTESTDATA("data/archive-recovery-record-unrar4.txt") << QString() << 3 << false << 0 << QStringList{QStringLiteral("RAR4")}
<< 0 << QStringLiteral("file1.txt") << false << false << QString() << (qulonglong) 32 << (qulonglong) 33 << QStringLiteral("2015-07-26T19:04:00");
<< 0 << QStringLiteral("file1.txt") << false << false << QString() << (qulonglong) 32 << (qulonglong) 33 << QDateTime::fromString(QStringLiteral("2015-07-26T19:04:00"),Qt::ISODateWithMs);
QTest::newRow("corrupt-archive-unrar4")
<< QFINDTESTDATA("data/archive-corrupt-file-header-unrar4.txt") << QString() << 8 << false << 0 << QStringList{QStringLiteral("RAR4")}
<< 6 << QStringLiteral("dir1/") << true << false << QString() << (qulonglong) 0 << (qulonglong) 0 << QStringLiteral("2015-05-14T01:45:00");
<< 6 << QStringLiteral("dir1/") << true << false << QString() << (qulonglong) 0 << (qulonglong) 0 << QDateTime::fromString(QStringLiteral("2015-05-14T01:45:00"),Qt::ISODateWithMs);
QTest::newRow("RAR5-open-with-unrar4")
<< QFINDTESTDATA("data/archive-RARv5-unrar4.txt")
<< QStringLiteral("Your unrar executable is version 4.20, which is too old to handle this archive. Please update to a more recent version.")
<< 0 << false << 0 << QStringList() << 0 << QString() << true << false << QString() << (qulonglong) 0 << (qulonglong) 0 << QString();
<< 0 << false << 0 << QStringList() << 0 << QString() << true << false << QString() << (qulonglong) 0 << (qulonglong) 0 << QDateTime::currentDateTime();
//Note: The number of entries will be the total number of all entries in all volumes, i.e. if a file spans 3 volumes it will count as 3 entries.
QTest::newRow("multivolume-archive-unrar4")
<< QFINDTESTDATA("data/archive-multivol-unrar4.txt") << QString() << 6 << true << 5 << QStringList{QStringLiteral("RAR4")}
<< 5 << QStringLiteral("largefile2") << false << false << QString() << (qulonglong) 2097152 << (qulonglong) 11231 << QStringLiteral("2016-07-17T11:26:00");
<< 5 << QStringLiteral("largefile2") << false << false << QString() << (qulonglong) 2097152 << (qulonglong) 11231 << QDateTime::fromString(QStringLiteral("2016-07-17T11:26:00"),Qt::ISODateWithMs);
// Unrar 3 tests
QTest::newRow("RAR5-open-with-unrar3")
<< QFINDTESTDATA("data/archive-RARv5-unrar3.txt")
<< QStringLiteral("Unrar reported a non-RAR archive. The installed unrar version (3.71) is old. Try updating your unrar.")
<< 0 << false << 0 << QStringList() << 0 << QString() << true << false << QString() << (qulonglong) 0 << (qulonglong) 0 << QString();
<< 0 << false << 0 << QStringList() << 0 << QString() << true << false << QString() << (qulonglong) 0 << (qulonglong) 0 << QDateTime::currentDateTime();
/*
* Check that the plugin will not crash when reading corrupted archives, which
......@@ -210,7 +210,7 @@ void CliRarTest::testList_data()
*/
QTest::newRow("corrupt-archive-unrar3")
<< QFINDTESTDATA("data/archive-corrupt-file-header-unrar3.txt") << QString() << 1 << true << 1 << QStringList{QStringLiteral("RAR4")}
<< 0 << QStringLiteral("some-file.ext") << false << false << QString() << (qulonglong) 732522496 << (qulonglong) 14851208 << QStringLiteral("2010-10-29T20:47:00");
<< 0 << QStringLiteral("some-file.ext") << false << false << QString() << (qulonglong) 732522496 << (qulonglong) 14851208 << QDateTime::fromString(QStringLiteral("2010-10-29T20:47:00"),Qt::ISODateWithMs);
}
void CliRarTest::testList()
......@@ -279,11 +279,9 @@ void CliRarTest::testList()
QFETCH(qulonglong, expectedCompressedSize);
QCOMPARE(entry->property("compressedSize").toULongLong(), expectedCompressedSize);
QFETCH(QString, expectedTimestamp);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QEXPECT_FAIL("", "Something changed since Qt 5.11, needs investigation.", Continue);
#endif
QCOMPARE(entry->property("timestamp").toString(), expectedTimestamp);
QFETCH(QDateTime, expectedTimestamp);
QCOMPARE(entry->property("timestamp"), expectedTimestamp);
rarPlugin->deleteLater();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment