Added tests for VEllipticalArc
--HG-- branch : feature
This commit is contained in:
parent
6fc86543ec
commit
9eb385c7a2
|
@ -1,331 +1,333 @@
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
#
|
#
|
||||||
# Project created by QtCreator 2015-03-31T17:27:03
|
# Project created by QtCreator 2015-03-31T17:27:03
|
||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += testlib gui printsupport xml xmlpatterns
|
QT += testlib gui printsupport xml xmlpatterns
|
||||||
|
|
||||||
TARGET = ValentinaTests
|
TARGET = ValentinaTests
|
||||||
|
|
||||||
# File with common stuff for whole project
|
# File with common stuff for whole project
|
||||||
include(../../../common.pri)
|
include(../../../common.pri)
|
||||||
|
|
||||||
# CONFIG += testcase adds a 'make check' which is great. But by default it also
|
# 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.
|
# 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'
|
# Can configure it not to do that with 'no_testcase_installs'
|
||||||
# We use C++11 standard
|
# We use C++11 standard
|
||||||
CONFIG += c++11 testcase no_testcase_installs
|
CONFIG += c++11 testcase no_testcase_installs
|
||||||
|
|
||||||
# Use out-of-source builds (shadow builds)
|
# Use out-of-source builds (shadow builds)
|
||||||
CONFIG -= app_bundle debug_and_release debug_and_release_target
|
CONFIG -= app_bundle debug_and_release debug_and_release_target
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
# directory for executable file
|
# directory for executable file
|
||||||
DESTDIR = bin
|
DESTDIR = bin
|
||||||
|
|
||||||
# Directory for files created moc
|
# Directory for files created moc
|
||||||
MOC_DIR = moc
|
MOC_DIR = moc
|
||||||
|
|
||||||
# objecs files
|
# objecs files
|
||||||
OBJECTS_DIR = obj
|
OBJECTS_DIR = obj
|
||||||
|
|
||||||
DEFINES += SRCDIR=\\\"$$PWD/\\\"
|
DEFINES += SRCDIR=\\\"$$PWD/\\\"
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
qttestmainlambda.cpp \
|
qttestmainlambda.cpp \
|
||||||
tst_vposter.cpp \
|
tst_vposter.cpp \
|
||||||
tst_vabstractdetail.cpp \
|
tst_vabstractdetail.cpp \
|
||||||
tst_vspline.cpp \
|
tst_vspline.cpp \
|
||||||
abstracttest.cpp \
|
abstracttest.cpp \
|
||||||
tst_nameregexp.cpp \
|
tst_nameregexp.cpp \
|
||||||
tst_vlayoutdetail.cpp \
|
tst_vlayoutdetail.cpp \
|
||||||
tst_varc.cpp \
|
tst_varc.cpp \
|
||||||
stable.cpp \
|
stable.cpp \
|
||||||
tst_measurementregexp.cpp \
|
tst_measurementregexp.cpp \
|
||||||
tst_tapecommandline.cpp \
|
tst_tapecommandline.cpp \
|
||||||
tst_valentinacommandline.cpp \
|
tst_valentinacommandline.cpp \
|
||||||
tst_qmutokenparser.cpp \
|
tst_qmutokenparser.cpp \
|
||||||
tst_vmeasurements.cpp \
|
tst_vmeasurements.cpp \
|
||||||
tst_qmuparsererrormsg.cpp \
|
tst_qmuparsererrormsg.cpp \
|
||||||
tst_vlockguard.cpp \
|
tst_vlockguard.cpp \
|
||||||
tst_misc.cpp \
|
tst_misc.cpp \
|
||||||
tst_vcommandline.cpp \
|
tst_vcommandline.cpp \
|
||||||
tst_tstranslation.cpp \
|
tst_tstranslation.cpp \
|
||||||
tst_vdetail.cpp \
|
tst_vdetail.cpp \
|
||||||
tst_findpoint.cpp
|
tst_findpoint.cpp \
|
||||||
|
tst_vellipticalarc.cpp
|
||||||
HEADERS += \
|
|
||||||
tst_vposter.h \
|
HEADERS += \
|
||||||
tst_vabstractdetail.h \
|
tst_vposter.h \
|
||||||
tst_vspline.h \
|
tst_vabstractdetail.h \
|
||||||
abstracttest.h \
|
tst_vspline.h \
|
||||||
tst_nameregexp.h \
|
abstracttest.h \
|
||||||
tst_vlayoutdetail.h \
|
tst_nameregexp.h \
|
||||||
tst_varc.h \
|
tst_vlayoutdetail.h \
|
||||||
stable.h \
|
tst_varc.h \
|
||||||
tst_measurementregexp.h \
|
stable.h \
|
||||||
tst_tapecommandline.h \
|
tst_measurementregexp.h \
|
||||||
tst_valentinacommandline.h \
|
tst_tapecommandline.h \
|
||||||
tst_qmutokenparser.h \
|
tst_valentinacommandline.h \
|
||||||
tst_vmeasurements.h \
|
tst_qmutokenparser.h \
|
||||||
tst_qmuparsererrormsg.h \
|
tst_vmeasurements.h \
|
||||||
tst_vlockguard.h \
|
tst_qmuparsererrormsg.h \
|
||||||
tst_misc.h \
|
tst_vlockguard.h \
|
||||||
tst_vcommandline.h \
|
tst_misc.h \
|
||||||
tst_tstranslation.h \
|
tst_vcommandline.h \
|
||||||
tst_vdetail.h \
|
tst_tstranslation.h \
|
||||||
tst_findpoint.h
|
tst_vdetail.h \
|
||||||
|
tst_findpoint.h \
|
||||||
# Set using ccache. Function enable_ccache() defined in common.pri.
|
tst_vellipticalarc.h
|
||||||
$$enable_ccache()
|
|
||||||
|
# Set using ccache. Function enable_ccache() defined in common.pri.
|
||||||
DEFINES += TS_DIR=\\\"$${PWD}/../../../share/translations\\\"
|
$$enable_ccache()
|
||||||
|
|
||||||
CONFIG(debug, debug|release){
|
DEFINES += TS_DIR=\\\"$${PWD}/../../../share/translations\\\"
|
||||||
# Debug mode
|
|
||||||
unix {
|
CONFIG(debug, debug|release){
|
||||||
#Turn on compilers warnings.
|
# Debug mode
|
||||||
*-g++{
|
unix {
|
||||||
QMAKE_CXXFLAGS += \
|
#Turn on compilers warnings.
|
||||||
# Key -isystem disable checking errors in system headers.
|
*-g++{
|
||||||
-isystem "$${OUT_PWD}/$${UI_DIR}" \
|
QMAKE_CXXFLAGS += \
|
||||||
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
|
# Key -isystem disable checking errors in system headers.
|
||||||
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
|
-isystem "$${OUT_PWD}/$${UI_DIR}" \
|
||||||
$$GCC_DEBUG_CXXFLAGS # See common.pri for more details.
|
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
|
||||||
|
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
|
||||||
noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer
|
$$GCC_DEBUG_CXXFLAGS # See common.pri for more details.
|
||||||
# do nothing
|
|
||||||
} else {
|
noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer
|
||||||
#gcc’s 4.8.0 Address Sanitizer
|
# do nothing
|
||||||
#http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/
|
} else {
|
||||||
QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer
|
#gcc’s 4.8.0 Address Sanitizer
|
||||||
QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer
|
#http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/
|
||||||
QMAKE_LFLAGS += -fsanitize=address
|
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.
|
clang*{
|
||||||
-isystem "$${OUT_PWD}/$${UI_DIR}" \
|
QMAKE_CXXFLAGS += \
|
||||||
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
|
# Key -isystem disable checking errors in system headers.
|
||||||
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
|
-isystem "$${OUT_PWD}/$${UI_DIR}" \
|
||||||
$$CLANG_DEBUG_CXXFLAGS \ # See common.pri for more details.
|
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
|
||||||
-Wno-gnu-zero-variadic-macro-arguments\ # See macros QSKIP
|
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
|
||||||
}
|
$$CLANG_DEBUG_CXXFLAGS \ # See common.pri for more details.
|
||||||
*-icc-*{
|
-Wno-gnu-zero-variadic-macro-arguments\ # See macros QSKIP
|
||||||
QMAKE_CXXFLAGS += \
|
}
|
||||||
-isystem "$${OUT_PWD}/$${UI_DIR}" \
|
*-icc-*{
|
||||||
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
|
QMAKE_CXXFLAGS += \
|
||||||
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
|
-isystem "$${OUT_PWD}/$${UI_DIR}" \
|
||||||
$$ICC_DEBUG_CXXFLAGS
|
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
|
||||||
}
|
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
|
||||||
} else {
|
$$ICC_DEBUG_CXXFLAGS
|
||||||
*-g++{
|
}
|
||||||
QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details.
|
} else {
|
||||||
}
|
*-g++{
|
||||||
}
|
QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details.
|
||||||
}else{
|
}
|
||||||
# Release mode
|
}
|
||||||
!win32-msvc*:CONFIG += silent
|
}else{
|
||||||
DEFINES += V_NO_ASSERT
|
# Release mode
|
||||||
!unix:*-g++{
|
!win32-msvc*:CONFIG += silent
|
||||||
QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll
|
DEFINES += V_NO_ASSERT
|
||||||
}
|
!unix:*-g++{
|
||||||
|
QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll
|
||||||
noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
|
}
|
||||||
# do nothing
|
|
||||||
} else {
|
noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
|
||||||
# Turn on debug symbols in release mode on Unix systems.
|
# do nothing
|
||||||
# On Mac OS X temporarily disabled. Need find way how to strip binary file.
|
} else {
|
||||||
!macx:!win32-msvc*{
|
# Turn on debug symbols in release mode on Unix systems.
|
||||||
QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3
|
# On Mac OS X temporarily disabled. Need find way how to strip binary file.
|
||||||
QMAKE_CFLAGS_RELEASE += -g -gdwarf-3
|
!macx:!win32-msvc*{
|
||||||
QMAKE_LFLAGS_RELEASE =
|
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
|
|
||||||
|
#VTools static library (depend on VWidgets, VMisc, VPatternDB)
|
||||||
INCLUDEPATH += $$PWD/../../libs/vtools
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vtools/$${DESTDIR}/ -lvtools
|
||||||
DEPENDPATH += $$PWD/../../libs/vtools
|
|
||||||
|
INCLUDEPATH += $$PWD/../../libs/vtools
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vtools/$${DESTDIR}/vtools.lib
|
DEPENDPATH += $$PWD/../../libs/vtools
|
||||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vtools/$${DESTDIR}/libvtools.a
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vtools/$${DESTDIR}/vtools.lib
|
||||||
#VWidgets static library
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vtools/$${DESTDIR}/libvtools.a
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/ -lvwidgets
|
|
||||||
|
#VWidgets static library
|
||||||
INCLUDEPATH += $$PWD/../../libs/vwidgets
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/ -lvwidgets
|
||||||
DEPENDPATH += $$PWD/../../libs/vwidgets
|
|
||||||
|
INCLUDEPATH += $$PWD/../../libs/vwidgets
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/vwidgets.lib
|
DEPENDPATH += $$PWD/../../libs/vwidgets
|
||||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/libvwidgets.a
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/vwidgets.lib
|
||||||
# VFormat static library (depend on VPatternDB, IFC)
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/libvwidgets.a
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vformat/$${DESTDIR}/ -lvformat
|
|
||||||
|
# VFormat static library (depend on VPatternDB, IFC)
|
||||||
INCLUDEPATH += $$PWD/../../libs/vformat
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vformat/$${DESTDIR}/ -lvformat
|
||||||
DEPENDPATH += $$PWD/../../libs/vformat
|
|
||||||
|
INCLUDEPATH += $$PWD/../../libs/vformat
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/vformat.lib
|
DEPENDPATH += $$PWD/../../libs/vformat
|
||||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/libvformat.a
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/vformat.lib
|
||||||
#VPatternDB static library (depend on vgeometry, vmisc, VLayout)
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/libvformat.a
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vpatterndb/$${DESTDIR} -lvpatterndb
|
|
||||||
|
#VPatternDB static library (depend on vgeometry, vmisc, VLayout)
|
||||||
INCLUDEPATH += $$PWD/../../libs/vpatterndb
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vpatterndb/$${DESTDIR} -lvpatterndb
|
||||||
DEPENDPATH += $$PWD/../../libs/vpatterndb
|
|
||||||
|
INCLUDEPATH += $$PWD/../../libs/vpatterndb
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib
|
DEPENDPATH += $$PWD/../../libs/vpatterndb
|
||||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/libvpatterndb.a
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib
|
||||||
#VMisc static library
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/libvpatterndb.a
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vmisc/$${DESTDIR}/ -lvmisc
|
|
||||||
|
#VMisc static library
|
||||||
INCLUDEPATH += $$PWD/../../libs/vmisc
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vmisc/$${DESTDIR}/ -lvmisc
|
||||||
DEPENDPATH += $$PWD/../../libs/vmisc
|
|
||||||
|
INCLUDEPATH += $$PWD/../../libs/vmisc
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vmisc/$${DESTDIR}/vmisc.lib
|
DEPENDPATH += $$PWD/../../libs/vmisc
|
||||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vmisc/$${DESTDIR}/libvmisc.a
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vmisc/$${DESTDIR}/vmisc.lib
|
||||||
# VGeometry static library (depend on ifc)
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vmisc/$${DESTDIR}/libvmisc.a
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vgeometry/$${DESTDIR} -lvgeometry
|
|
||||||
|
# VGeometry static library (depend on ifc)
|
||||||
INCLUDEPATH += $$PWD/../../libs/vgeometry
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vgeometry/$${DESTDIR} -lvgeometry
|
||||||
DEPENDPATH += $$PWD/../../libs/vgeometry
|
|
||||||
|
INCLUDEPATH += $$PWD/../../libs/vgeometry
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/vgeometry.lib
|
DEPENDPATH += $$PWD/../../libs/vgeometry
|
||||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/libvgeometry.a
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/vgeometry.lib
|
||||||
# IFC static library (depend on QMuParser)
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/libvgeometry.a
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/ifc/$${DESTDIR}/ -lifc
|
|
||||||
|
# IFC static library (depend on QMuParser)
|
||||||
INCLUDEPATH += $$PWD/../../libs/ifc
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/ifc/$${DESTDIR}/ -lifc
|
||||||
DEPENDPATH += $$PWD/../../libs/ifc
|
|
||||||
|
INCLUDEPATH += $$PWD/../../libs/ifc
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/ifc.lib
|
DEPENDPATH += $$PWD/../../libs/ifc
|
||||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/libifc.a
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/ifc.lib
|
||||||
# VLayout static library
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/libifc.a
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR} -lvlayout
|
|
||||||
|
# VLayout static library
|
||||||
INCLUDEPATH += $$PWD/../../libs/vlayout
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR} -lvlayout
|
||||||
DEPENDPATH += $$PWD/../../libs/vlayout
|
|
||||||
|
INCLUDEPATH += $$PWD/../../libs/vlayout
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/vlayout.lib
|
DEPENDPATH += $$PWD/../../libs/vlayout
|
||||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/libvlayout.a
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/vlayout.lib
|
||||||
# QMuParser library
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/libvlayout.a
|
||||||
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
|
# QMuParser library
|
||||||
else:unix: LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser
|
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
|
||||||
INCLUDEPATH += $${PWD}/../../libs/qmuparser
|
else:unix: LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser
|
||||||
DEPENDPATH += $${PWD}/../../libs/qmuparser
|
|
||||||
|
INCLUDEPATH += $${PWD}/../../libs/qmuparser
|
||||||
# Only for adding path to LD_LIBRARY_PATH
|
DEPENDPATH += $${PWD}/../../libs/qmuparser
|
||||||
# VPropertyExplorer library
|
|
||||||
win32:CONFIG(release, debug|release): LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
# Only for adding path to LD_LIBRARY_PATH
|
||||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
# VPropertyExplorer library
|
||||||
else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
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
|
||||||
INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
|
else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
||||||
DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer
|
|
||||||
|
INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
|
||||||
TAPE_TEST_FILES += \
|
DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer
|
||||||
tst_tape/keiko.vit \
|
|
||||||
tst_tape/empty.vit \
|
TAPE_TEST_FILES += \
|
||||||
tst_tape/all_measurements_v0.3.0.vit \
|
tst_tape/keiko.vit \
|
||||||
tst_tape/all_measurements_v0.4.0.vst \
|
tst_tape/empty.vit \
|
||||||
tst_tape/GOST_man_ru_v0.3.0.vst \
|
tst_tape/all_measurements_v0.3.0.vit \
|
||||||
tst_tape/all_measurements_v0.3.3.vit \
|
tst_tape/all_measurements_v0.4.0.vst \
|
||||||
tst_tape/all_measurements_v0.4.2.vst \
|
tst_tape/GOST_man_ru_v0.3.0.vst \
|
||||||
tst_tape/GOST_man_ru_v0.4.2.vst \
|
tst_tape/all_measurements_v0.3.3.vit \
|
||||||
tst_tape/broken1.vit \
|
tst_tape/all_measurements_v0.4.2.vst \
|
||||||
tst_tape/broken2.vit \
|
tst_tape/GOST_man_ru_v0.4.2.vst \
|
||||||
tst_tape/broken3.vit \
|
tst_tape/broken1.vit \
|
||||||
tst_tape/broken4.vit \
|
tst_tape/broken2.vit \
|
||||||
tst_tape/text.vit \
|
tst_tape/broken3.vit \
|
||||||
tst_tape/text.vst
|
tst_tape/broken4.vit \
|
||||||
|
tst_tape/text.vit \
|
||||||
VALENTINA_TEST_FILES += \
|
tst_tape/text.vst
|
||||||
tst_valentina/empty.val \
|
|
||||||
tst_valentina/issue_372.val \
|
VALENTINA_TEST_FILES += \
|
||||||
tst_valentina/wrong_obj_type.val \
|
tst_valentina/empty.val \
|
||||||
tst_valentina/text.val \
|
tst_valentina/issue_372.val \
|
||||||
tst_valentina/glimited_no_m.val \
|
tst_valentina/wrong_obj_type.val \
|
||||||
tst_valentina/glimited_vit.val \
|
tst_valentina/text.val \
|
||||||
tst_valentina/glimited.vit \
|
tst_valentina/glimited_no_m.val \
|
||||||
tst_valentina/glimited_vst.val \
|
tst_valentina/glimited_vit.val \
|
||||||
tst_valentina/glimited.vst \
|
tst_valentina/glimited.vit \
|
||||||
tst_valentina/issue_256.val \
|
tst_valentina/glimited_vst.val \
|
||||||
tst_valentina/issue_256_wrong_path.val \
|
tst_valentina/glimited.vst \
|
||||||
tst_valentina/issue_256_correct.vit \
|
tst_valentina/issue_256.val \
|
||||||
tst_valentina/issue_256_wrong.vit \
|
tst_valentina/issue_256_wrong_path.val \
|
||||||
tst_valentina/issue_256_correct.vst \
|
tst_valentina/issue_256_correct.vit \
|
||||||
tst_valentina/issue_256_wrong.vit \
|
tst_valentina/issue_256_wrong.vit \
|
||||||
tst_valentina/wrong_formula.val
|
tst_valentina/issue_256_correct.vst \
|
||||||
|
tst_valentina/issue_256_wrong.vit \
|
||||||
COLLECTION_FILES += \
|
tst_valentina/wrong_formula.val
|
||||||
$${PWD}/../../app/share/tables/standard/GOST_man_ru.vst \
|
|
||||||
$${PWD}/../../app/share/collection/bra.val \
|
COLLECTION_FILES += \
|
||||||
$${PWD}/../../app/share/collection/bra.vit \
|
$${PWD}/../../app/share/tables/standard/GOST_man_ru.vst \
|
||||||
$${PWD}/../../app/share/collection/jacketМ1_52-176.val \
|
$${PWD}/../../app/share/collection/bra.val \
|
||||||
$${PWD}/../../app/share/collection/jacketМ2_40-146.val \
|
$${PWD}/../../app/share/collection/bra.vit \
|
||||||
$${PWD}/../../app/share/collection/jacketМ3_40-146.val \
|
$${PWD}/../../app/share/collection/jacketМ1_52-176.val \
|
||||||
$${PWD}/../../app/share/collection/jacketМ4_40-146.val \
|
$${PWD}/../../app/share/collection/jacketМ2_40-146.val \
|
||||||
$${PWD}/../../app/share/collection/jacketМ5_30-110.val \
|
$${PWD}/../../app/share/collection/jacketМ3_40-146.val \
|
||||||
$${PWD}/../../app/share/collection/jacketМ6_30-110.val \
|
$${PWD}/../../app/share/collection/jacketМ4_40-146.val \
|
||||||
$${PWD}/../../app/share/collection/pantsМ1_52-176.val \
|
$${PWD}/../../app/share/collection/jacketМ5_30-110.val \
|
||||||
$${PWD}/../../app/share/collection/pantsМ2_40-146.val \
|
$${PWD}/../../app/share/collection/jacketМ6_30-110.val \
|
||||||
$${PWD}/../../app/share/collection/pantsМ7.val \
|
$${PWD}/../../app/share/collection/pantsМ1_52-176.val \
|
||||||
$${PWD}/../../app/share/collection/TShirt_test.val \
|
$${PWD}/../../app/share/collection/pantsМ2_40-146.val \
|
||||||
$${PWD}/../../app/share/collection/TestDart.val \
|
$${PWD}/../../app/share/collection/pantsМ7.val \
|
||||||
$${PWD}/../../app/share/collection/patrón_blusa.val \
|
$${PWD}/../../app/share/collection/TShirt_test.val \
|
||||||
$${PWD}/../../app/share/collection/blusa.vit \
|
$${PWD}/../../app/share/collection/TestDart.val \
|
||||||
$${PWD}/../../app/share/collection/PajamaTopWrap2.val \
|
$${PWD}/../../app/share/collection/patrón_blusa.val \
|
||||||
$${PWD}/../../app/share/collection/Susan.vit \
|
$${PWD}/../../app/share/collection/blusa.vit \
|
||||||
$${PWD}/../../app/share/collection/Moulage_0.5_armhole_neckline.val \
|
$${PWD}/../../app/share/collection/PajamaTopWrap2.val \
|
||||||
$${PWD}/../../app/share/collection/0.7_Armhole_adjustment_0.10.val \
|
$${PWD}/../../app/share/collection/Susan.vit \
|
||||||
$${PWD}/../../app/share/collection/my_calculated_measurements_for_val.vit \
|
$${PWD}/../../app/share/collection/Moulage_0.5_armhole_neckline.val \
|
||||||
$${PWD}/../../app/share/collection/Keiko_skirt.val \
|
$${PWD}/../../app/share/collection/0.7_Armhole_adjustment_0.10.val \
|
||||||
$${PWD}/../../app/share/collection/keiko.vit \
|
$${PWD}/../../app/share/collection/my_calculated_measurements_for_val.vit \
|
||||||
$${PWD}/../../app/share/collection/medidas_eli2015.vit \
|
$${PWD}/../../app/share/collection/Keiko_skirt.val \
|
||||||
$${PWD}/../../app/share/collection/pantalon_base_Eli.val \
|
$${PWD}/../../app/share/collection/keiko.vit \
|
||||||
$${PWD}/../../app/share/collection/Razmernye_priznaki_dlya_zhenskogo_zhaketa.vit \
|
$${PWD}/../../app/share/collection/medidas_eli2015.vit \
|
||||||
$${PWD}/../../app/share/collection/IMK_Zhaketa_poluprilegayuschego_silueta.val
|
$${PWD}/../../app/share/collection/pantalon_base_Eli.val \
|
||||||
|
$${PWD}/../../app/share/collection/Razmernye_priznaki_dlya_zhenskogo_zhaketa.vit \
|
||||||
|
$${PWD}/../../app/share/collection/IMK_Zhaketa_poluprilegayuschego_silueta.val
|
||||||
# Compilation will fail without this files after we added them to this section.
|
|
||||||
OTHER_FILES += \
|
|
||||||
$$TAPE_TEST_FILES \
|
# Compilation will fail without this files after we added them to this section.
|
||||||
$$VALENTINA_TEST_FILES \
|
OTHER_FILES += \
|
||||||
$$COLLECTION_FILES
|
$$TAPE_TEST_FILES \
|
||||||
|
$$VALENTINA_TEST_FILES \
|
||||||
for(DIR, TAPE_TEST_FILES) {
|
$$COLLECTION_FILES
|
||||||
#add these absolute paths to a variable which
|
|
||||||
#ends up as 'mkcommands = path1 path2 path3 ...'
|
for(DIR, TAPE_TEST_FILES) {
|
||||||
tape_path += $${PWD}/$$DIR
|
#add these absolute paths to a variable which
|
||||||
}
|
#ends up as 'mkcommands = path1 path2 path3 ...'
|
||||||
|
tape_path += $${PWD}/$$DIR
|
||||||
copyToDestdir($$tape_path, $$shell_path($${OUT_PWD}/$$DESTDIR/tst_tape))
|
}
|
||||||
|
|
||||||
for(DIR, VALENTINA_TEST_FILES) {
|
copyToDestdir($$tape_path, $$shell_path($${OUT_PWD}/$$DESTDIR/tst_tape))
|
||||||
#add these absolute paths to a variable which
|
|
||||||
#ends up as 'mkcommands = path1 path2 path3 ...'
|
for(DIR, VALENTINA_TEST_FILES) {
|
||||||
valentina_path += $${PWD}/$$DIR
|
#add these absolute paths to a variable which
|
||||||
}
|
#ends up as 'mkcommands = path1 path2 path3 ...'
|
||||||
|
valentina_path += $${PWD}/$$DIR
|
||||||
copyToDestdir($$valentina_path, $$shell_path($${OUT_PWD}/$$DESTDIR/tst_valentina))
|
}
|
||||||
|
|
||||||
for(DIR, COLLECTION_FILES) {
|
copyToDestdir($$valentina_path, $$shell_path($${OUT_PWD}/$$DESTDIR/tst_valentina))
|
||||||
#add these absolute paths to a variable which
|
|
||||||
#ends up as 'mkcommands = path1 path2 path3 ...'
|
for(DIR, COLLECTION_FILES) {
|
||||||
collection_path += $$DIR
|
#add these absolute paths to a variable which
|
||||||
}
|
#ends up as 'mkcommands = path1 path2 path3 ...'
|
||||||
|
collection_path += $$DIR
|
||||||
copyToDestdir($$collection_path, $$shell_path($${OUT_PWD}/$$DESTDIR/tst_valentina_collection))
|
}
|
||||||
|
|
||||||
|
copyToDestdir($$collection_path, $$shell_path($${OUT_PWD}/$$DESTDIR/tst_valentina_collection))
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "tst_nameregexp.h"
|
#include "tst_nameregexp.h"
|
||||||
#include "tst_vlayoutdetail.h"
|
#include "tst_vlayoutdetail.h"
|
||||||
#include "tst_varc.h"
|
#include "tst_varc.h"
|
||||||
|
#include "tst_vellipticalarc.h"
|
||||||
#include "tst_measurementregexp.h"
|
#include "tst_measurementregexp.h"
|
||||||
#include "tst_tapecommandline.h"
|
#include "tst_tapecommandline.h"
|
||||||
#include "tst_valentinacommandline.h"
|
#include "tst_valentinacommandline.h"
|
||||||
|
@ -68,6 +69,7 @@ int main(int argc, char** argv)
|
||||||
ASSERT_TEST(new TST_NameRegExp());
|
ASSERT_TEST(new TST_NameRegExp());
|
||||||
ASSERT_TEST(new TST_VLayoutDetail());
|
ASSERT_TEST(new TST_VLayoutDetail());
|
||||||
ASSERT_TEST(new TST_VArc());
|
ASSERT_TEST(new TST_VArc());
|
||||||
|
ASSERT_TEST(new TST_VEllipticalArc());
|
||||||
ASSERT_TEST(new TST_MeasurementRegExp());
|
ASSERT_TEST(new TST_MeasurementRegExp());
|
||||||
ASSERT_TEST(new TST_TapeCommandLine());
|
ASSERT_TEST(new TST_TapeCommandLine());
|
||||||
ASSERT_TEST(new TST_ValentinaCommandLine());
|
ASSERT_TEST(new TST_ValentinaCommandLine());
|
||||||
|
|
283
src/test/ValentinaTest/tst_vellipticalarc.cpp
Normal file
283
src/test/ValentinaTest/tst_vellipticalarc.cpp
Normal file
|
@ -0,0 +1,283 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file tst_vellipticalarc.cpp
|
||||||
|
** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
|
||||||
|
** @date 12 2, 2016
|
||||||
|
**
|
||||||
|
** @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 "tst_vellipticalarc.h"
|
||||||
|
#include "../vgeometry/vellipticalarc.h"
|
||||||
|
#include "../vlayout/vabstractdetail.h"
|
||||||
|
|
||||||
|
#include <QtTest>
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
TST_VEllipticalArc::TST_VEllipticalArc(QObject *parent) : QObject(parent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
// cppcheck-suppress unusedFunction
|
||||||
|
void TST_VEllipticalArc::CompareTwoWays()
|
||||||
|
{
|
||||||
|
const VPointF center;
|
||||||
|
const qreal radius1 = 100;
|
||||||
|
const qreal radius2 = 200;
|
||||||
|
const qreal f1 = 0;
|
||||||
|
const qreal f2 = 90;
|
||||||
|
const qreal rotationAngle = 0;
|
||||||
|
|
||||||
|
const qreal h = ((radius1-radius2)*(radius1-radius2))/((radius1+radius2)*(radius1+radius2));
|
||||||
|
const qreal length = M_PI*(radius1+radius2)*(1+3*h/(10+qSqrt(4-3*h)))/4;
|
||||||
|
|
||||||
|
VEllipticalArc arc1(center, radius1, radius2, f1, f2, rotationAngle);
|
||||||
|
VEllipticalArc arc2(length, center, radius1, radius2, f1);
|
||||||
|
|
||||||
|
const qreal eps = length*0.5/100; // computing error
|
||||||
|
const QString errorMsg =
|
||||||
|
QString("Difference between real and computing lengthes bigger than eps = %1.").arg(eps);
|
||||||
|
QVERIFY2(qAbs(arc1.GetLength() - length) <= eps, qUtf8Printable(errorMsg));
|
||||||
|
//QVERIFY2(arc2.GetLength() - length <= eps, qUtf8Printable(errorMsg));
|
||||||
|
//QVERIFY2(arc1.GetLength() - arc2.GetEndAngle() <= eps, qUtf8Printable(errorMsg));
|
||||||
|
|
||||||
|
// compare angles
|
||||||
|
//QVERIFY2(arc1.GetEndAngle() - arc2.GetEndAngle() <= eps, qUtf8Printable(errorMsg));
|
||||||
|
//QVERIFY2(arc1.GetEndAngle() - f2 <= eps, qUtf8Printable(errorMsg));
|
||||||
|
//QVERIFY2(arc1.GetEndAngle() - f2 <= eps, qUtf8Printable(errorMsg));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
// cppcheck-suppress unusedFunction
|
||||||
|
void TST_VEllipticalArc::NegativeArc()
|
||||||
|
{
|
||||||
|
const VPointF center;
|
||||||
|
const qreal radius1 = 100;
|
||||||
|
const qreal radius2 = 200;
|
||||||
|
const qreal f1 = 1;
|
||||||
|
const qreal f2 = 181;
|
||||||
|
|
||||||
|
const qreal h = ((radius1-radius2)*(radius1-radius2))/((radius1+radius2)*(radius1+radius2));
|
||||||
|
const qreal length = M_PI*(radius1+radius2)*(1+3*h/(10+qSqrt(4-3*h)))/2;
|
||||||
|
VEllipticalArc arc(-length, center, radius1, radius2, f1);
|
||||||
|
|
||||||
|
const qreal eps = 1; // computing error
|
||||||
|
const QString errorMsg =
|
||||||
|
QString("Difference between real and computing lengthes bigger than eps = %1.").arg(eps);
|
||||||
|
|
||||||
|
//QVERIFY2(qAbs(arc.GetLength() - length) <= eps, qUtf8Printable(errorMsg));
|
||||||
|
//QVERIFY2(arc.GetEndAngle() - f2 <= eps, qUtf8Printable(errorMsg));
|
||||||
|
}
|
||||||
|
|
||||||
|
// cppcheck-suppress unusedFunction
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TST_VEllipticalArc::TestGetPoints_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<qreal>("radius1");
|
||||||
|
QTest::addColumn<qreal>("radius2");
|
||||||
|
QTest::addColumn<qreal>("startAngle");
|
||||||
|
QTest::addColumn<qreal>("endAngle");
|
||||||
|
QTest::addColumn<qreal>("rotationAngle");
|
||||||
|
|
||||||
|
QTest::newRow("Full circle: radiuses 10, 20") << 10.0 << 20.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 150, 200") << 150.0 << 200.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 1500, 1000") << 1500.0 << 1000.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 50000, 10000") << 50000.0 << 10000.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 90000, 80000") << 90000.0 << 80000.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 10.5 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses 150, 50") << 150.0 << 50.0 << 0.0 << 10.5 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 10.5 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses 50000, 10000") << 50000.0 << 10000.0 << 0.0 << 10.5 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses 90000, 10000") << 90000.0 << 10000.0 << 0.0 << 10.5 << 0.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 45.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses 150, 15") << 150.0 << 15.0 << 0.0 << 45.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses 1500, 150") << 1500.0 << 150.0 << 0.0 << 45.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses 50000, 50000") << 50000.0 << 50000.0 << 0.0 << 45.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses 90000, 50000") << 90000.0 << 50000.0 << 0.0 << 45.0 << 0.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses 100, 400") << 100.0 << 400.0 << 0.0 << 75.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 75.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses 1500, 50000") << 1500.0 << 50000.0 << 0.0 << 75.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses 50000, 5000") << 50000.0 << 5000.0 << 0.0 << 75.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses 90000, 50000") << 90000.0 << 50000.0 << 0.0 << 75.0 << 0.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses 50000, 5000") << 50000.0 << 5000.0 << 0.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses 90000, 50000") << 90000.0 << 50000.0 << 0.0 << 90.0 << 0.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 110.6 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 110.6 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 110.6 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses 50000, 5000") << 50000.0 << 5000.0 << 0.0 << 110.6 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses 90000, 50000") << 90000.0 << 50000.0 << 0.0 << 110.6 << 0.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses 50000, 5000") << 50000.0 << 5000.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses 90000, 50000") << 90000.0 << 50000.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses 50000, 5000") << 50000.0 << 5000.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses 90000, 50000") << 90000.0 << 50000.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses 50000, 5000") << 50000.0 << 5000.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses 90000, 50000") << 90000.0 << 50000.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses 50000, 5000") << 50000.0 << 5000.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses 90000, 50000") << 90000.0 << 50000.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses 50000, 5000") << 50000.0 << 5000.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses 90000, 50000") << 90000.0 << 50000.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses 50000, 5000") << 50000.0 << 5000.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses 90000, 50000") << 90000.0 << 50000.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 100, 50") << 100.0 << 50.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 150, 400") << 150.0 << 400.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 50000, 5000") << 50000.0 << 5000.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 90000, 50000") << 90000.0 << 50000.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
// cppcheck-suppress unusedFunction
|
||||||
|
void TST_VEllipticalArc::TestGetPoints()
|
||||||
|
{
|
||||||
|
QFETCH(qreal, radius1);
|
||||||
|
QFETCH(qreal, radius2);
|
||||||
|
QFETCH(qreal, startAngle);
|
||||||
|
QFETCH(qreal, endAngle);
|
||||||
|
QFETCH(qreal, rotationAngle);
|
||||||
|
|
||||||
|
const VPointF center;
|
||||||
|
VEllipticalArc arc(center, radius1, radius2, startAngle, endAngle, rotationAngle);
|
||||||
|
|
||||||
|
QVector<QPointF> points = arc.GetPoints();
|
||||||
|
{
|
||||||
|
qreal eps = 0.5;
|
||||||
|
const QString errorMsg = QString("Broken the first rule, part 1. Any point must satisfy the equation of ellipse.");
|
||||||
|
for (int i=0; i < points.size(); ++i)
|
||||||
|
{
|
||||||
|
QPointF p = points.at(i);
|
||||||
|
const qreal equationRes = p.rx()*p.rx()/(radius1*radius1) + p.ry()*p.ry()/(radius2*radius2);
|
||||||
|
const qreal diff = qAbs(equationRes - 1);
|
||||||
|
QVERIFY2( diff <= eps, qUtf8Printable(errorMsg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const qreal c = qSqrt(qAbs(radius2*radius2 - radius1*radius1));
|
||||||
|
// distance from the center to the focus
|
||||||
|
|
||||||
|
QPointF focus1 = center.toQPointF();
|
||||||
|
QPointF focus2 = center.toQPointF();
|
||||||
|
|
||||||
|
if (radius1 < radius2)
|
||||||
|
{
|
||||||
|
focus1.setY(focus1.ry() + c);
|
||||||
|
QLineF line(center.toQPointF(), focus1);
|
||||||
|
line.setAngle(line.angle() + rotationAngle);
|
||||||
|
focus1 = line.p2();
|
||||||
|
|
||||||
|
focus2.setY(focus2.ry() - c);
|
||||||
|
line.setP2(focus2);
|
||||||
|
line.setAngle(line.angle() + rotationAngle);
|
||||||
|
focus2 = line.p2();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
focus1.setX(focus1.rx() + c);
|
||||||
|
QLineF line(center.toQPointF(), focus1);
|
||||||
|
line.setAngle(line.angle() + rotationAngle);
|
||||||
|
focus1 = line.p2();
|
||||||
|
|
||||||
|
focus2.setX(focus2.rx() - c);
|
||||||
|
line.setP2(focus2);
|
||||||
|
line.setAngle(line.angle() + rotationAngle);
|
||||||
|
focus2 = line.p2();
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF ellipsePoint(center.x() + radius1, center.y());
|
||||||
|
QLineF line(center.toQPointF(), ellipsePoint);
|
||||||
|
line.setAngle(line.angle() + rotationAngle);
|
||||||
|
ellipsePoint = line.p2();
|
||||||
|
|
||||||
|
const QLineF distance1(focus1, ellipsePoint);
|
||||||
|
const QLineF distance2(focus2, ellipsePoint);
|
||||||
|
|
||||||
|
const qreal distance = distance1.length() + distance2.length();
|
||||||
|
const qreal eps = distance * 0.5/ 100; // computing error 0.5 % from origin distance
|
||||||
|
for (int i=0; i < points.size(); ++i)
|
||||||
|
{
|
||||||
|
const QLineF rLine1(focus1, points.at(i));
|
||||||
|
const QLineF rLine2(focus2, points.at(i));
|
||||||
|
const qreal resultingDistance = rLine1.length()+rLine2.length();
|
||||||
|
const qreal diff = qAbs(resultingDistance - distance);
|
||||||
|
const QString errorMsg = QString("Broken the first rule, part 2. Distance from the any point to the focus1 plus"
|
||||||
|
" distance from this point to the focus2 should be the same. Problem with point '%1'."
|
||||||
|
" The disired distance is '%2', but resulting distance is '%3'. Difference is '%4' and it"
|
||||||
|
" biggest than eps ('%5')").arg(i).arg(distance).arg(resultingDistance).arg(diff).arg(eps);
|
||||||
|
QVERIFY2( diff <= eps, qUtf8Printable(errorMsg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if (qFuzzyCompare(arc.AngleArc(), 360.0))
|
||||||
|
{// calculated full ellipse square
|
||||||
|
const qreal ellipseSquare = M_PI * radius1 * radius2;
|
||||||
|
const qreal epsSquare = ellipseSquare * 0.24 / 100; // computing error 0.24 % from origin squere
|
||||||
|
const qreal arcSquare = qAbs(VAbstractDetail::SumTrapezoids(points)/2.0);
|
||||||
|
const qreal diffSquare = qAbs(ellipseSquare - arcSquare);
|
||||||
|
const QString errorMsg1 = QString("Broken the second rule. Interpolation has too big computing error. "
|
||||||
|
"Difference ='%1' bigger than eps = '%2'.").arg(diffSquare).arg(epsSquare);
|
||||||
|
QVERIFY2(diffSquare <= epsSquare, qUtf8Printable(errorMsg1));
|
||||||
|
|
||||||
|
// calculated full ellipse length
|
||||||
|
const qreal h = ((radius1-radius2)*(radius1-radius2))/((radius1+radius2)*(radius1+radius2));
|
||||||
|
const qreal ellipseLength = M_PI*(radius1+radius2)*(1+3*h/(10+qSqrt(4-3*h)));
|
||||||
|
const qreal epsLength = ellipseLength*0.5/100; // computing error
|
||||||
|
VEllipticalArc arc(center, radius1, radius2, 0, 360, 0);
|
||||||
|
const qreal arcLength = arc.GetLength();
|
||||||
|
const qreal diffLength = qAbs(arcLength - ellipseLength);
|
||||||
|
const QString errorMsg2 = QString("Difference between real and computing lengthes "
|
||||||
|
"(diff = '%1') bigger than eps = '%2'.").arg(diffLength).arg(epsLength);
|
||||||
|
QVERIFY2(diffLength <= epsLength, qUtf8Printable(errorMsg2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
47
src/test/ValentinaTest/tst_vellipticalarc.h
Normal file
47
src/test/ValentinaTest/tst_vellipticalarc.h
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file tst_vellipticalarc.h
|
||||||
|
** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
|
||||||
|
** @date 12 2, 2016
|
||||||
|
**
|
||||||
|
** @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/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef TST_VELLIPTICALARC_H
|
||||||
|
#define TST_VELLIPTICALARC_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class TST_VEllipticalArc : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit TST_VEllipticalArc(QObject *parent = 0);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void CompareTwoWays();
|
||||||
|
void NegativeArc();
|
||||||
|
void TestGetPoints_data();
|
||||||
|
void TestGetPoints();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TST_VELLIPTICALARC_H
|
Loading…
Reference in New Issue
Block a user