From c51b66d0b1b7bda35ffdaa0ad55f8f438e48a0ef Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Fri, 10 Jun 2011 14:13:41 +0300 Subject: [PATCH] GUITESTS: Move XML V2 tests to own project. --- gui/test/test.pro | 3 ++- gui/test/{ => xmlreportv2}/testxmlreportv2.cpp | 11 +++++++---- gui/test/{ => xmlreportv2}/testxmlreportv2.h | 2 +- gui/test/xmlreportv2/xmlreportv2.pro | 13 +++++++++++++ 4 files changed, 23 insertions(+), 6 deletions(-) rename gui/test/{ => xmlreportv2}/testxmlreportv2.cpp (86%) rename gui/test/{ => xmlreportv2}/testxmlreportv2.h (92%) create mode 100644 gui/test/xmlreportv2/xmlreportv2.pro diff --git a/gui/test/test.pro b/gui/test/test.pro index 42a0db3f9..2939b5ade 100644 --- a/gui/test/test.pro +++ b/gui/test/test.pro @@ -3,4 +3,5 @@ TEMPLATE = subdirs SUBDIRS = translationhandler \ xmlreport \ - xmlreportv1 + xmlreportv1 \ + xmlreportv2 diff --git a/gui/test/testxmlreportv2.cpp b/gui/test/xmlreportv2/testxmlreportv2.cpp similarity index 86% rename from gui/test/testxmlreportv2.cpp rename to gui/test/xmlreportv2/testxmlreportv2.cpp index 164061852..1bcad6322 100644 --- a/gui/test/testxmlreportv2.cpp +++ b/gui/test/xmlreportv2/testxmlreportv2.cpp @@ -1,6 +1,6 @@ /* * Cppcheck - A tool for static C/C++ code analysis - * Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team. + * Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,10 +21,11 @@ #include "testxmlreportv2.h" #include "xmlreportv2.h" #include "erroritem.h" +#include "errorlogger.h" void TestXmlReportV2::readXml() { - const QString filepath("xmlfiles/xmlreport_v2.xml"); + const QString filepath("../xmlfiles/xmlreport_v2.xml"); XmlReportV2 report(filepath); QVERIFY(report.Open()); QList errors = report.Read(); @@ -37,7 +38,7 @@ void TestXmlReportV2::readXml() QCOMPARE(item.files[0], QString("test.cxx")); QCOMPARE(item.lines[0], (unsigned int)11); QCOMPARE(item.id, QString("unreadVariable")); - QCOMPARE(item.severity, QString("style")); + QCOMPARE(GuiSeverity::toString(item.severity), QString("style")); QCOMPARE(item.summary, QString("Variable 'a' is assigned a value that is never used")); QCOMPARE(item.message, QString("Variable 'a' is assigned a value that is never used")); @@ -50,7 +51,9 @@ void TestXmlReportV2::readXml() QCOMPARE(item2.files[1], QString("test.cxx")); QCOMPARE(item2.lines[1], (unsigned int)16); QCOMPARE(item2.id, QString("mismatchAllocDealloc")); - QCOMPARE(item2.severity, QString("error")); + QCOMPARE(GuiSeverity::toString(item2.severity), QString("error")); QCOMPARE(item2.summary, QString("Mismatching allocation and deallocation: k")); QCOMPARE(item2.message, QString("Mismatching allocation and deallocation: k")); } + +QTEST_MAIN(TestXmlReportV2) diff --git a/gui/test/testxmlreportv2.h b/gui/test/xmlreportv2/testxmlreportv2.h similarity index 92% rename from gui/test/testxmlreportv2.h rename to gui/test/xmlreportv2/testxmlreportv2.h index d3c43f750..bc84bcce2 100644 --- a/gui/test/testxmlreportv2.h +++ b/gui/test/xmlreportv2/testxmlreportv2.h @@ -1,6 +1,6 @@ /* * Cppcheck - A tool for static C/C++ code analysis - * Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team. + * Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/gui/test/xmlreportv2/xmlreportv2.pro b/gui/test/xmlreportv2/xmlreportv2.pro new file mode 100644 index 000000000..82d8ae04d --- /dev/null +++ b/gui/test/xmlreportv2/xmlreportv2.pro @@ -0,0 +1,13 @@ +TEMPLATE = app +TARGET = test-xmlreportv2 +DEPENDPATH += . +INCLUDEPATH += . +OBJECTS_DIR = build +MOC_DIR = build + +include(../common.pri) + +# tests +SOURCES += testxmlreportv2.cpp + +HEADERS += testxmlreportv2.h