diff --git a/autotests/validators/test-util.h b/autotests/validators/test-util.h index 0978fb8..567d3b9 100644 --- a/autotests/validators/test-util.h +++ b/autotests/validators/test-util.h @@ -19,12 +19,14 @@ #ifndef VALIDATOR_TEST_UTIL_H #define VALIDATOR_TEST_UTIL_H +#include #include #include #include #include Q_DECLARE_METATYPE(QValidator::State); +Q_DECLARE_METATYPE(QLocale); namespace validators { @@ -35,12 +37,20 @@ namespace validators QTest::addColumn("input"); QTest::addColumn("fixed"); QTest::addColumn("cursor"); + QTest::addColumn("locale"); QTest::addColumn("result"); + }; - void define_test_case(const QString &input, const QString &fixed, int cursor=0, QValidator::State result=QValidator::Intermediate) + void define_test_case( + const QString &input, + const QString &fixed, + int cursor=0, + QValidator::State result=QValidator::Intermediate, + const QLocale &locale=QLocale::c()) { - QTest::newRow(qPrintable(input)) << input << fixed << cursor << result; + QString name = QStringLiteral("locale=%1, input=%2").arg(locale.name()).arg(input); + QTest::newRow(qPrintable(name)) << input << fixed << cursor << locale << result; }; template @@ -53,7 +63,9 @@ namespace validators void testValidate(void) { - const T uut; + T uut; + QFETCH(QLocale, locale); + uut.setLocale(locale); QFETCH(QString, input); QFETCH(QString, fixed); @@ -68,7 +80,9 @@ namespace validators void testFixup(void) { - const T uut; + T uut; + QFETCH(QLocale, locale); + uut.setLocale(locale); QFETCH(QString, input);