From 368f259d5e58e00986dec8ff2c8c41da92ba8751 Mon Sep 17 00:00:00 2001
From: Tobias Hunger <tobias.hunger@nokia.com>
Date: Thu, 30 Jun 2011 13:16:15 +0200
Subject: [PATCH] Fix unit test

Change-Id: Ifb825f44aed8a0df90177a8d75ff6cc579df4d7a
Reviewed-on: http://codereview.qt.nokia.com/951
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
---
 src/plugins/projectexplorer/clangparser.cpp   |  2 --
 src/plugins/projectexplorer/gccparser.cpp     | 20 +++++++++----------
 src/plugins/projectexplorer/gnumakeparser.cpp |  2 +-
 src/plugins/projectexplorer/ldparser.cpp      |  4 +---
 .../projectexplorer/linuxiccparser.cpp        |  4 +---
 src/plugins/projectexplorer/task.cpp          |  5 +++--
 src/plugins/qt4projectmanager/qmakeparser.cpp |  8 +++-----
 .../qt4projectmanager/qt-s60/abldparser.cpp   |  6 ++----
 .../qt4projectmanager/qt-s60/rvctparser.cpp   |  4 +---
 .../qt-s60/s60createpackageparser.cpp         |  2 --
 .../qt4projectmanager/qt-s60/winscwparser.cpp |  6 ++----
 11 files changed, 23 insertions(+), 40 deletions(-)

diff --git a/src/plugins/projectexplorer/clangparser.cpp b/src/plugins/projectexplorer/clangparser.cpp
index 577943fabf7..f89a374baa7 100644
--- a/src/plugins/projectexplorer/clangparser.cpp
+++ b/src/plugins/projectexplorer/clangparser.cpp
@@ -35,8 +35,6 @@
 #include "taskwindow.h"
 #include "projectexplorerconstants.h"
 
-#include <QtCore/QDir>
-
 using namespace ProjectExplorer;
 
 namespace {
diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp
index 845bb58c6f0..9efca403d58 100644
--- a/src/plugins/projectexplorer/gccparser.cpp
+++ b/src/plugins/projectexplorer/gccparser.cpp
@@ -35,8 +35,6 @@
 #include "taskwindow.h"
 #include "projectexplorerconstants.h"
 
-#include <QtCore/QDir>
-
 using namespace ProjectExplorer;
 
 namespace {
@@ -105,7 +103,7 @@ void GccParser::stdError(const QString &line)
         int lineno = m_regExp.cap(3).toInt();
         Task task(Task::Unknown,
                   m_regExp.cap(8) /* description */,
-                  QDir::fromNativeSeparators(filename), lineno,
+                  filename, lineno,
                   Constants::TASK_CATEGORY_COMPILE);
         if (m_regExp.cap(7) == QLatin1String("warning"))
             task.type = Task::Warning;
@@ -123,7 +121,7 @@ void GccParser::stdError(const QString &line)
     } else if (m_regExpIncluded.indexIn(lne) > -1) {
         emit addTask(Task(Task::Unknown,
                           lne /* description */,
-                          QDir::fromNativeSeparators(m_regExpIncluded.cap(1)) /* filename */,
+                          m_regExpIncluded.cap(1) /* filename */,
                           m_regExpIncluded.cap(3).toInt() /* linenumber */,
                           Constants::TASK_CATEGORY_COMPILE));
         return;
@@ -207,7 +205,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
             << QString() << QString()
             << (QList<ProjectExplorer::Task>() << Task(Task::Error,
                                                        QLatin1String("#error Symbian error"),
-                                                       QLatin1String("C:/temp/test/untitled8/main.cpp"), 7,
+                                                       QLatin1String("C:\\temp\\test\\untitled8\\main.cpp"), 7,
                                                        Constants::TASK_CATEGORY_COMPILE))
             << QString();
     // Symbian reports #warning(s) twice (using different syntax).
@@ -217,7 +215,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
             << QString() << QString()
             << (QList<ProjectExplorer::Task>() << Task(Task::Warning,
                                                        QLatin1String("#warning Symbian warning"),
-                                                       QLatin1String("C:/temp/test/untitled8/main.cpp"), 8,
+                                                       QLatin1String("C:\\temp\\test\\untitled8\\main.cpp"), 8,
                                                        Constants::TASK_CATEGORY_COMPILE))
             << QString();
     QTest::newRow("GCCE #warning2")
@@ -242,7 +240,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
                         Constants::TASK_CATEGORY_COMPILE)
                 << Task(Task::Error,
                         QLatin1String("undefined reference to `MainWindow::doSomething()'"),
-                        QLatin1String("C:/temp/test/untitled8/main.cpp"), 8,
+                        QLatin1String("C:\\temp\\test\\untitled8/main.cpp"), 8,
                         Constants::TASK_CATEGORY_COMPILE)
                 << Task(Task::Error,
                         QLatin1String("collect2: ld returned 1 exit status"),
@@ -263,7 +261,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
                         Constants::TASK_CATEGORY_COMPILE)
                 << Task(Task::Error,
                         QLatin1String("undefined reference to `MainWindow::doSomething()'"),
-                        QLatin1String("C:/temp/test/untitled8/main.cpp"), -1,
+                        QLatin1String("C:\\temp\\test\\untitled8/main.cpp"), -1,
                         Constants::TASK_CATEGORY_COMPILE)
                 << Task(Task::Error,
                         QLatin1String("collect2: ld returned 1 exit status"),
@@ -278,7 +276,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
             << (QList<ProjectExplorer::Task>()
                 << Task(Task::Error,
                         QLatin1String("file not recognized: File format not recognized"),
-                        QLatin1String("c:/Qt/4.6/lib/QtGuid4.dll"), -1,
+                        QLatin1String("c:\\Qt\\4.6\\lib/QtGuid4.dll"), -1,
                         Constants::TASK_CATEGORY_COMPILE))
             << QString();
     QTest::newRow("Invalid rpath")
@@ -510,11 +508,11 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
                         Constants::TASK_CATEGORY_COMPILE)
                 << Task(Task::Error,
                         QLatin1String("undefined reference to `vtable for QPlotAxis'"),
-                        QLatin1String("M:/Development/x64/QtPlot/qplotaxis.cpp"), 26,
+                        QLatin1String("M:\\Development\\x64\\QtPlot/qplotaxis.cpp"), 26,
                         Constants::TASK_CATEGORY_COMPILE)
                 << Task(Task::Error,
                         QLatin1String("undefined reference to `vtable for QPlotAxis'"),
-                        QLatin1String("M:/Development/x64/QtPlot/qplotaxis.cpp"), 26,
+                        QLatin1String("M:\\Development\\x64\\QtPlot/qplotaxis.cpp"), 26,
                         Constants::TASK_CATEGORY_COMPILE)
                 << Task(Task::Error,
                         QLatin1String("collect2: ld returned 1 exit status"),
diff --git a/src/plugins/projectexplorer/gnumakeparser.cpp b/src/plugins/projectexplorer/gnumakeparser.cpp
index 6d01af617f3..ca810541279 100644
--- a/src/plugins/projectexplorer/gnumakeparser.cpp
+++ b/src/plugins/projectexplorer/gnumakeparser.cpp
@@ -95,7 +95,7 @@ void GnuMakeParser::stdError(const QString &line)
             m_suppressIssues = true;
             addTask(Task(Task::Error,
                          m_makefileError.cap(3),
-                         QDir::fromNativeSeparators(m_makefileError.cap(1)),
+                         m_makefileError.cap(1),
                          m_makefileError.cap(2).toInt(),
                          Constants::TASK_CATEGORY_BUILDSYSTEM));
         }
diff --git a/src/plugins/projectexplorer/ldparser.cpp b/src/plugins/projectexplorer/ldparser.cpp
index a1d7980ca0d..a3272b0f16a 100644
--- a/src/plugins/projectexplorer/ldparser.cpp
+++ b/src/plugins/projectexplorer/ldparser.cpp
@@ -34,8 +34,6 @@
 #include "projectexplorerconstants.h"
 #include "taskwindow.h"
 
-#include <QtCore/QDir>
-
 using namespace ProjectExplorer;
 
 namespace {
@@ -103,7 +101,7 @@ void LdParser::stdError(const QString &line)
             && !m_regExpLinker.cap(4).startsWith(QLatin1String("(.text+0x")))
             filename = m_regExpLinker.cap(4);
         QString description = m_regExpLinker.cap(8).trimmed();
-        Task task(Task::Error, description, QDir::fromNativeSeparators(filename), lineno,
+        Task task(Task::Error, description, filename, lineno,
                   Constants::TASK_CATEGORY_COMPILE);
         if (m_regExpInFunction.indexIn(description) > -1 ||
             description.startsWith(QLatin1String("At global scope")) ||
diff --git a/src/plugins/projectexplorer/linuxiccparser.cpp b/src/plugins/projectexplorer/linuxiccparser.cpp
index 074eaf4352f..d29d2f76ad0 100644
--- a/src/plugins/projectexplorer/linuxiccparser.cpp
+++ b/src/plugins/projectexplorer/linuxiccparser.cpp
@@ -35,8 +35,6 @@
 #include "taskwindow.h"
 #include "projectexplorerconstants.h"
 
-#include <QtCore/QDir>
-
 using namespace ProjectExplorer;
 
 LinuxIccParser::LinuxIccParser()
@@ -75,7 +73,7 @@ void LinuxIccParser::stdError(const QString &line)
     if (m_expectFirstLine  && m_firstLine.indexIn(line) != -1) {
         // Clear out old task
         m_temporary = ProjectExplorer::Task(Task::Unknown, m_firstLine.cap(6).trimmed(),
-                                            QDir::fromNativeSeparators(m_firstLine.cap(1)),
+                                            m_firstLine.cap(1),
                                             m_firstLine.cap(2).toInt(),
                                             QLatin1String(Constants::TASK_CATEGORY_COMPILE));
         QString category = m_firstLine.cap(4);
diff --git a/src/plugins/projectexplorer/task.cpp b/src/plugins/projectexplorer/task.cpp
index a1571b91b8a..24e3bf56eba 100644
--- a/src/plugins/projectexplorer/task.cpp
+++ b/src/plugins/projectexplorer/task.cpp
@@ -32,6 +32,8 @@
 
 #include "task.h"
 
+#include <QtCore/QDir>
+
 namespace ProjectExplorer
 {
 
@@ -48,8 +50,7 @@ Task::Task() : taskId(0), type(Unknown), line(-1)
 
 Task::Task(TaskType type_, const QString &description_,
            const QString &file_, int line_, const QString &category_) :
-    taskId(s_nextId), type(type_), description(description_), file(file_),
-    line(line_), category(category_)
+    taskId(s_nextId), type(type_), description(description_), file(QDir::fromNativeSeparators(file_)), line(line_), category(category_)
 {
     ++s_nextId;
 }
diff --git a/src/plugins/qt4projectmanager/qmakeparser.cpp b/src/plugins/qt4projectmanager/qmakeparser.cpp
index 19d8e7332de..dfc25145470 100644
--- a/src/plugins/qt4projectmanager/qmakeparser.cpp
+++ b/src/plugins/qt4projectmanager/qmakeparser.cpp
@@ -37,8 +37,6 @@
 #include <projectexplorer/projectexplorerconstants.h>
 #include <utils/qtcassert.h>
 
-#include <QtCore/QDir>
-
 using namespace Qt4ProjectManager;
 using namespace Qt4ProjectManager::Internal;
 using ProjectExplorer::Task;
@@ -73,7 +71,7 @@ void QMakeParser::stdError(const QString &line)
         return;
     }
     if (m_error.indexIn(lne) > -1) {
-        QString fileName = QDir::fromNativeSeparators(m_error.cap(1));
+        QString fileName = m_error.cap(1);
         Task::TaskType type = Task::Error;
         if (fileName.startsWith("WARNING: ")) {
             type = Task::Warning;
@@ -143,7 +141,7 @@ void Qt4ProjectManagerPlugin::testQmakeOutputParsers_data()
             << (QList<ProjectExplorer::Task>()
                 << Task(Task::Error,
                         QLatin1String("Parse Error ('sth odd')"),
-                        QDir::fromNativeSeparators(QLatin1String("e:\\project.pro")),
+                        QLatin1String("e:\\project.pro"),
                         14,
                         ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))
             << QString();
@@ -166,7 +164,7 @@ void Qt4ProjectManagerPlugin::testQmakeOutputParsers_data()
             << (QList<ProjectExplorer::Task>()
                 << Task(Task::Warning,
                         QLatin1String("Unescaped backslashes are deprecated."),
-                        QLatin1String("e:/NokiaQtSDK/Simulator/Qt/msvc2008/lib/qtmaind.prl"), 1,
+                        QLatin1String("e:\\NokiaQtSDK\\Simulator\\Qt\\msvc2008\\lib\\qtmaind.prl"), 1,
                         ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))
             << QString();
 }
diff --git a/src/plugins/qt4projectmanager/qt-s60/abldparser.cpp b/src/plugins/qt4projectmanager/qt-s60/abldparser.cpp
index c54786eec27..504ac652008 100644
--- a/src/plugins/qt4projectmanager/qt-s60/abldparser.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/abldparser.cpp
@@ -35,8 +35,6 @@
 #include <projectexplorer/projectexplorerconstants.h>
 #include <projectexplorer/taskwindow.h>
 
-#include <QtCore/QDir>
-
 using namespace Qt4ProjectManager;
 using namespace ProjectExplorer;
 using namespace ProjectExplorer::Constants;
@@ -78,7 +76,7 @@ void AbldParser::stdOutput(const QString &line)
 
     if (m_perlIssue.indexIn(lne) > -1) {
         m_waitingForStdOutContinuation = true;
-        m_currentFile = QDir::fromNativeSeparators(m_perlIssue.cap(2));
+        m_currentFile = m_perlIssue.cap(2);
         m_currentLine = m_perlIssue.cap(3).toInt();
 
         Task task(Task::Unknown,
@@ -148,7 +146,7 @@ void AbldParser::stdError(const QString &line)
     }
 
     if (lne.startsWith(QLatin1String("MMPFILE \""))) {
-        m_currentFile = QDir::fromNativeSeparators(lne.mid(9, lne.size() - 10));
+        m_currentFile = lne.mid(9, lne.size() - 10);
         m_waitingForStdErrContinuation = false;
         return;
     }
diff --git a/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp b/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp
index 54b1e4ecfb6..c783b4abc2a 100644
--- a/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp
@@ -34,8 +34,6 @@
 #include <projectexplorer/projectexplorerconstants.h>
 #include <projectexplorer/taskwindow.h>
 
-#include <QtCore/QDir>
-
 using namespace ProjectExplorer;
 using namespace ProjectExplorer::Constants;
 using namespace Qt4ProjectManager;
@@ -85,7 +83,7 @@ void RvctParser::stdError(const QString &line)
 
        m_task = new Task(Task::Unknown,
                          m_warningOrError.cap(5) /* description */,
-                         QDir::fromNativeSeparators(m_warningOrError.cap(1)) /* file */,
+                         m_warningOrError.cap(1) /* file */,
                          m_warningOrError.cap(2).toInt() /* line */,
                          TASK_CATEGORY_COMPILE);
        if (m_warningOrError.cap(4) == "Warning")
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60createpackageparser.cpp b/src/plugins/qt4projectmanager/qt-s60/s60createpackageparser.cpp
index 47c52dedba8..5dfea8114eb 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60createpackageparser.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60createpackageparser.cpp
@@ -35,8 +35,6 @@
 #include <projectexplorer/projectexplorerconstants.h>
 #include <projectexplorer/taskwindow.h>
 
-#include <QtCore/QDebug>
-
 using namespace Qt4ProjectManager::Internal;
 
 S60CreatePackageParser::S60CreatePackageParser(const QString &packageName) :
diff --git a/src/plugins/qt4projectmanager/qt-s60/winscwparser.cpp b/src/plugins/qt4projectmanager/qt-s60/winscwparser.cpp
index 4fa0e50096c..b2f2c8d9624 100644
--- a/src/plugins/qt4projectmanager/qt-s60/winscwparser.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/winscwparser.cpp
@@ -34,8 +34,6 @@
 
 #include <projectexplorer/projectexplorerconstants.h>
 
-#include <QtCore/QDir>
-
 using namespace Qt4ProjectManager;
 using namespace ProjectExplorer;
 using namespace ProjectExplorer::Constants;
@@ -59,7 +57,7 @@ void WinscwParser::stdOutput(const QString &line)
     if (m_compilerProblem.indexIn(lne) > -1) {
         Task task(Task::Error,
                   m_compilerProblem.cap(3) /* description */,
-                  QDir::fromNativeSeparators(m_compilerProblem.cap(1)) /* filename */,
+                  m_compilerProblem.cap(1) /* filename */,
                   m_compilerProblem.cap(2).toInt() /* linenumber */,
                   TASK_CATEGORY_COMPILE);
         if (task.description.startsWith(QLatin1String("warning: "))) {
@@ -79,7 +77,7 @@ void WinscwParser::stdError(const QString &line)
     if (m_linkerProblem.indexIn(lne) > -1) {
         emit addTask(Task(Task::Error,
                           m_linkerProblem.cap(2) /* description */,
-                          QDir::fromNativeSeparators(m_linkerProblem.cap(1)) /* filename */,
+                          m_linkerProblem.cap(1) /* filename */,
                           -1 /* linenumber */,
                           TASK_CATEGORY_COMPILE));
         return;
-- 
GitLab