summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-29 11:29:07 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-29 11:29:07 +0200
commit3b1da8a7754b37d5767aeb55a7ca46e4180a6109 (patch)
tree6748bf907f7751375379318bab45cf1fb8deb107 /tests
parent2b062a567c5ab282ce663ac5edf03b2cb56265ce (diff)
parent0731b64ee6d3439e6ddfa3ee58a7e909b170ebb0 (diff)
downloadqttools-3b1da8a7754b37d5767aeb55a7ca46e4180a6109.tar.gz
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/assistant/assistant/doc/src/assistant-manual.qdoc Change-Id: I136caf5f26eff4d1c2574459b8dff9937c2c372d
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 3b601adbb..da7e03779 100644
--- a/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp
+++ b/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp
@@ -41,6 +41,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();
@@ -192,6 +194,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)