diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-09-29 04:16:27 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-09-29 04:16:27 (GMT) |
commit | f7a439a0a00b0bdd6ebeff8bfd5ee2285eab1398 (patch) | |
tree | 5591c18c07cb2cbca6d9a23f305f626f2633f624 /tests | |
parent | 1ab457d5db184c53d9857a7b425051e5aa5ff2e0 (diff) | |
download | Qt-f7a439a0a00b0bdd6ebeff8bfd5ee2285eab1398.zip Qt-f7a439a0a00b0bdd6ebeff8bfd5ee2285eab1398.tar.gz Qt-f7a439a0a00b0bdd6ebeff8bfd5ee2285eab1398.tar.bz2 |
Autotest that new "import Qt 4.7"s aren't added accidentally
Task-number: QTBUG-13799
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/moduleqt47/tst_moduleqt47.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/auto/declarative/moduleqt47/tst_moduleqt47.cpp b/tests/auto/declarative/moduleqt47/tst_moduleqt47.cpp index c1896a7..feae417 100644 --- a/tests/auto/declarative/moduleqt47/tst_moduleqt47.cpp +++ b/tests/auto/declarative/moduleqt47/tst_moduleqt47.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include <qtest.h> +#include <QDir> #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> @@ -56,12 +57,20 @@ public: private slots: void create(); + void accidentalImport_data(); + void accidentalImport(); + private: + QStringList findFiles(const QDir &d); + QDeclarativeEngine engine; + QStringList excludedFiles; }; tst_moduleqt47::tst_moduleqt47() { + excludedFiles << "tests/auto/declarative/moduleqt47/data/importqt47.qml" + << "doc/src/declarative/whatsnew.qdoc"; } void tst_moduleqt47::create() @@ -74,6 +83,54 @@ void tst_moduleqt47::create() delete obj; } +QStringList tst_moduleqt47::findFiles(const QDir &d) +{ + QStringList rv; + + QStringList files = d.entryList(QStringList() << QLatin1String("*.qml") << QLatin1String("*.qdoc"), QDir::Files); + foreach (const QString &file, files) { + + QString absFile = d.absoluteFilePath(file); + + bool skip = false; + for (int ii = 0; !skip && ii < excludedFiles.count(); ++ii) + skip = (absFile.endsWith(excludedFiles.at(ii))); + + if (!skip) + rv << absFile; + } + + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); + foreach (const QString &dir, dirs) { + QDir sub = d; + sub.cd(dir); + rv << findFiles(sub); + } + + return rv; +} + +void tst_moduleqt47::accidentalImport_data() +{ + QTest::addColumn<QString>("file"); + QStringList files = findFiles(QDir(SRCDIR "/../../../../")); + + foreach(const QString &file, files) + QTest::newRow(qPrintable(file)) << file; +} + +void tst_moduleqt47::accidentalImport() +{ + QFETCH(QString, file); + + QFile f(file); + if (!f.open(QIODevice::ReadOnly)) + return; + QByteArray data = f.readAll(); + + QVERIFY(!data.contains("import Qt 4")); +} + QTEST_MAIN(tst_moduleqt47) #include "tst_moduleqt47.moc" |