summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp')
-rw-r--r--tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp75
1 files changed, 26 insertions, 49 deletions
diff --git a/tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp b/tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp
index 48b04cef14..bfa69c90b8 100644
--- a/tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp
+++ b/tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
@@ -190,8 +165,10 @@ void tst_QIntValidator::validateFrench()
QIntValidator validator(-2000, 2000, 0);
validator.setLocale(QLocale::French);
int i;
+ // Grouping separator is a narrow no-break space; QLocale accepts a space as it.
QString s = QLatin1String("1 ");
- QCOMPARE(validator.validate(s, i), QValidator::Acceptable);
+ // Shouldn't end with a group separator
+ QCOMPARE(validator.validate(s, i), QValidator::Intermediate);
validator.fixup(s);
QCOMPARE(s, s);
@@ -236,45 +213,45 @@ void tst_QIntValidator::notifySignals()
QSignalSpy changedSpy(&iv, SIGNAL(changed()));
iv.setTop(9);
- QCOMPARE(topSpy.count(), 1);
- QCOMPARE(changedSpy.count(), 1);
+ QCOMPARE(topSpy.size(), 1);
+ QCOMPARE(changedSpy.size(), 1);
QCOMPARE(iv.top(), 9);
iv.setBottom(1);
- QCOMPARE(bottomSpy.count(), 1);
- QCOMPARE(changedSpy.count(), 2);
+ QCOMPARE(bottomSpy.size(), 1);
+ QCOMPARE(changedSpy.size(), 2);
QCOMPARE(iv.bottom(), 1);
iv.setRange(1, 8);
- QCOMPARE(topSpy.count(), 2);
- QCOMPARE(bottomSpy.count(), 1);
- QCOMPARE(changedSpy.count(), 3);
+ QCOMPARE(topSpy.size(), 2);
+ QCOMPARE(bottomSpy.size(), 1);
+ QCOMPARE(changedSpy.size(), 3);
QCOMPARE(iv.top(), 8);
QCOMPARE(iv.bottom(), 1);
iv.setRange(2, 8);
- QCOMPARE(topSpy.count(), 2);
- QCOMPARE(bottomSpy.count(), 2);
- QCOMPARE(changedSpy.count(), 4);
+ QCOMPARE(topSpy.size(), 2);
+ QCOMPARE(bottomSpy.size(), 2);
+ QCOMPARE(changedSpy.size(), 4);
QCOMPARE(iv.top(), 8);
QCOMPARE(iv.bottom(), 2);
iv.setRange(3, 7);
- QCOMPARE(topSpy.count(), 3);
- QCOMPARE(bottomSpy.count(), 3);
- QCOMPARE(changedSpy.count(), 5);
+ QCOMPARE(topSpy.size(), 3);
+ QCOMPARE(bottomSpy.size(), 3);
+ QCOMPARE(changedSpy.size(), 5);
QCOMPARE(iv.top(), 7);
QCOMPARE(iv.bottom(), 3);
iv.setRange(3, 7);
- QCOMPARE(topSpy.count(), 3);
- QCOMPARE(bottomSpy.count(), 3);
- QCOMPARE(changedSpy.count(), 5);
+ QCOMPARE(topSpy.size(), 3);
+ QCOMPARE(bottomSpy.size(), 3);
+ QCOMPARE(changedSpy.size(), 5);
iv.setLocale(QLocale("C"));
- QCOMPARE(changedSpy.count(), 5);
+ QCOMPARE(changedSpy.size(), 5);
iv.setLocale(QLocale("en"));
- QCOMPARE(changedSpy.count(), 6);
+ QCOMPARE(changedSpy.size(), 6);
}
void tst_QIntValidator::fixup()
@@ -331,9 +308,9 @@ void tst_QIntValidator::fixup_data()
// Normally the groups contain three digits, but the leftmost group should
// have at least two digits.
QTest::newRow("es no digit grouping 1000") << "es" << "1000" << "1000";
- QTest::newRow("es no digit grouping 10000") << "es" << "10000" << "10.000";
- QTest::newRow("es with digit grouping") << "es" << "1000.000" << "1000.000";
- QTest::newRow("es invalid digit grouping") << "es" << "1.000.000" << "1000.000";
+ QTest::newRow("es with digit grouping 10000") << "es" << "10000" << "10.000";
+ QTest::newRow("es with digit grouping million") << "es" << "1.000.000" << "1.000.000";
+ QTest::newRow("es invalid digit grouping") << "es" << "1000.000" << "1.000.000";
}
QTEST_APPLESS_MAIN(tst_QIntValidator)