summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSune Vuorela <sune@vuorela.dk>2016-06-13 20:19:14 +0200
committerSune Vuorela <sune@vuorela.dk>2016-06-14 12:04:40 +0000
commitc477b67636962007e32aa2cbd170a5c2e0e6b899 (patch)
tree1400b024fd2a186729cd343f5ce77dc0e02621e5 /tests
parent2c87670f4783b7d321bbe31c33d2545597e7bd43 (diff)
downloadqttools-c477b67636962007e32aa2cbd170a5c2e0e6b899.tar.gz
Verify that two runs of QHelpGenerator creates same output
Part of ensuring reproducible Qt. No actual code changes here, just a test ensuring things does not break in the future. Change-Id: Ib957aefb4eb80fb949f0094403930769e7e47900 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp b/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp
index d66d087ea..b850c01ed 100644
--- a/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp
+++ b/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp
@@ -46,6 +46,8 @@ class tst_QHelpGenerator : public QObject
private slots:
void initTestCase();
void generateHelp();
+ // Check that two runs of the generator creates the same file twice
+ void generateTwice();
private:
void checkNamespace();
@@ -197,6 +199,37 @@ void tst_QHelpGenerator::checkMetaData()
if (!m_query->next())
QFAIL("Meta Data Error");
QCOMPARE(m_query->value(0).toString(), QString("Digia Plc and/or its subsidiary(-ies)"));
+
+}
+
+void tst_QHelpGenerator::generateTwice()
+{
+ // defined in profile
+ QString path = QLatin1String(SRCDIR);
+
+ QString inputFile(path + "/data/test.qhp");
+ QHelpProjectData data;
+ if (!data.readData(inputFile))
+ QFAIL("Cannot read qhp file!");
+
+ QHelpGenerator generator1;
+ QHelpGenerator generator2;
+ QString outputFile1 = path + QLatin1String("/data/test1.qch");
+ QString outputFile2 = path + QLatin1String("/data/test2.qch");
+ QCOMPARE(generator1.generate(&data, outputFile1), true);
+ QCOMPARE(generator2.generate(&data, outputFile2), true);
+
+ QFile f1(outputFile1);
+ QFile f2(outputFile2);
+ QVERIFY(f1.open(QIODevice::ReadOnly));
+ QVERIFY(f2.open(QIODevice::ReadOnly));
+
+ QByteArray arr1 = f1.readAll();
+ QByteArray arr2 = f2.readAll();
+
+ QFile::remove(outputFile1);
+ QFile::remove(outputFile2);
+ QCOMPARE(arr1, arr2);
}
QTEST_MAIN(tst_QHelpGenerator)