Refactoring.

Fix code style.
This commit is contained in:
Roman Telezhynskyi 2023-05-17 16:24:27 +03:00
parent 0eaf1a6b66
commit 9c0fe9131a
9 changed files with 270 additions and 271 deletions

View File

@ -27,12 +27,13 @@
*************************************************************************/ *************************************************************************/
#include "vabstractlayoutdialog.h" #include "vabstractlayoutdialog.h"
#include "../vmisc/vabstractapplication.h" #include "../vmisc/def.h"
#include "../vmisc/vmath.h" #include "../vmisc/vmath.h"
#include <QApplication>
// must be the same order as PaperSizeTemplate constants // must be the same order as PaperSizeTemplate constants
const VAbstractLayoutDialog::FormatsVector VAbstractLayoutDialog::pageFormatNames const VAbstractLayoutDialog::FormatsVector VAbstractLayoutDialog::pageFormatNames{
{
QStringLiteral("A0"), QStringLiteral("A0"),
QStringLiteral("A1"), QStringLiteral("A1"),
QStringLiteral("A2"), QStringLiteral("A2"),
@ -49,13 +50,13 @@ const VAbstractLayoutDialog::FormatsVector VAbstractLayoutDialog::pageFormatName
QApplication::translate("VAbstractLayoutDialog", "Roll 48in", "Paper format"), QApplication::translate("VAbstractLayoutDialog", "Roll 48in", "Paper format"),
QApplication::translate("VAbstractLayoutDialog", "Roll 62in", "Paper format"), QApplication::translate("VAbstractLayoutDialog", "Roll 62in", "Paper format"),
QApplication::translate("VAbstractLayoutDialog", "Roll 72in", "Paper format"), QApplication::translate("VAbstractLayoutDialog", "Roll 72in", "Paper format"),
QApplication::translate("VAbstractLayoutDialog", "Custom", "Paper format") QApplication::translate("VAbstractLayoutDialog", "Custom", "Paper format")};
};
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractLayoutDialog::VAbstractLayoutDialog(QWidget *parent) VAbstractLayoutDialog::VAbstractLayoutDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VAbstractLayoutDialog::InitTemplates(QComboBox *comboBoxTemplates) void VAbstractLayoutDialog::InitTemplates(QComboBox *comboBoxTemplates)

View File

@ -36,17 +36,17 @@
#include <QtDebug> #include <QtDebug>
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
#include "../qmuparser/qmudef.h"
#include "../qmuparser/qmuparsererror.h" #include "../qmuparser/qmuparsererror.h"
#include "../qmuparser/qmutokenparser.h" #include "../qmuparser/qmutokenparser.h"
#include "../qmuparser/qmutranslation.h" #include "../qmuparser/qmutranslation.h"
#include "../qmuparser/qmudef.h"
#include "../vpatterndb/vtranslatevars.h"
#include "../vmisc/def.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/literals.h"
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"
#include "vtranslatemeasurements.h" #include "../vmisc/def.h"
#include "../vmisc/literals.h"
#include "../vmisc/vabstractapplication.h"
#include "../vpatterndb/vtranslatevars.h"
#include "pmsystems.h" #include "pmsystems.h"
#include "vtranslatemeasurements.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VTranslateVars::VTranslateVars() VTranslateVars::VTranslateVars()
@ -203,8 +203,10 @@ void VTranslateVars::InitPatternMakingSystems()
//================================================================================================================= //=================================================================================================================
name = translate("VTranslateVars", "Fukomoto", "System name"); name = translate("VTranslateVars", "Fukomoto", "System name");
author = translate("VTranslateVars", "Sue S. Fukomoto", "Author name"); author = translate("VTranslateVars", "Sue S. Fukomoto", "Author name");
book = translate("VTranslateVars", "Scientific Pattern Drafting as taught at Style Center School of Costume " book = translate("VTranslateVars",
"Design, Dressmaking and Millinery", "Book name"); "Scientific Pattern Drafting as taught at Style Center School of Costume "
"Design, Dressmaking and Millinery",
"Book name");
InitSystem(p26_S, name, author, book); InitSystem(p26_S, name, author, book);
//================================================================================================================= //=================================================================================================================
name = translate("VTranslateVars", "Dressmaking International", "System name"); name = translate("VTranslateVars", "Dressmaking International", "System name");
@ -266,8 +268,10 @@ void VTranslateVars::InitPatternMakingSystems()
//================================================================================================================= //=================================================================================================================
name = translate("VTranslateVars", "Supreme System", "System name"); name = translate("VTranslateVars", "Supreme System", "System name");
author = translate("VTranslateVars", "Frederick T. Croonberg", "Author name"); author = translate("VTranslateVars", "Frederick T. Croonberg", "Author name");
book = translate("VTranslateVars", "The Blue Book of Men's Tailoring, Grand Edition of Supreme System for " book = translate("VTranslateVars",
"Producing Mens Garments (1907)", "Book name"); "The Blue Book of Men's Tailoring, Grand Edition of Supreme System for "
"Producing Mens Garments (1907)",
"Book name");
InitSystem(p38_S, name, author, book); InitSystem(p38_S, name, author, book);
//================================================================================================================= //=================================================================================================================
name = translate("VTranslateVars", "Sugino", "System name"); name = translate("VTranslateVars", "Sugino", "System name");
@ -328,8 +332,10 @@ void VTranslateVars::InitPatternMakingSystems()
//================================================================================================================= //=================================================================================================================
name = translate("VTranslateVars", "Mitchell", "System name"); name = translate("VTranslateVars", "Mitchell", "System name");
author = translate("VTranslateVars", "Jno. J. Mitchell", "Author name"); author = translate("VTranslateVars", "Jno. J. Mitchell", "Author name");
book = translate("VTranslateVars", "\"Standard\" Work on Cutting (Men's Garments) 1886: The Art and Science of " book = translate("VTranslateVars",
"Garment Cutting", "Book name"); "\"Standard\" Work on Cutting (Men's Garments) 1886: The Art and Science of "
"Garment Cutting",
"Book name");
InitSystem(p50_S, name, author, book); InitSystem(p50_S, name, author, book);
//================================================================================================================= //=================================================================================================================
name = translate("VTranslateVars", "GOST 17917-86", "System name"); name = translate("VTranslateVars", "GOST 17917-86", "System name");
@ -344,8 +350,10 @@ void VTranslateVars::InitPatternMakingSystems()
//================================================================================================================= //=================================================================================================================
name = translate("VTranslateVars", "Knowles/Women", "System name"); name = translate("VTranslateVars", "Knowles/Women", "System name");
author = translate("VTranslateVars", "Lori A. Knowles", "Author name"); author = translate("VTranslateVars", "Lori A. Knowles", "Author name");
book = translate("VTranslateVars", "Practical Guide to Patternmaking for Fashion Designers: Juniors, Misses, and " book = translate("VTranslateVars",
"Women", "Book name"); "Practical Guide to Patternmaking for Fashion Designers: Juniors, Misses, and "
"Women",
"Book name");
InitSystem(p53_S, name, author, book); InitSystem(p53_S, name, author, book);
//================================================================================================================= //=================================================================================================================
name = translate("VTranslateVars", "American Garment Cutter", "System name"); name = translate("VTranslateVars", "American Garment Cutter", "System name");
@ -380,24 +388,24 @@ void VTranslateVars::InitVariables()
variables.insert(angle2ElArc_, translate("VTranslateVars", "Angle2ElArc_", "Left symbol _ in the name")); variables.insert(angle2ElArc_, translate("VTranslateVars", "Angle2ElArc_", "Left symbol _ in the name"));
variables.insert(angle1Spl_, translate("VTranslateVars", "Angle1Spl_", "Left symbol _ in the name")); variables.insert(angle1Spl_, translate("VTranslateVars", "Angle1Spl_", "Left symbol _ in the name"));
variables.insert(angle2Spl_, translate("VTranslateVars", "Angle2Spl_", "Left symbol _ in the name")); variables.insert(angle2Spl_, translate("VTranslateVars", "Angle2Spl_", "Left symbol _ in the name"));
variables.insert(angle1SplPath, translate("VTranslateVars", "Angle1SplPath", variables.insert(angle1SplPath,
"Do not add symbol _ to the end of the name")); translate("VTranslateVars", "Angle1SplPath", "Do not add symbol _ to the end of the name"));
variables.insert(angle2SplPath, translate("VTranslateVars", "Angle2SplPath", variables.insert(angle2SplPath,
"Do not add symbol _ to the end of the name")); translate("VTranslateVars", "Angle2SplPath", "Do not add symbol _ to the end of the name"));
variables.insert(seg_, translate("VTranslateVars", "Seg_", "Segment. Left symbol _ in the name")); variables.insert(seg_, translate("VTranslateVars", "Seg_", "Segment. Left symbol _ in the name"));
variables.insert(currentLength, translate("VTranslateVars", "CurrentLength", "Do not add space between words")); variables.insert(currentLength, translate("VTranslateVars", "CurrentLength", "Do not add space between words"));
variables.insert(currentSeamAllowance, translate("VTranslateVars", "CurrentSeamAllowance", variables.insert(currentSeamAllowance,
"Do not add space between words")); translate("VTranslateVars", "CurrentSeamAllowance", "Do not add space between words"));
variables.insert(c1LengthSpl_, translate("VTranslateVars", "C1LengthSpl_", "Left symbol _ in the name")); variables.insert(c1LengthSpl_, translate("VTranslateVars", "C1LengthSpl_", "Left symbol _ in the name"));
variables.insert(c2LengthSpl_, translate("VTranslateVars", "C2LengthSpl_", "Left symbol _ in the name")); variables.insert(c2LengthSpl_, translate("VTranslateVars", "C2LengthSpl_", "Left symbol _ in the name"));
variables.insert(c1LengthSplPath, translate("VTranslateVars", "C1LengthSplPath", variables.insert(c1LengthSplPath,
"Do not add symbol _ to the end of the name")); translate("VTranslateVars", "C1LengthSplPath", "Do not add symbol _ to the end of the name"));
variables.insert(c2LengthSplPath, translate("VTranslateVars", "C2LengthSplPath", variables.insert(c2LengthSplPath,
"Do not add symbol _ to the end of the name")); translate("VTranslateVars", "C2LengthSplPath", "Do not add symbol _ to the end of the name"));
variables.insert(rotationElArc_, translate("VTranslateVars", "RotationElArc_", "Left symbol _ in the name")); variables.insert(rotationElArc_, translate("VTranslateVars", "RotationElArc_", "Left symbol _ in the name"));
variables.insert(pieceArea_, translate("VTranslateVars", "PieceArea_", "Left symbol _ in the name")); variables.insert(pieceArea_, translate("VTranslateVars", "PieceArea_", "Left symbol _ in the name"));
variables.insert(pieceSeamLineArea_, translate("VTranslateVars", "PieceSeamLineArea_", variables.insert(pieceSeamLineArea_,
"Left symbol _ in the name")); translate("VTranslateVars", "PieceSeamLineArea_", "Left symbol _ in the name"));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -408,43 +416,43 @@ void VTranslateVars::InitFunctions()
const QString threeArguments = QStringLiteral("(;;)"); const QString threeArguments = QStringLiteral("(;;)");
functions.insert(degTorad_F, translate("VTranslateVars", "degTorad", "converts degrees to radian")); functions.insert(degTorad_F, translate("VTranslateVars", "degTorad", "converts degrees to radian"));
functionsDescriptions.insert(degTorad_F, translate("VTranslateVars", "converts degrees to radian", functionsDescriptions.insert(degTorad_F,
"function degTorad")); translate("VTranslateVars", "converts degrees to radian", "function degTorad"));
functionsArguments.insert(degTorad_F, oneArgument); functionsArguments.insert(degTorad_F, oneArgument);
functions.insert(radTodeg_F, translate("VTranslateVars", "radTodeg", "converts radian to degrees")); functions.insert(radTodeg_F, translate("VTranslateVars", "radTodeg", "converts radian to degrees"));
functionsDescriptions.insert(radTodeg_F, translate("VTranslateVars", "converts radian to degrees", functionsDescriptions.insert(radTodeg_F,
"function radTodeg")); translate("VTranslateVars", "converts radian to degrees", "function radTodeg"));
functionsArguments.insert(radTodeg_F, oneArgument); functionsArguments.insert(radTodeg_F, oneArgument);
functions.insert(sin_F, translate("VTranslateVars", "sin", "sine function working with radians")); functions.insert(sin_F, translate("VTranslateVars", "sin", "sine function working with radians"));
functionsDescriptions.insert(sin_F, translate("VTranslateVars", "sine function working with radians", functionsDescriptions.insert(sin_F,
"function sin")); translate("VTranslateVars", "sine function working with radians", "function sin"));
functionsArguments.insert(sin_F, oneArgument); functionsArguments.insert(sin_F, oneArgument);
functions.insert(cos_F, translate("VTranslateVars", "cos", "cosine function working with radians")); functions.insert(cos_F, translate("VTranslateVars", "cos", "cosine function working with radians"));
functionsDescriptions.insert(cos_F, translate("VTranslateVars", "cosine function working with radians", functionsDescriptions.insert(cos_F,
"function cos")); translate("VTranslateVars", "cosine function working with radians", "function cos"));
functionsArguments.insert(cos_F, oneArgument); functionsArguments.insert(cos_F, oneArgument);
functions.insert(tan_F, translate("VTranslateVars", "tan", "tangens function working with radians")); functions.insert(tan_F, translate("VTranslateVars", "tan", "tangens function working with radians"));
functionsDescriptions.insert(tan_F, translate("VTranslateVars", "tangens function working with radians", functionsDescriptions.insert(tan_F,
"function tan")); translate("VTranslateVars", "tangens function working with radians", "function tan"));
functionsArguments.insert(tan_F, oneArgument); functionsArguments.insert(tan_F, oneArgument);
functions.insert(asin_F, translate("VTranslateVars", "asin", "arcus sine function working with radians")); functions.insert(asin_F, translate("VTranslateVars", "asin", "arcus sine function working with radians"));
functionsDescriptions.insert(asin_F, translate("VTranslateVars", "arcus sine function working with radians", functionsDescriptions.insert(
"function asin")); asin_F, translate("VTranslateVars", "arcus sine function working with radians", "function asin"));
functionsArguments.insert(asin_F, oneArgument); functionsArguments.insert(asin_F, oneArgument);
functions.insert(acos_F, translate("VTranslateVars", "acos", "arcus cosine function working with radians")); functions.insert(acos_F, translate("VTranslateVars", "acos", "arcus cosine function working with radians"));
functionsDescriptions.insert(acos_F, translate("VTranslateVars", "arcus cosine function working with radians", functionsDescriptions.insert(
"function acos")); acos_F, translate("VTranslateVars", "arcus cosine function working with radians", "function acos"));
functionsArguments.insert(acos_F, oneArgument); functionsArguments.insert(acos_F, oneArgument);
functions.insert(atan_F, translate("VTranslateVars", "atan", "arcus tangens function working with radians")); functions.insert(atan_F, translate("VTranslateVars", "atan", "arcus tangens function working with radians"));
functionsDescriptions.insert(atan_F, translate("VTranslateVars", "arcus tangens function working with radians", functionsDescriptions.insert(
"function atan")); atan_F, translate("VTranslateVars", "arcus tangens function working with radians", "function atan"));
functionsArguments.insert(atan_F, oneArgument); functionsArguments.insert(atan_F, oneArgument);
functions.insert(sinh_F, translate("VTranslateVars", "sinh", "hyperbolic sine function")); functions.insert(sinh_F, translate("VTranslateVars", "sinh", "hyperbolic sine function"));
@ -460,48 +468,48 @@ void VTranslateVars::InitFunctions()
functionsArguments.insert(tanh_F, oneArgument); functionsArguments.insert(tanh_F, oneArgument);
functions.insert(asinh_F, translate("VTranslateVars", "asinh", "hyperbolic arcus sine function")); functions.insert(asinh_F, translate("VTranslateVars", "asinh", "hyperbolic arcus sine function"));
functionsDescriptions.insert(asinh_F, translate("VTranslateVars", "hyperbolic arcus sine function", functionsDescriptions.insert(asinh_F,
"function asinh")); translate("VTranslateVars", "hyperbolic arcus sine function", "function asinh"));
functionsArguments.insert(asinh_F, oneArgument); functionsArguments.insert(asinh_F, oneArgument);
functions.insert(acosh_F, translate("VTranslateVars", "acosh", "hyperbolic arcus cosine function")); functions.insert(acosh_F, translate("VTranslateVars", "acosh", "hyperbolic arcus cosine function"));
functionsDescriptions.insert(acosh_F, translate("VTranslateVars", "hyperbolic arcus cosine function", functionsDescriptions.insert(acosh_F,
"function acosh")); translate("VTranslateVars", "hyperbolic arcus cosine function", "function acosh"));
functionsArguments.insert(acosh_F, oneArgument); functionsArguments.insert(acosh_F, oneArgument);
functions.insert(atanh_F, translate("VTranslateVars", "atanh", "hyperbolic arcur tangens function")); functions.insert(atanh_F, translate("VTranslateVars", "atanh", "hyperbolic arcur tangens function"));
functionsDescriptions.insert(atanh_F, translate("VTranslateVars", "hyperbolic arcur tangens function", functionsDescriptions.insert(atanh_F,
"function atanh")); translate("VTranslateVars", "hyperbolic arcur tangens function", "function atanh"));
functionsArguments.insert(atanh_F, oneArgument); functionsArguments.insert(atanh_F, oneArgument);
functions.insert(sinD_F, translate("VTranslateVars", "sinD", "sine function working with degrees")); functions.insert(sinD_F, translate("VTranslateVars", "sinD", "sine function working with degrees"));
functionsDescriptions.insert(sinD_F, translate("VTranslateVars", "sine function working with degrees", functionsDescriptions.insert(sinD_F,
"function sinD")); translate("VTranslateVars", "sine function working with degrees", "function sinD"));
functionsArguments.insert(sinD_F, oneArgument); functionsArguments.insert(sinD_F, oneArgument);
functions.insert(cosD_F, translate("VTranslateVars", "cosD", "cosine function working with degrees")); functions.insert(cosD_F, translate("VTranslateVars", "cosD", "cosine function working with degrees"));
functionsDescriptions.insert(cosD_F, translate("VTranslateVars", "cosine function working with degrees", functionsDescriptions.insert(cosD_F,
"function cosD")); translate("VTranslateVars", "cosine function working with degrees", "function cosD"));
functionsArguments.insert(cosD_F, oneArgument); functionsArguments.insert(cosD_F, oneArgument);
functions.insert(tanD_F, translate("VTranslateVars", "tanD", "tangens function working with degrees")); functions.insert(tanD_F, translate("VTranslateVars", "tanD", "tangens function working with degrees"));
functionsDescriptions.insert(tanD_F, translate("VTranslateVars", "tangens function working with degrees", functionsDescriptions.insert(tanD_F,
"function tanD")); translate("VTranslateVars", "tangens function working with degrees", "function tanD"));
functionsArguments.insert(tanD_F, oneArgument); functionsArguments.insert(tanD_F, oneArgument);
functions.insert(asinD_F, translate("VTranslateVars", "asinD", "arcus sine function working with degrees")); functions.insert(asinD_F, translate("VTranslateVars", "asinD", "arcus sine function working with degrees"));
functionsDescriptions.insert(asinD_F, translate("VTranslateVars", "arcus sine function working with degrees", functionsDescriptions.insert(
"function asinD")); asinD_F, translate("VTranslateVars", "arcus sine function working with degrees", "function asinD"));
functionsArguments.insert(asinD_F, oneArgument); functionsArguments.insert(asinD_F, oneArgument);
functions.insert(acosD_F, translate("VTranslateVars", "acosD", "arcus cosine function working with degrees")); functions.insert(acosD_F, translate("VTranslateVars", "acosD", "arcus cosine function working with degrees"));
functionsDescriptions.insert(acosD_F, translate("VTranslateVars", "arcus cosine function working with degrees", functionsDescriptions.insert(
"function acosD")); acosD_F, translate("VTranslateVars", "arcus cosine function working with degrees", "function acosD"));
functionsArguments.insert(acosD_F, oneArgument); functionsArguments.insert(acosD_F, oneArgument);
functions.insert(atanD_F, translate("VTranslateVars", "atanD", "arcus tangens function working with degrees")); functions.insert(atanD_F, translate("VTranslateVars", "atanD", "arcus tangens function working with degrees"));
functionsDescriptions.insert(atanD_F, translate("VTranslateVars", "arcus tangens function working with degrees", functionsDescriptions.insert(
"function atanD")); atanD_F, translate("VTranslateVars", "arcus tangens function working with degrees", "function atanD"));
functionsArguments.insert(atanD_F, oneArgument); functionsArguments.insert(atanD_F, oneArgument);
functions.insert(log2_F, translate("VTranslateVars", "log2", "logarithm to the base 2")); functions.insert(log2_F, translate("VTranslateVars", "log2", "logarithm to the base 2"));
@ -529,8 +537,8 @@ void VTranslateVars::InitFunctions()
functionsArguments.insert(sqrt_F, oneArgument); functionsArguments.insert(sqrt_F, oneArgument);
functions.insert(sign_F, translate("VTranslateVars", "sign", "sign function -1 if x<0; 1 if x>0")); functions.insert(sign_F, translate("VTranslateVars", "sign", "sign function -1 if x<0; 1 if x>0"));
functionsDescriptions.insert(sign_F, translate("VTranslateVars", "sign function -1 if x<0; 1 if x>0", functionsDescriptions.insert(sign_F,
"function sign")); translate("VTranslateVars", "sign function -1 if x<0; 1 if x>0", "function sign"));
functionsArguments.insert(sign_F, oneArgument); functionsArguments.insert(sign_F, oneArgument);
functions.insert(rint_F, translate("VTranslateVars", "rint", "round to nearest integer")); functions.insert(rint_F, translate("VTranslateVars", "rint", "round to nearest integer"));
@ -541,16 +549,22 @@ void VTranslateVars::InitFunctions()
functionsDescriptions.insert(r2cm_F, translate("VTranslateVars", "round to up to 1 decimal", "function r2cm")); functionsDescriptions.insert(r2cm_F, translate("VTranslateVars", "round to up to 1 decimal", "function r2cm"));
functionsArguments.insert(r2cm_F, oneArgument); functionsArguments.insert(r2cm_F, oneArgument);
functions.insert(csrCm_F, translate("VTranslateVars", "csrCm", "cut, split and rotate modeling operation. Takes" functions.insert(csrCm_F, translate("VTranslateVars", "csrCm",
"cut, split and rotate modeling operation. Takes"
" cm units.")); " cm units."));
functionsDescriptions.insert(csrCm_F, translate("VTranslateVars", "cut, split and rotate modeling operation. Takes " functionsDescriptions.insert(csrCm_F, translate("VTranslateVars",
"cm units.", "function csrCm")); "cut, split and rotate modeling operation. Takes "
"cm units.",
"function csrCm"));
functionsArguments.insert(csrCm_F, threeArguments); functionsArguments.insert(csrCm_F, threeArguments);
functions.insert(csrInch_F, translate("VTranslateVars", "csrInch", "cut, split and rotate modeling operation. Takes" functions.insert(csrInch_F, translate("VTranslateVars", "csrInch",
"cut, split and rotate modeling operation. Takes"
" inch units.")); " inch units."));
functionsDescriptions.insert(csrInch_F, translate("VTranslateVars", "cut, split and rotate modeling operation. " functionsDescriptions.insert(csrInch_F, translate("VTranslateVars",
"Takes inch units.", "function csrInch")); "cut, split and rotate modeling operation. "
"Takes inch units.",
"function csrInch"));
functionsArguments.insert(csrInch_F, threeArguments); functionsArguments.insert(csrInch_F, threeArguments);
functions.insert(abs_F, translate("VTranslateVars", "abs", "absolute value")); functions.insert(abs_F, translate("VTranslateVars", "abs", "absolute value"));
@ -575,14 +589,15 @@ void VTranslateVars::InitFunctions()
functions.insert(fmod_F, translate("VTranslateVars", "fmod", functions.insert(fmod_F, translate("VTranslateVars", "fmod",
"Returns the floating-point remainder of numer/denom (rounded towards zero)")); "Returns the floating-point remainder of numer/denom (rounded towards zero)"));
functionsDescriptions.insert(fmod_F, translate("VTranslateVars", "Returns the floating-point remainder of " functionsDescriptions.insert(fmod_F, translate("VTranslateVars",
"Returns the floating-point remainder of "
"numer/denom (rounded towards zero)", "numer/denom (rounded towards zero)",
"function fmod")); "function fmod"));
functionsArguments.insert(fmod_F, twoArguments); functionsArguments.insert(fmod_F, twoArguments);
functions.insert(warning_F, translate("VTranslateVars", "warning", "Calculation warning")); functions.insert(warning_F, translate("VTranslateVars", "warning", "Calculation warning"));
functionsDescriptions.insert(warning_F, translate("VTranslateVars", "Show a warning in calculations", functionsDescriptions.insert(warning_F,
"function warning")); translate("VTranslateVars", "Show a warning in calculations", "function warning"));
functionsArguments.insert(warning_F, twoArguments); functionsArguments.insert(warning_F, twoArguments);
} }
@ -730,12 +745,12 @@ void VTranslateVars::TranslateVarsToUser(QString &newFormula, QMap<vsizetype, QS
{ {
if (measurements.contains(tValues.at(i))) if (measurements.contains(tValues.at(i)))
{ {
newFormula.replace(tKeys.at(i), tValues.at(i).length(), newFormula.replace(
measurements.value(tValues.at(i)) tKeys.at(i), tValues.at(i).length(),
.translate(VAbstractApplication::VApp()->Settings()->GetLocale())); measurements.value(tValues.at(i)).translate(VAbstractApplication::VApp()->Settings()->GetLocale()));
auto bias = tValues.at(i).length() - auto bias = tValues.at(i).length() - measurements.value(tValues.at(i))
measurements.value(tValues.at(i)) .translate(VAbstractApplication::VApp()->Settings()->GetLocale())
.translate(VAbstractApplication::VApp()->Settings()->GetLocale()).length(); .length();
if (bias != 0) if (bias != 0)
{ // Translated token has different length than original. Position next tokens need to be corrected. { // Translated token has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers); CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
@ -747,12 +762,12 @@ void VTranslateVars::TranslateVarsToUser(QString &newFormula, QMap<vsizetype, QS
if (functions.contains(tValues.at(i))) if (functions.contains(tValues.at(i)))
{ {
newFormula.replace(tKeys.at(i), tValues.at(i).length(), newFormula.replace(
functions.value(tValues.at(i)) tKeys.at(i), tValues.at(i).length(),
.translate(VAbstractApplication::VApp()->Settings()->GetLocale())); functions.value(tValues.at(i)).translate(VAbstractApplication::VApp()->Settings()->GetLocale()));
auto bias = tValues.at(i).length() - auto bias = tValues.at(i).length() - functions.value(tValues.at(i))
functions.value(tValues.at(i)) .translate(VAbstractApplication::VApp()->Settings()->GetLocale())
.translate(VAbstractApplication::VApp()->Settings()->GetLocale()).length(); .length();
if (bias != 0) if (bias != 0)
{ // Translated token has different length than original. Position next tokens need to be corrected. { // Translated token has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers); CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
@ -845,8 +860,6 @@ void VTranslateVars::BiasTokens(vsizetype position, vsizetype bias, QMap<vsizety
tokens = newTokens; tokens = newTokens;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief VariablesFromUser translate variable to internal look. * @brief VariablesFromUser translate variable to internal look.
@ -861,8 +874,8 @@ auto VTranslateVars::VariablesFromUser(QString &newFormula, vsizetype position,
{ {
const QString currentLengthTr = const QString currentLengthTr =
variables.value(currentLength).translate(VAbstractApplication::VApp()->Settings()->GetLocale()); variables.value(currentLength).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
const QString currentSeamAllowanceTr = variables.value(currentSeamAllowance) const QString currentSeamAllowanceTr =
.translate(VAbstractApplication::VApp()->Settings()->GetLocale()); variables.value(currentSeamAllowance).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
QMap<QString, qmu::QmuTranslation>::const_iterator i = variables.constBegin(); QMap<QString, qmu::QmuTranslation>::const_iterator i = variables.constBegin();
while (i != variables.constEnd()) while (i != variables.constEnd())

View File

@ -29,20 +29,20 @@
#ifndef ABSTRACTTEST_H #ifndef ABSTRACTTEST_H
#define ABSTRACTTEST_H #define ABSTRACTTEST_H
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QMetaObject> #include <QMetaObject>
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <QJsonDocument> #include <QtCore/qcontainerfwd.h>
#include <QJsonObject>
#include <QJsonArray>
#include <qtestcase.h> #include <qtestcase.h>
#include <typeinfo> #include <typeinfo>
#include <QtCore/qcontainerfwd.h>
#include "../vgeometry/vpointf.h"
#include "../vlayout/vsapoint.h"
#include "../vlayout/vrawsapoint.h"
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"
#include "../vgeometry/vpointf.h"
#include "../vlayout/vrawsapoint.h"
#include "../vlayout/vsapoint.h"
#include <ciso646> #include <ciso646>
@ -60,7 +60,13 @@ static const auto V_UNUSED TST_EX_CRASH = -4; // Program crashed.
#undef V_UNUSED #undef V_UNUSED
enum ErrorState {ErrorLoad = 0, ErrorInstall, ErrorSize, NoError}; enum ErrorState
{
ErrorLoad = 0,
ErrorInstall,
ErrorSize,
NoError
};
class VPiece; class VPiece;
class VContainer; class VContainer;
@ -74,11 +80,9 @@ class VRawSAPoint;
class AbstractTest : public QObject class AbstractTest : public QObject
{ {
Q_OBJECT // NOLINT Q_OBJECT // NOLINT
public: public : explicit AbstractTest(QObject *parent = nullptr);
explicit AbstractTest(QObject *parent = nullptr);
template <class T> template <class T> static auto VectorFromJson(const QString &json) -> QVector<T>;
static auto VectorFromJson(const QString &json) -> QVector<T>;
void PieceFromJson(const QString &json, VPiece &piece, QSharedPointer<VContainer> &data); void PieceFromJson(const QString &json, VPiece &piece, QSharedPointer<VContainer> &data);
@ -122,14 +126,11 @@ protected:
void ReadSplinePointValue(const QJsonObject &itemObject, VSplinePoint &point); void ReadSplinePointValue(const QJsonObject &itemObject, VSplinePoint &point);
void ReadPieceNodeValue(const QJsonObject &itemObject, VPieceNode &node); void ReadPieceNodeValue(const QJsonObject &itemObject, VPieceNode &node);
template <class T> template <class T> static void CheckClassType(const QJsonObject &itemObject);
static void CheckClassType(const QJsonObject &itemObject);
template <class T> template <class T> static auto ReadPointData(const QJsonObject &pointObject) -> T;
static auto ReadPointData(const QJsonObject &pointObject) -> T;
template <class T> template <class T> static auto PointFromJson(const QJsonObject &pointObject, T &point) -> void;
static auto PointFromJson(const QJsonObject &pointObject, T &point) -> void;
auto QLineFromJson(const QJsonObject &itemObject) -> QLineF; auto QLineFromJson(const QJsonObject &itemObject) -> QLineF;
void SplineFromJson(const QJsonObject &itemObject, QSharedPointer<VContainer> &data); void SplineFromJson(const QJsonObject &itemObject, QSharedPointer<VContainer> &data);
@ -140,8 +141,7 @@ protected:
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template<class T> template <class T> inline auto AbstractTest::VectorFromJson(const QString &json) -> QVector<T>
inline auto AbstractTest::VectorFromJson(const QString &json) -> QVector<T>
{ {
QByteArray saveData; QByteArray saveData;
PrepareDocument(json, saveData); PrepareDocument(json, saveData);
@ -174,16 +174,14 @@ inline auto AbstractTest::VectorFromJson(const QString &json) -> QVector<T>
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template<class T> template <class T> inline void AbstractTest::CheckClassType(const QJsonObject &itemObject)
inline void AbstractTest::CheckClassType(const QJsonObject &itemObject)
{ {
const QString typeKey = QStringLiteral("type"); const QString typeKey = QStringLiteral("type");
QString type; QString type;
AbstractTest::ReadStringValue(itemObject, typeKey, type); AbstractTest::ReadStringValue(itemObject, typeKey, type);
const QStringList types const QStringList types{
{
QStringLiteral("QPointF"), // 0 QStringLiteral("QPointF"), // 0
QStringLiteral("VLayoutPoint"), // 1 QStringLiteral("VLayoutPoint"), // 1
QStringLiteral("VRawSAPoint"), // 2 QStringLiteral("VRawSAPoint"), // 2
@ -216,8 +214,7 @@ inline void AbstractTest::CheckClassType(const QJsonObject &itemObject)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template<class T> template <class T> inline auto AbstractTest::ReadPointData(const QJsonObject &pointObject) -> T
inline auto AbstractTest::ReadPointData(const QJsonObject &pointObject) -> T
{ {
T point; T point;
qreal x = 0; qreal x = 0;
@ -232,16 +229,14 @@ inline auto AbstractTest::ReadPointData(const QJsonObject &pointObject) -> T
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template<class T> template <class T> inline auto AbstractTest::PointFromJson(const QJsonObject &pointObject, T &point) -> void
inline auto AbstractTest::PointFromJson(const QJsonObject &pointObject, T &point) -> void
{ {
CheckClassType<T>(pointObject); CheckClassType<T>(pointObject);
point = ReadPointData<T>(pointObject); point = ReadPointData<T>(pointObject);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template<> template <> inline auto AbstractTest::PointFromJson(const QJsonObject &pointObject, VPointF &point) -> void
inline auto AbstractTest::PointFromJson(const QJsonObject &pointObject, VPointF &point) -> void
{ {
vidtype id = NULL_ID; vidtype id = NULL_ID;
AbstractTest::ReadDoubleValue(pointObject, QStringLiteral("id"), id); AbstractTest::ReadDoubleValue(pointObject, QStringLiteral("id"), id);
@ -266,8 +261,7 @@ inline auto AbstractTest::PointFromJson(const QJsonObject &pointObject, VPointF
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template<> template <> inline auto AbstractTest::ReadPointData(const QJsonObject &pointObject) -> VLayoutPoint
inline auto AbstractTest::ReadPointData(const QJsonObject &pointObject) -> VLayoutPoint
{ {
VLayoutPoint point(ReadPointData<QPointF>(pointObject)); VLayoutPoint point(ReadPointData<QPointF>(pointObject));
@ -283,16 +277,14 @@ inline auto AbstractTest::ReadPointData(const QJsonObject &pointObject) -> VLayo
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template<> template <> inline auto AbstractTest::PointFromJson(const QJsonObject &pointObject, VLayoutPoint &point) -> void
inline auto AbstractTest::PointFromJson(const QJsonObject &pointObject, VLayoutPoint &point) -> void
{ {
CheckClassType<VLayoutPoint>(pointObject); CheckClassType<VLayoutPoint>(pointObject);
point = ReadPointData<VLayoutPoint>(pointObject); point = ReadPointData<VLayoutPoint>(pointObject);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template<> template <> inline auto AbstractTest::PointFromJson(const QJsonObject &pointObject, VSAPoint &point) -> void
inline auto AbstractTest::PointFromJson(const QJsonObject &pointObject, VSAPoint &point) -> void
{ {
CheckClassType<VSAPoint>(pointObject); CheckClassType<VSAPoint>(pointObject);
@ -357,8 +349,7 @@ inline auto AbstractTest::PointFromJson(const QJsonObject &pointObject, VSAPoint
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template<> template <> inline auto AbstractTest::PointFromJson(const QJsonObject &pointObject, VRawSAPoint &point) -> void
inline auto AbstractTest::PointFromJson(const QJsonObject &pointObject, VRawSAPoint &point) -> void
{ {
CheckClassType<VRawSAPoint>(pointObject); CheckClassType<VRawSAPoint>(pointObject);

View File

@ -28,11 +28,11 @@
#include <QtTest> #include <QtTest>
#include "tst_measurementregexp.h"
#include "tst_buitinregexp.h" #include "tst_buitinregexp.h"
#include "tst_measurementregexp.h"
#include "tst_qmuparsererrormsg.h" #include "tst_qmuparsererrormsg.h"
#include "tst_tstranslation.h"
#include "tst_tslocaletranslation.h" #include "tst_tslocaletranslation.h"
#include "tst_tstranslation.h"
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vmisc/testvapplication.h" #include "../vmisc/testvapplication.h"

View File

@ -29,12 +29,11 @@
#include "tst_abstractregexp.h" #include "tst_abstractregexp.h"
#include "../qmuparser/qmudef.h" #include "../qmuparser/qmudef.h"
#include "../qmuparser/qmuformulabase.h" #include "../qmuparser/qmuformulabase.h"
#include "../vpatterndb/vtranslatevars.h"
#include "../ifc/ifcdef.h"
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"
#include "../vpatterndb/vtranslatevars.h"
#include <QtTest>
#include <QTranslator> #include <QTranslator>
#include <QtTest>
namespace namespace
{ {
@ -114,8 +113,7 @@ void TST_AbstractRegExp::RemoveTrVariables(const QString &checkedLocale)
if (result == false) if (result == false)
{ {
const QString message = QString("Can't remove translation variables for locale = %1") const QString message = QString("Can't remove translation variables for locale = %1").arg(checkedLocale);
.arg(checkedLocale);
QWARN(qUtf8Printable(message)); QWARN(qUtf8Printable(message));
} }
delete m_vTranslator; delete m_vTranslator;
@ -143,8 +141,7 @@ void TST_AbstractRegExp::CallTestCheckNoEndLine()
const QString translated = m_trMs->VarToUser(originalName); const QString translated = m_trMs->VarToUser(originalName);
if (translated.endsWith(QLatin1String("\n"))) if (translated.endsWith(QLatin1String("\n")))
{ {
const QString message = QString("Translated string '%1' shouldn't contain new line character.") const QString message = QString("Translated string '%1' shouldn't contain new line character.").arg(translated);
.arg(translated);
QFAIL(qUtf8Printable(message)); QFAIL(qUtf8Printable(message));
} }
} }
@ -193,8 +190,8 @@ void TST_AbstractRegExp::CallTestForValidCharacters()
if (QLocale() == QLocale(QStringLiteral("zh_CN")) || QLocale() == QLocale(QStringLiteral("he_IL"))) if (QLocale() == QLocale(QStringLiteral("zh_CN")) || QLocale() == QLocale(QStringLiteral("he_IL")))
{ {
const QString message = QStringLiteral("We do not support translation of variables for locale %1") const QString message =
.arg(QLocale().name()); QStringLiteral("We do not support translation of variables for locale %1").arg(QLocale().name());
QSKIP(qUtf8Printable(message)); QSKIP(qUtf8Printable(message));
} }
@ -203,7 +200,10 @@ void TST_AbstractRegExp::CallTestForValidCharacters()
if (pos != -1) if (pos != -1)
{ {
const QString message = QStringLiteral("Translated string '%1' contains invalid character '%2' at " const QString message = QStringLiteral("Translated string '%1' contains invalid character '%2' at "
"position '%3'.").arg(translated).arg(translated.at(pos)).arg(pos); "position '%3'.")
.arg(translated)
.arg(translated.at(pos))
.arg(pos);
QFAIL(qUtf8Printable(message)); QFAIL(qUtf8Printable(message));
} }
} }

View File

@ -27,13 +27,11 @@
*************************************************************************/ *************************************************************************/
#include "tst_measurementregexp.h" #include "tst_measurementregexp.h"
#include "../qmuparser/qmudef.h"
#include "../vpatterndb/vtranslatevars.h"
#include "../vpatterndb/measurements.h" #include "../vpatterndb/measurements.h"
#include "../ifc/ifcdef.h" #include "../vpatterndb/vtranslatevars.h"
#include "abstracttest.h"
#include <QtTest>
#include <QTranslator> #include <QTranslator>
const quint32 TST_MeasurementRegExp::systemCounts = 56; // count of pattern making systems const quint32 TST_MeasurementRegExp::systemCounts = 56; // count of pattern making systems
@ -202,8 +200,8 @@ void TST_MeasurementRegExp::TestCombinations(int systemCounts, const QStringList
const QStringList fileNames = dir.entryList(QStringList("measurements_p*_*.qm")); const QStringList fileNames = dir.entryList(QStringList("measurements_p*_*.qm"));
// cppcheck-suppress unreadVariable // cppcheck-suppress unreadVariable
const QString error = QString("Unexpected count of files. Excpected %1, got %2.") const QString error =
.arg(combinations).arg(fileNames.size()); QString("Unexpected count of files. Excpected %1, got %2.").arg(combinations).arg(fileNames.size());
QVERIFY2(combinations == fileNames.size(), qUtf8Printable(error)); QVERIFY2(combinations == fileNames.size(), qUtf8Printable(error));
} }
@ -279,8 +277,8 @@ void TST_MeasurementRegExp::RemoveTrMeasurements(const QString &checkedSystem, c
if (result == false) if (result == false)
{ {
const QString message = QString("Can't remove translation for system = %1 and locale = %2") const QString message =
.arg(checkedSystem, checkedLocale); QString("Can't remove translation for system = %1 and locale = %2").arg(checkedSystem, checkedLocale);
QWARN(qUtf8Printable(message)); QWARN(qUtf8Printable(message));
} }
delete m_pmsTranslator; delete m_pmsTranslator;

View File

@ -29,8 +29,8 @@
#ifndef TST_MEASUREMENTREGEXP_H #ifndef TST_MEASUREMENTREGEXP_H
#define TST_MEASUREMENTREGEXP_H #define TST_MEASUREMENTREGEXP_H
#include "tst_abstractregexp.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
#include "tst_abstractregexp.h"
#include <QPointer> #include <QPointer>
@ -72,7 +72,7 @@ private:
QString m_system; QString m_system;
QPointer<QTranslator> m_pmsTranslator; QPointer<QTranslator> m_pmsTranslator;
void TestCombinations(int systemCounts, const QStringList &locales) const; void TestCombinations(const QStringList &locales) const;
auto LoadMeasurements(const QString &checkedSystem, const QString &checkedLocale) -> int; auto LoadMeasurements(const QString &checkedSystem, const QString &checkedLocale) -> int;
void RemoveTrMeasurements(const QString &checkedSystem, const QString &checkedLocale); void RemoveTrMeasurements(const QString &checkedSystem, const QString &checkedLocale);

View File

@ -38,7 +38,8 @@ Q_DECLARE_METATYPE(Qt::LayoutDirection)
TST_TSLocaleTranslation::TST_TSLocaleTranslation(const QString &locale, QObject *parent) TST_TSLocaleTranslation::TST_TSLocaleTranslation(const QString &locale, QObject *parent)
: TST_AbstractTranslation(parent), : TST_AbstractTranslation(parent),
m_locale(locale) m_locale(locale)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TST_TSLocaleTranslation::CheckPlaceMarkerExist_data() void TST_TSLocaleTranslation::CheckPlaceMarkerExist_data()
@ -82,8 +83,8 @@ void TST_TSLocaleTranslation::CheckPlaceMarkerExist_data()
continue; continue;
} }
const QString caseName = QStringLiteral("File '%1'. Check place holder source message '%2'") const QString caseName =
.arg(filename, source); QStringLiteral("File '%1'. Check place holder source message '%2'").arg(filename, source);
QTest::newRow(qUtf8Printable(caseName)) << source << translation << locale.textDirection(); QTest::newRow(qUtf8Printable(caseName)) << source << translation << locale.textDirection();
} }
else else
@ -116,9 +117,8 @@ void TST_TSLocaleTranslation::CheckPlaceMarkerExist()
++sourceMarkCount; ++sourceMarkCount;
if (sourceMarkCount != i) if (sourceMarkCount != i)
{ {
const QString message = QString("In source string '%1' was missed place marker ") const QString message = QString("In source string '%1' was missed place marker ").arg(source) +
.arg(source) + QLatin1String("'%") + QString().setNum(sourceMarkCount) + QLatin1String("'%") + QString().setNum(sourceMarkCount) + QLatin1String("'.");
QLatin1String("'.");
QFAIL(qUtf8Printable(message)); QFAIL(qUtf8Printable(message));
} }
} }
@ -129,9 +129,9 @@ void TST_TSLocaleTranslation::CheckPlaceMarkerExist()
++translationMarkCount; ++translationMarkCount;
if (translationMarkCount != i) if (translationMarkCount != i)
{ {
const QString message = QString("In translation string '%1' was missed place marker ") const QString message =
.arg(translation) + QLatin1String("'%") + QString().setNum(translationMarkCount) + QString("In translation string '%1' was missed place marker ").arg(translation) +
QLatin1String("'."); QLatin1String("'%") + QString().setNum(translationMarkCount) + QLatin1String("'.");
QFAIL(qUtf8Printable(message)); QFAIL(qUtf8Printable(message));
} }
} }
@ -207,17 +207,10 @@ void TST_TSLocaleTranslation::TestPunctuation()
QFETCH(QString, translation); QFETCH(QString, translation);
static const QStringList punctuation{ static const QStringList punctuation{
QChar('.'), QChar('.'), QChar(':'), QChar(QChar::Space), QChar('\n'), QChar('!'), QChar('?'), QChar(';'),
QChar(':'),
QChar(QChar::Space),
QChar('\n'),
QChar('!'),
QChar('?'),
QChar(';'),
QChar(0x2026) // … QChar(0x2026) // …
}; };
if (QLocale(locale).textDirection() != Qt::LeftToRight) if (QLocale(locale).textDirection() != Qt::LeftToRight)
{ {
QSKIP("Not supported text direction"); QSKIP("Not supported text direction");
@ -261,7 +254,9 @@ void TST_TSLocaleTranslation::TestPunctuation()
if (testFail) if (testFail)
{ {
const QString message = QString("Translation string does not end with the same punctuation character '%1' or " const QString message = QString("Translation string does not end with the same punctuation character '%1' or "
"vice versa. ").arg(cPunctuation) + QString("Original name:'%1'").arg(source) + "vice versa. ")
.arg(cPunctuation) +
QString("Original name:'%1'").arg(source) +
QString(", translated name:'%1'").arg(translation); QString(", translated name:'%1'").arg(translation);
QFAIL(qUtf8Printable(message)); QFAIL(qUtf8Printable(message));
} }
@ -324,9 +319,8 @@ void TST_TSLocaleTranslation::TestHTMLTags()
QFETCH(QString, source); QFETCH(QString, source);
QFETCH(QString, translation); QFETCH(QString, translation);
static const QStringList tags = QStringList() << QLatin1String("p") static const QStringList tags = QStringList()
<< QLatin1String("html") << QLatin1String("p") << QLatin1String("html") << QLatin1String("body");
<< QLatin1String("body");
static const QString pattern("{1}.*>"); static const QString pattern("{1}.*>");
for (const auto &tag : tags) for (const auto &tag : tags)
{ {
@ -341,7 +335,8 @@ void TST_TSLocaleTranslation::TestHTMLTags()
if (not translation.contains(closeRegex) || countCloseTag != countOpenTag) if (not translation.contains(closeRegex) || countCloseTag != countOpenTag)
{ {
const QString message = QString("Tag mismatch. Tag: '<%1>'. ").arg(tag) + const QString message = QString("Tag mismatch. Tag: '<%1>'. ").arg(tag) +
QString("Original name:'%1'").arg(source) + QString(", translated name:'%1'").arg(translation); QString("Original name:'%1'").arg(source) +
QString(", translated name:'%1'").arg(translation);
QFAIL(qUtf8Printable(message)); QFAIL(qUtf8Printable(message));
} }
} }

View File

@ -27,7 +27,6 @@
*************************************************************************/ *************************************************************************/
#include "tst_tstranslation.h" #include "tst_tstranslation.h"
#include "../vmisc/def.h"
#include <QDomDocument> #include <QDomDocument>
#include <QtTest> #include <QtTest>
@ -37,7 +36,8 @@ Q_DECLARE_METATYPE(QDomElement) // Need for testing
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
TST_TSTranslation::TST_TSTranslation(QObject *parent) TST_TSTranslation::TST_TSTranslation(QObject *parent)
: TST_AbstractTranslation(parent) : TST_AbstractTranslation(parent)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TST_TSTranslation::CheckEnglishLocalization_data() void TST_TSTranslation::CheckEnglishLocalization_data()
@ -78,8 +78,8 @@ void TST_TSTranslation::CheckEnglishLocalization_data()
continue; continue;
} }
const QString caseName = QStringLiteral("File '%1'. Check modification source message '%2'.") const QString caseName =
.arg(fileName, source); QStringLiteral("File '%1'. Check modification source message '%2'.").arg(fileName, source);
QTest::newRow(qUtf8Printable(caseName)) << source << translation; QTest::newRow(qUtf8Printable(caseName)) << source << translation;
} }
else else
@ -166,8 +166,8 @@ void TST_TSTranslation::CheckEllipsis()
} }
const QString contextName = context.firstChildElement(TagName).text(); const QString contextName = context.firstChildElement(TagName).text();
const QString error = QString("String '%1' ends with '...' in context '%2'. Repalce it with '…'.") const QString error =
.arg(source, contextName); QString("String '%1' ends with '...' in context '%2'. Repalce it with '…'.").arg(source, contextName);
QFAIL(qUtf8Printable(error)); QFAIL(qUtf8Printable(error));
} }
} }
@ -224,7 +224,8 @@ void TST_TSTranslation::PrepareOriginalStrings()
continue; continue;
} }
const QString tag = QStringLiteral("File '%1'. Check modification source message '%2'.").arg(fileName, source); const QString tag =
QStringLiteral("File '%1'. Check modification source message '%2'.").arg(fileName, source);
QTest::newRow(qUtf8Printable(tag)) << source << message; QTest::newRow(qUtf8Printable(tag)) << source << message;
} }
else else