diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-02-22 09:19:12 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-02-22 09:19:12 (GMT) |
commit | dab883be81f6037361e5c870d957686961515f4e (patch) | |
tree | 1aa67b8652108c74467da9e4bea411c15d85745c /tests/auto/headers | |
parent | f25f7a2a19ba4c21b7a5d9fee02a9ae71c9f60ef (diff) | |
parent | 9462e7966b5b7db20249c9cb077f425c631afebf (diff) | |
download | Qt-dab883be81f6037361e5c870d957686961515f4e.zip Qt-dab883be81f6037361e5c870d957686961515f4e.tar.gz Qt-dab883be81f6037361e5c870d957686961515f4e.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2
Diffstat (limited to 'tests/auto/headers')
-rw-r--r-- | tests/auto/headers/tst_headers.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp index 5f79923..3745767 100644 --- a/tests/auto/headers/tst_headers.cpp +++ b/tests/auto/headers/tst_headers.cpp @@ -65,6 +65,7 @@ private: const QRegExp &exclude); static QStringList getHeaders(const QString &path); static QStringList getSourceFiles(const QString &path); + static QStringList getQDocFiles(const QString &path); void allSourceFilesData(); void allHeadersData(); @@ -111,6 +112,11 @@ QStringList tst_Headers::getSourceFiles(const QString &path) return getFiles(path, QStringList("*.cpp"), QRegExp("^(?!(moc_|qrc_))")); } +QStringList tst_Headers::getQDocFiles(const QString &path) +{ + return getFiles(path, QStringList("*.qdoc"), QRegExp(".")); +} + void tst_Headers::initTestCase() { qtSrcDir = QString::fromLocal8Bit(qgetenv("QTSRCDIR").isEmpty() @@ -149,6 +155,7 @@ void tst_Headers::allSourceFilesData() for (int i = 0; i < sizeof(subdirs) / sizeof(subdirs[0]); ++i) { sourceFiles << getSourceFiles(qtSrcDir + subdirs[i]); sourceFiles << getHeaders(qtSrcDir + subdirs[i]); + sourceFiles << getQDocFiles(qtSrcDir + subdirs[i]); } foreach (QString sourceFile, sourceFiles) { @@ -192,22 +199,28 @@ void tst_Headers::licenseCheck() QByteArray data = f.readAll(); data.replace("\r\n", "\n"); // Windows data.replace('\r', '\n'); // Mac OS9 - QStringList content = QString::fromLocal8Bit(data).split("\n"); + QStringList content = QString::fromLocal8Bit(data).split("\n", QString::SkipEmptyParts); + + if (content.count() <= 2) // likely a #include line and empty line only. Not a copyright issue. + return; if (content.first().contains("generated")) { content.takeFirst(); - if (content.first().isEmpty()) - content.takeFirst(); } if (sourceFile.endsWith("/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp") || sourceFile.endsWith("/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp")) { // These files are meant to start with empty lines. - while (content.first().isEmpty() || content.first().startsWith("//")) + while (content.first().startsWith("//")) content.takeFirst(); } + if (sourceFile.endsWith("/doc/src/classes/phonon-api.qdoc")) { + // This is an external file + return; + } + QVERIFY(licensePattern.exactMatch(content.value(8)) || licensePattern.exactMatch(content.value(5))); QString licenseType = licensePattern.cap(1); |