From 6820fc6933697ac9704fb4c645f5fbde6f17c5c8 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Fri, 10 Jun 2011 11:58:55 +0300 Subject: [PATCH] GUITESTS: Refactoring test building. Start building each test as separate project as QtestLib tests usually are built. This commit adds the infrastructure and moves TranslationHandler test as own project. --- gui/test/common.pri | 24 +++++++++++ gui/test/test.pro | 40 ++----------------- .../testtranslationhandler.cpp | 4 +- .../testtranslationhandler.h | 2 +- .../translationhandler/translationhandler.pro | 13 ++++++ 5 files changed, 44 insertions(+), 39 deletions(-) create mode 100644 gui/test/common.pri rename gui/test/{ => translationhandler}/testtranslationhandler.cpp (90%) rename gui/test/{ => translationhandler}/testtranslationhandler.h (92%) create mode 100644 gui/test/translationhandler/translationhandler.pro diff --git a/gui/test/common.pri b/gui/test/common.pri new file mode 100644 index 000000000..64c0d5a78 --- /dev/null +++ b/gui/test/common.pri @@ -0,0 +1,24 @@ +CONFIG += qtestlib +#DEPENDPATH += . .. +INCLUDEPATH += . ../.. ../../../lib + +LIBS += -L../../../externals -lpcre +INCLUDEPATH += ../../externals + +BASEPATH = ../../../lib/ +include($$PWD/../../lib/lib.pri) + +# GUI +SOURCES += ../../erroritem.cpp \ + ../../report.cpp \ + ../../translationhandler.cpp \ + ../../xmlreport.cpp \ + ../../xmlreportv1.cpp \ + ../../xmlreportv2.cpp + +HEADERS += ../../erroritem.h \ + ../../report.h \ + ../../translationhandler.h \ + ../../xmlreport.h \ + ../../xmlreportv1.h \ + ../../xmlreportv2.h diff --git a/gui/test/test.pro b/gui/test/test.pro index 917d4364f..1f35fc5ef 100644 --- a/gui/test/test.pro +++ b/gui/test/test.pro @@ -1,38 +1,4 @@ -TEMPLATE = app -TARGET = test -CONFIG += qtestlib -DEPENDPATH += . .. -INCLUDEPATH += . .. ../../lib +CONFIG += ordered +TEMPLATE = subdirs -LIBS += -L../../externals -lpcre -INCLUDEPATH += ../../externals - -BASEPATH = ../../lib/ -include($$PWD/../../lib/lib.pri) - -# tests -SOURCES += main.cpp \ - testtranslationhandler.cpp \ - testxmlreport.cpp \ - testxmlreportv1.cpp \ - testxmlreportv2.cpp - -HEADERS += testtranslationhandler.h \ - testxmlreport.h \ - testxmlreportv1.h \ - testxmlreportv2.h - -# GUI -SOURCES += ../erroritem.cpp \ - ../report.cpp \ - ../translationhandler.cpp \ - ../xmlreport.cpp \ - ../xmlreportv1.cpp \ - ../xmlreportv2.cpp - -HEADERS += ../erroritem.h \ - ../report.h \ - ../translationhandler.h \ - ../xmlreport.h \ - ../xmlreportv1.h \ - ../xmlreportv2.h +SUBDIRS = translationhandler diff --git a/gui/test/testtranslationhandler.cpp b/gui/test/translationhandler/testtranslationhandler.cpp similarity index 90% rename from gui/test/testtranslationhandler.cpp rename to gui/test/translationhandler/testtranslationhandler.cpp index dc0b17f3d..f00212df4 100644 --- a/gui/test/testtranslationhandler.cpp +++ b/gui/test/translationhandler/testtranslationhandler.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 @@ -27,3 +27,5 @@ void TestTranslationHandler::construct() QCOMPARE(10, handler.GetNames().size()); QCOMPARE(QString("en"), handler.GetCurrentLanguage()); } + + QTEST_MAIN(TestTranslationHandler) diff --git a/gui/test/testtranslationhandler.h b/gui/test/translationhandler/testtranslationhandler.h similarity index 92% rename from gui/test/testtranslationhandler.h rename to gui/test/translationhandler/testtranslationhandler.h index 6f4235889..92402f2e2 100644 --- a/gui/test/testtranslationhandler.h +++ b/gui/test/translationhandler/testtranslationhandler.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/translationhandler/translationhandler.pro b/gui/test/translationhandler/translationhandler.pro new file mode 100644 index 000000000..0b5fef8b1 --- /dev/null +++ b/gui/test/translationhandler/translationhandler.pro @@ -0,0 +1,13 @@ +TEMPLATE = app +TARGET = test-translationhandler +DEPENDPATH += . +INCLUDEPATH += . +OBJECTS_DIR = build +MOC_DIR = build + +include(../common.pri) + +# tests +SOURCES += testtranslationhandler.cpp + +HEADERS += testtranslationhandler.h