From e1e995abe72041c8ea85ebf4e4800251c63ac05c Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 31 Mar 2015 17:48:58 +0300 Subject: [PATCH] Test template for future test system. --HG-- branch : develop --- src/test/ValentinaTest/ValentinaTest.pro | 30 +++++++++++++ src/test/ValentinaTest/qttestmainlambda.cpp | 46 ++++++++++++++++++++ src/test/ValentinaTest/tst_test.cpp | 46 ++++++++++++++++++++ src/test/ValentinaTest/tst_test.h | 48 +++++++++++++++++++++ src/test/test.pro | 3 +- 5 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 src/test/ValentinaTest/ValentinaTest.pro create mode 100644 src/test/ValentinaTest/qttestmainlambda.cpp create mode 100644 src/test/ValentinaTest/tst_test.cpp create mode 100644 src/test/ValentinaTest/tst_test.h diff --git a/src/test/ValentinaTest/ValentinaTest.pro b/src/test/ValentinaTest/ValentinaTest.pro new file mode 100644 index 000000000..94ad3436e --- /dev/null +++ b/src/test/ValentinaTest/ValentinaTest.pro @@ -0,0 +1,30 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2015-03-31T17:27:03 +# +#------------------------------------------------- + +QT += testlib + +QT -= gui + +TARGET = tst_test +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app + +# Use out-of-source builds (shadow builds) +CONFIG -= debug_and_release debug_and_release_target + +# We use C++11 standard +CONFIG += c++11 + +DEFINES += SRCDIR=\\\"$$PWD/\\\" + +SOURCES += \ + qttestmainlambda.cpp \ + tst_test.cpp + +HEADERS += \ + tst_test.h diff --git a/src/test/ValentinaTest/qttestmainlambda.cpp b/src/test/ValentinaTest/qttestmainlambda.cpp new file mode 100644 index 000000000..a688b2df6 --- /dev/null +++ b/src/test/ValentinaTest/qttestmainlambda.cpp @@ -0,0 +1,46 @@ +/************************************************************************ + ** + ** @file qttestmainlambda.cpp + ** @author Roman Telezhynskyi + ** @date 31 3, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include + +#include "tst_test.h" + +int main(int argc, char** argv) +{ + int status = 0; + auto ASSERT_TEST = [&status, argc, argv](QObject* obj) + { + status |= QTest::qExec(obj, argc, argv); + delete obj; + }; + + ASSERT_TEST(new Test()); + //ASSERT_TEST(new Test2()); + + return status; +} diff --git a/src/test/ValentinaTest/tst_test.cpp b/src/test/ValentinaTest/tst_test.cpp new file mode 100644 index 000000000..0cbf46a71 --- /dev/null +++ b/src/test/ValentinaTest/tst_test.cpp @@ -0,0 +1,46 @@ +/************************************************************************ + ** + ** @file tst_test.cpp + ** @author Roman Telezhynskyi + ** @date 31 3, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "tst_test.h" + +Test::Test() +{ +} + +void Test::initTestCase() +{ +} + +void Test::cleanupTestCase() +{ +} + +void Test::testCase1() +{ + QVERIFY2(true, "Failure"); +} diff --git a/src/test/ValentinaTest/tst_test.h b/src/test/ValentinaTest/tst_test.h new file mode 100644 index 000000000..be5404a59 --- /dev/null +++ b/src/test/ValentinaTest/tst_test.h @@ -0,0 +1,48 @@ +/************************************************************************ + ** + ** @file tst_test.cpp + ** @author Roman Telezhynskyi + ** @date 31 3, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef TST_TEST_H +#define TST_TEST_H + +#include +#include + +class Test : public QObject +{ + Q_OBJECT + +public: + Test(); + +private Q_SLOTS: + void initTestCase(); + void cleanupTestCase(); + void testCase1(); +}; + +#endif // TST_TEST_H diff --git a/src/test/test.pro b/src/test/test.pro index db8b1c7c4..2d7250662 100644 --- a/src/test/test.pro +++ b/src/test/test.pro @@ -1,3 +1,4 @@ TEMPLATE = subdirs CONFIG += ordered -SUBDIRS = ParserTest +SUBDIRS = ParserTest \ + ValentinaTest