summaryrefslogtreecommitdiff
path: root/tests/auto/profilewriter
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-03-02 14:49:21 +0100
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-03-07 22:11:26 +0100
commit846e4d3d1cbb07afe9be988f2b144edd4b6b1a99 (patch)
tree9027fc37b67765e2e4c9d61f75e8b52107c857db /tests/auto/profilewriter
parent2d8967d039e0ef0ae269bc653afe445d560c8e92 (diff)
downloadqt-creator-846e4d3d1cbb07afe9be988f2b144edd4b6b1a99.tar.gz
fix ProWriter test
finally ...
Diffstat (limited to 'tests/auto/profilewriter')
-rw-r--r--tests/auto/profilewriter/profilewriter.pro1
-rw-r--r--tests/auto/profilewriter/tst_profilewriter.cpp37
2 files changed, 28 insertions, 10 deletions
diff --git a/tests/auto/profilewriter/profilewriter.pro b/tests/auto/profilewriter/profilewriter.pro
index 9a2a551c8a..8785bc7331 100644
--- a/tests/auto/profilewriter/profilewriter.pro
+++ b/tests/auto/profilewriter/profilewriter.pro
@@ -1,3 +1,4 @@
+include(../qttest.pri)
include(../../../src/shared/proparser/proparser.pri)
SOURCES += \
diff --git a/tests/auto/profilewriter/tst_profilewriter.cpp b/tests/auto/profilewriter/tst_profilewriter.cpp
index 0ac3a5acc6..1656727ae5 100644
--- a/tests/auto/profilewriter/tst_profilewriter.cpp
+++ b/tests/auto/profilewriter/tst_profilewriter.cpp
@@ -31,14 +31,33 @@
**
**************************************************************************/
-#include "profileevaluator.h"
-#include "prowriter.h"
+#include <profileparser.h>
+#include <prowriter.h>
#include <QtTest/QtTest>
-//#include <QtCore/QSet>
#define BASE_DIR "/some/stuff"
+///////////// callbacks for parser/evaluator
+
+static void print(const QString &fileName, int lineNo, const QString &msg)
+{
+ if (lineNo)
+ qWarning("%s(%d): %s", qPrintable(fileName), lineNo, qPrintable(msg));
+ else
+ qWarning("%s", qPrintable(msg));
+}
+
+class ParseHandler : public ProFileParserHandler {
+public:
+ virtual void parseError(const QString &fileName, int lineNo, const QString &msg)
+ { print(fileName, lineNo, msg); }
+};
+
+static ParseHandler parseHandler;
+
+//////////////// the actual autotest
+
class tst_ProFileWriter : public QObject
{
Q_OBJECT
@@ -259,12 +278,11 @@ void tst_ProFileWriter::edit()
QStringList lines = input.split(QLatin1String("\n"));
QStringList vars; vars << QLatin1String("SOURCES");
- ProFileOption option;
- ProFileEvaluator reader(&option);
- ProFile *proFile = reader.parsedProFile(BASE_DIR "/test.pro", input);
+ ProFileParser parser(0, &parseHandler);
+ ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
QVERIFY(proFile);
if (add)
- Qt4ProjectManager::Internal::ProWriter::addFiles(proFile, &lines, baseDir, files, vars);
+ Qt4ProjectManager::Internal::ProWriter::addFiles(proFile, &lines, baseDir, files, vars.at(0));
else
Qt4ProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, baseDir, files, vars);
@@ -290,9 +308,8 @@ void tst_ProFileWriter::multiVar()
<< QString::fromLatin1(BASE_DIR "/bak");
QStringList vars; vars << QLatin1String("SOURCES") << QLatin1String("HEADERS");
- ProFileOption option;
- ProFileEvaluator reader(&option);
- ProFile *proFile = reader.parsedProFile(BASE_DIR "/test.pro", input);
+ ProFileParser parser(0, &parseHandler);
+ ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
QVERIFY(proFile);
Qt4ProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, baseDir, files, vars);