Translation unit tests moved to separate binary.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-08-04 19:28:28 +03:00
parent 77e0e4dd2e
commit 8f78b31710
26 changed files with 429 additions and 49 deletions

View file

@ -27,8 +27,8 @@
*************************************************************************/
#include "abstracttest.h"
#include "../vmisc/logging.h"
#include "../vmisc/vsysexits.h"
#include "logging.h"
#include "vsysexits.h"
#include <QtTest>

View file

@ -11,7 +11,8 @@ SOURCES += \
$$PWD/vtapesettings.cpp \
$$PWD/commandoptions.cpp \
$$PWD/qxtcsvmodel.cpp \
$$PWD/vtablesearch.cpp
$$PWD/vtablesearch.cpp \
$$PWD/abstracttest.cpp
win32-msvc*:SOURCES += $$PWD/stable.cpp
@ -31,7 +32,8 @@ HEADERS += \
$$PWD/vsysexits.h \
$$PWD/commandoptions.h \
$$PWD/qxtcsvmodel.h \
$$PWD/vtablesearch.h
$$PWD/vtablesearch.h \
$$PWD/abstracttest.h
# Qt's versions
# 5.0.0, 5.0.1, 5.0.2

View file

@ -7,7 +7,7 @@
# File with common stuff for whole project
include(../../../common.pri)
QT += widgets printsupport
QT += widgets printsupport testlib
# Name of library
TARGET = vmisc

View file

@ -42,8 +42,9 @@ HEADERS += \
stable.h
SOURCES += \
main.cpp \
stable.cpp
main.cpp
win32-msvc*:SOURCES += stable.cpp
# Set using ccache. Function enable_ccache() defined in common.pri.
$$enable_ccache()

View file

@ -0,0 +1,178 @@
#-------------------------------------------------
#
# Project created by QtCreator 2016-08-04T16:33:17
#
#-------------------------------------------------
QT += testlib widgets xml printsupport
QT -= gui
TARGET = TranslationsTest
# File with common stuff for whole project
include(../../../common.pri)
# CONFIG += testcase adds a 'make check' which is great. But by default it also
# adds a 'make install' that installs the test cases, which we do not want.
# Can configure it not to do that with 'no_testcase_installs'
# We use C++11 standard
CONFIG += c++11 testcase no_testcase_installs
# Use out-of-source builds (shadow builds)
CONFIG -= app_bundle debug_and_release debug_and_release_target
TEMPLATE = app
# directory for executable file
DESTDIR = bin
# Directory for files created moc
MOC_DIR = moc
# objecs files
OBJECTS_DIR = obj
DEFINES += SRCDIR=\\\"$$PWD/\\\"
SOURCES += \
qttestmainlambda.cpp \
tst_measurementregexp.cpp \
tst_qmuparsererrormsg.cpp \
tst_tstranslation.cpp
win32-msvc*:SOURCES += stable.cpp
HEADERS += \
stable.h \
tst_measurementregexp.h \
tst_qmuparsererrormsg.h \
tst_tstranslation.h
# Set using ccache. Function enable_ccache() defined in common.pri.
$$enable_ccache()
DEFINES += TS_DIR=\\\"$${PWD}/../../../share/translations\\\"
CONFIG(debug, debug|release){
# Debug mode
unix {
include(warnings.pri)
} else {
*-g++{
QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details.
}
}
}else{
# Release mode
!win32-msvc*:CONFIG += silent
DEFINES += V_NO_ASSERT
!unix:*-g++{
QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll
}
checkWarnings{
unix:include(warnings.pri)
}
noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
# do nothing
} else {
# Turn on debug symbols in release mode on Unix systems.
# On Mac OS X temporarily disabled. Need find way how to strip binary file.
!macx:!win32-msvc*{
QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3
QMAKE_CFLAGS_RELEASE += -g -gdwarf-3
QMAKE_LFLAGS_RELEASE =
}
}
}
##VTools static library (depend on VWidgets, VMisc, VPatternDB)
#unix|win32: LIBS += -L$$OUT_PWD/../../libs/vtools/$${DESTDIR}/ -lvtools
#INCLUDEPATH += $$PWD/../../libs/vtools
#DEPENDPATH += $$PWD/../../libs/vtools
#win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vtools/$${DESTDIR}/vtools.lib
#else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vtools/$${DESTDIR}/libvtools.a
##VWidgets static library
#unix|win32: LIBS += -L$$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/ -lvwidgets
#INCLUDEPATH += $$PWD/../../libs/vwidgets
#DEPENDPATH += $$PWD/../../libs/vwidgets
#win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/vwidgets.lib
#else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/libvwidgets.a
## VFormat static library (depend on VPatternDB, IFC)
#unix|win32: LIBS += -L$$OUT_PWD/../../libs/vformat/$${DESTDIR}/ -lvformat
#INCLUDEPATH += $$PWD/../../libs/vformat
#DEPENDPATH += $$PWD/../../libs/vformat
#win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/vformat.lib
#else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/libvformat.a
#VPatternDB static library (depend on vgeometry, vmisc, VLayout)
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vpatterndb/$${DESTDIR} -lvpatterndb
INCLUDEPATH += $$PWD/../../libs/vpatterndb
DEPENDPATH += $$PWD/../../libs/vpatterndb
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/libvpatterndb.a
#VMisc static library
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vmisc/$${DESTDIR} -lvmisc
INCLUDEPATH += $$PWD/../../libs/vmisc
DEPENDPATH += $$PWD/../../libs/vmisc
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vmisc/$${DESTDIR}/vmisc.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vmisc/$${DESTDIR}/libvmisc.a
## VGeometry static library (depend on ifc)
#unix|win32: LIBS += -L$$OUT_PWD/../../libs/vgeometry/$${DESTDIR} -lvgeometry
#INCLUDEPATH += $$PWD/../../libs/vgeometry
#DEPENDPATH += $$PWD/../../libs/vgeometry
#win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/vgeometry.lib
#else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/libvgeometry.a
# IFC static library (depend on QMuParser)
unix|win32: LIBS += -L$$OUT_PWD/../../libs/ifc/$${DESTDIR}/ -lifc
INCLUDEPATH += $$PWD/../../libs/ifc
DEPENDPATH += $$PWD/../../libs/ifc
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/ifc.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/libifc.a
## VLayout static library
#unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR} -lvlayout
#INCLUDEPATH += $$PWD/../../libs/vlayout
#DEPENDPATH += $$PWD/../../libs/vlayout
#win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/vlayout.lib
#else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/libvlayout.a
# QMuParser library
win32:CONFIG(release, debug|release): LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser2
else:win32:CONFIG(debug, debug|release): LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser2
else:unix: LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser
INCLUDEPATH += $${PWD}/../../libs/qmuparser
DEPENDPATH += $${PWD}/../../libs/qmuparser
## Only for adding path to LD_LIBRARY_PATH
## VPropertyExplorer library
#win32:CONFIG(release, debug|release): LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
#else:win32:CONFIG(debug, debug|release): LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
#else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
#INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
#DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer

View file

@ -0,0 +1,69 @@
/************************************************************************
**
** @file qttestmainlambda.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include <QtTest>
#include "tst_measurementregexp.h"
#include "tst_qmuparsererrormsg.h"
#include "tst_tstranslation.h"
#include "../vmisc/def.h"
int main(int argc, char** argv)
{
QApplication app( argc, argv );// For translation
int status = 0;
auto ASSERT_TEST = [&status, argc, argv](QObject* obj)
{
status |= QTest::qExec(obj, argc, argv);
delete obj;
};
ASSERT_TEST(new TST_TSTranslation());
{
const QStringList locales = SupportedLocales();
for(quint32 s = 0; s < TST_MeasurementRegExp::systemCounts; ++s)
{
for(int l = 0, sz = locales.size(); l < sz; ++l)
{
ASSERT_TEST(new TST_MeasurementRegExp(s, locales.at(l)));
}
}
for(int l = 0, sz = locales.size(); l < sz; ++l)
{
ASSERT_TEST(new TST_QmuParserErrorMsg(locales.at(l)));
}
}
return status;
}

View file

@ -0,0 +1,30 @@
/************************************************************************
**
** @file stable.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date November 15, 2013
**
** @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) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
// Build the precompiled headers.
#include "stable.h"

View file

@ -0,0 +1,80 @@
/************************************************************************
**
** @file stable.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date November 15, 2013
**
** @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) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef STABLE_H
#define STABLE_H
/* I like to include this pragma too, so the build log indicates if pre-compiled headers were in use. */
#pragma message("Compiling precompiled headers for Valentina tests.\n")
/* Add C includes here */
#if defined __cplusplus
/* Add C++ includes here */
#include <csignal>
/*In all cases we need include core header for getting defined values*/
#ifdef QT_CORE_LIB
# include <QtCore>
#endif
#ifdef QT_GUI_LIB
# include <QtGui>
#endif
#ifdef QT_XML_LIB
# include <QtXml>
#endif
//In Windows you can't use same header in all modes.
#if !defined(Q_OS_WIN)
# ifdef QT_WIDGETS_LIB
# include <QtWidgets>
# endif
# ifdef QT_SVG_LIB
# include <QtSvg/QtSvg>
# endif
# ifdef QT_PRINTSUPPORT_LIB
# include <QtPrintSupport>
# endif
//Build doesn't work, if include this headers on Windows.
# ifdef QT_XMLPATTERNS_LIB
# include <QtXmlPatterns>
# endif
# ifdef QT_NETWORK_LIB
# include <QtNetwork>
# endif
#endif/*Q_OS_WIN*/
#endif /*__cplusplus*/
#endif // STABLE_H

View file

@ -29,7 +29,7 @@
#ifndef TST_MEASUREMENTREGEXP_H
#define TST_MEASUREMENTREGEXP_H
#include "abstracttest.h"
#include "../vmisc/abstracttest.h"
#include <QPointer>

View file

@ -29,7 +29,7 @@
#ifndef TST_QMUPARSERERRORMSG_H
#define TST_QMUPARSERERRORMSG_H
#include "abstracttest.h"
#include "../vmisc/abstracttest.h"
#include "../qmuparser/qmuparsererror.h"
#include <QTranslator>

View file

@ -0,0 +1,49 @@
#Turn on compilers warnings.
*-g++{
QMAKE_CXXFLAGS += \
# Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${UI_DIR}" \
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
$$GCC_DEBUG_CXXFLAGS # See common.pri for more details.
checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings
QMAKE_CXXFLAGS += -Werror
}
noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer
# do nothing
} else {
#gccs 4.8.0 Address Sanitizer
#http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/
QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer
QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer
QMAKE_LFLAGS += -fsanitize=address
}
}
clang*{
QMAKE_CXXFLAGS += \
# Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${UI_DIR}" \
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
$$CLANG_DEBUG_CXXFLAGS \ # See common.pri for more details.
-Wno-gnu-zero-variadic-macro-arguments\ # See macros QSKIP
checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings
QMAKE_CXXFLAGS += -Werror
}
}
*-icc-*{
QMAKE_CXXFLAGS += \
-isystem "$${OUT_PWD}/$${UI_DIR}" \
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
$$ICC_DEBUG_CXXFLAGS
checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings
QMAKE_CXXFLAGS += -Werror
}
}

View file

@ -38,46 +38,39 @@ SOURCES += \
tst_vposter.cpp \
tst_vabstractdetail.cpp \
tst_vspline.cpp \
abstracttest.cpp \
tst_nameregexp.cpp \
tst_vlayoutdetail.cpp \
tst_varc.cpp \
stable.cpp \
tst_measurementregexp.cpp \
tst_tapecommandline.cpp \
tst_valentinacommandline.cpp \
tst_qmutokenparser.cpp \
tst_vmeasurements.cpp \
tst_qmuparsererrormsg.cpp \
tst_vlockguard.cpp \
tst_misc.cpp \
tst_vcommandline.cpp \
tst_tstranslation.cpp \
tst_vdetail.cpp \
tst_vabstractcurve.cpp \
tst_findpoint.cpp \
tst_vellipticalarc.cpp \
tst_vcubicbezierpath.cpp
win32-msvc*:SOURCES += stable.cpp
HEADERS += \
tst_vposter.h \
tst_vabstractdetail.h \
tst_vspline.h \
abstracttest.h \
tst_nameregexp.h \
tst_vlayoutdetail.h \
tst_varc.h \
stable.h \
tst_measurementregexp.h \
tst_tapecommandline.h \
tst_valentinacommandline.h \
tst_qmutokenparser.h \
tst_vmeasurements.h \
tst_qmuparsererrormsg.h \
tst_vlockguard.h \
tst_misc.h \
tst_vcommandline.h \
tst_tstranslation.h \
tst_vdetail.h \
tst_vabstractcurve.h \
tst_findpoint.h \
@ -87,8 +80,6 @@ HEADERS += \
# Set using ccache. Function enable_ccache() defined in common.pri.
$$enable_ccache()
DEFINES += TS_DIR=\\\"$${PWD}/../../../share/translations\\\"
CONFIG(debug, debug|release){
# Debug mode
unix {

View file

@ -35,16 +35,13 @@
#include "tst_vlayoutdetail.h"
#include "tst_varc.h"
#include "tst_vellipticalarc.h"
#include "tst_measurementregexp.h"
#include "tst_tapecommandline.h"
#include "tst_valentinacommandline.h"
#include "tst_qmutokenparser.h"
#include "tst_vmeasurements.h"
#include "tst_qmuparsererrormsg.h"
#include "tst_vlockguard.h"
#include "tst_misc.h"
#include "tst_vcommandline.h"
#include "tst_tstranslation.h"
#include "tst_vdetail.h"
#include "tst_findpoint.h"
#include "tst_vabstractcurve.h"
@ -74,23 +71,6 @@ int main(int argc, char** argv)
ASSERT_TEST(new TST_VLayoutDetail());
ASSERT_TEST(new TST_VArc());
ASSERT_TEST(new TST_VEllipticalArc());
{
const QStringList locales = SupportedLocales();
for(quint32 s = 0; s < TST_MeasurementRegExp::systemCounts; ++s)
{
for(int l = 0, sz = locales.size(); l < sz; ++l)
{
ASSERT_TEST(new TST_MeasurementRegExp(s, locales.at(l)));
}
}
for(int l = 0, sz = locales.size(); l < sz; ++l)
{
ASSERT_TEST(new TST_QmuParserErrorMsg(locales.at(l)));
}
}
ASSERT_TEST(new TST_TapeCommandLine());
ASSERT_TEST(new TST_ValentinaCommandLine());
ASSERT_TEST(new TST_QmuTokenParser());
@ -98,7 +78,6 @@ int main(int argc, char** argv)
ASSERT_TEST(new TST_VLockGuard());
ASSERT_TEST(new TST_Misc());
ASSERT_TEST(new TST_VCommandLine());
ASSERT_TEST(new TST_TSTranslation());
ASSERT_TEST(new TST_VAbstractCurve());
ASSERT_TEST(new TST_VCubicBezierPath());

View file

@ -29,7 +29,7 @@
#ifndef TST_TAPECOMMANDLINE_H
#define TST_TAPECOMMANDLINE_H
#include "abstracttest.h"
#include "../vmisc/abstracttest.h"
class TST_TapeCommandLine : public AbstractTest
{

View file

@ -29,7 +29,7 @@
#ifndef TST_VABSTRACTCURVE_H
#define TST_VABSTRACTCURVE_H
#include "abstracttest.h"
#include "../vmisc/abstracttest.h"
class TST_VAbstractCurve : public AbstractTest
{

View file

@ -29,7 +29,7 @@
#ifndef TST_VABSTRACTDETAIL_H
#define TST_VABSTRACTDETAIL_H
#include "abstracttest.h"
#include "../vmisc/abstracttest.h"
class TST_VAbstractDetail : public AbstractTest
{

View file

@ -29,7 +29,7 @@
#ifndef TST_VALENTINACOMMANDLINE_H
#define TST_VALENTINACOMMANDLINE_H
#include "abstracttest.h"
#include "../vmisc/abstracttest.h"
class TST_ValentinaCommandLine : public AbstractTest
{

View file

@ -29,7 +29,7 @@
#ifndef TST_VDETAIL_H
#define TST_VDETAIL_H
#include "abstracttest.h"
#include "../vmisc/abstracttest.h"
class TST_VDetail : public AbstractTest
{

View file

@ -29,7 +29,7 @@
#ifndef TST_VLAYOUTDETAIL_H
#define TST_VLAYOUTDETAIL_H
#include "abstracttest.h"
#include "../vmisc/abstracttest.h"
class TST_VLayoutDetail : public AbstractTest
{

View file

@ -29,7 +29,7 @@
#ifndef TST_VSPLINE_H
#define TST_VSPLINE_H
#include "abstracttest.h"
#include "../vmisc/abstracttest.h"
class VSpline;

View file

@ -1,4 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = \
ParserTest \
ValentinaTest
ValentinaTest \
TranslationsTest