From 2684b230f16f293058cce38c60869907ec860e52 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Tue, 8 Feb 2011 23:30:46 +0200 Subject: [PATCH] GUITEST: Add first GUI test testing TranslationHandler. --- gui/test/test.pro | 10 ++++++++++ gui/test/testtranslationhandler.cpp | 21 +++++++++++++++++++++ gui/translationhandler.h | 2 +- runastyle | 2 ++ runastyle.bat | 2 ++ 5 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 gui/test/test.pro create mode 100644 gui/test/testtranslationhandler.cpp diff --git a/gui/test/test.pro b/gui/test/test.pro new file mode 100644 index 000000000..3f496cd7b --- /dev/null +++ b/gui/test/test.pro @@ -0,0 +1,10 @@ +TEMPLATE = app +TARGET = +CONFIG += qtestlib +DEPENDPATH += . .. +INCLUDEPATH += . .. + +SOURCES += testtranslationhandler.cpp + +HEADERS += ../translationhandler.h +SOURCES += ../translationhandler.cpp diff --git a/gui/test/testtranslationhandler.cpp b/gui/test/testtranslationhandler.cpp new file mode 100644 index 000000000..884d708e3 --- /dev/null +++ b/gui/test/testtranslationhandler.cpp @@ -0,0 +1,21 @@ +#include +#include +#include "translationhandler.h" + +class TestTranslationHandler: public QObject +{ + Q_OBJECT + +private slots: + void construct(); +}; + +void TestTranslationHandler::construct() +{ + TranslationHandler handler; + QCOMPARE(10, handler.GetNames().size()); + QCOMPARE(QString("en"), handler.GetCurrentLanguage()); +} + +#include "testtranslationhandler.moc" +QTEST_MAIN(TestTranslationHandler) diff --git a/gui/translationhandler.h b/gui/translationhandler.h index 8640b7ea3..2d396c579 100644 --- a/gui/translationhandler.h +++ b/gui/translationhandler.h @@ -63,7 +63,7 @@ class TranslationHandler : QObject { Q_OBJECT public: - TranslationHandler(QObject *parent); + TranslationHandler(QObject *parent = 0); virtual ~TranslationHandler(); /** diff --git a/runastyle b/runastyle index 00f2807cb..0b61c8ab6 100755 --- a/runastyle +++ b/runastyle @@ -7,6 +7,8 @@ astyle $style $options cli/*.cpp astyle $style $options cli/*.h astyle $style $options gui/*.cpp astyle $style $options gui/*.h +astyle $style $options gui/test/*.cpp +astyle $style $options gui/test/*.h astyle $style $options lib/*.cpp astyle $style $options lib/*.h astyle $style $options test/*.cpp diff --git a/runastyle.bat b/runastyle.bat index 3f3c46527..08aa6890a 100644 --- a/runastyle.bat +++ b/runastyle.bat @@ -7,6 +7,8 @@ astyle %STYLE% %OPTIONS% cli/*.cpp astyle %STYLE% %OPTIONS% cli/*.h astyle %STYLE% %OPTIONS% gui/*.cpp astyle %STYLE% %OPTIONS% gui/*.h +astyle %STYLE% %OPTIONS% gui/test/*.cpp +astyle %STYLE% %OPTIONS% gui/test/*.h astyle %STYLE% %OPTIONS% lib/*.cpp astyle %STYLE% %OPTIONS% lib/*.h astyle %STYLE% %OPTIONS% test/*.cpp