summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2012-10-07 16:05:59 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-10 23:27:03 +0200
commit361ab4fe86a375bf880536d161641a9725de70dd (patch)
tree582e70a2720f68edd4bf419838203f7682792566 /tests/auto/widgets
parentd4d81fe68aa7d2b2a89ae5e049dd630e0da77651 (diff)
Move QValidator tests to QtGui
Q*Validator classes are not in QtWidgets, so move them where they should stay. Change-Id: Ie6ea45a026e640fad131002bc9762c575235f3f4 Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/widgets/qdoublevalidator/.gitignore1
-rw-r--r--tests/auto/widgets/widgets/qdoublevalidator/qdoublevalidator.pro8
-rw-r--r--tests/auto/widgets/widgets/qdoublevalidator/tst_qdoublevalidator.cpp408
-rw-r--r--tests/auto/widgets/widgets/qintvalidator/.gitignore1
-rw-r--r--tests/auto/widgets/widgets/qintvalidator/qintvalidator.pro6
-rw-r--r--tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp290
-rw-r--r--tests/auto/widgets/widgets/qregexpvalidator/.gitignore1
-rw-r--r--tests/auto/widgets/widgets/qregexpvalidator/qregexpvalidator.pro6
-rw-r--r--tests/auto/widgets/widgets/qregexpvalidator/tst_qregexpvalidator.cpp126
-rw-r--r--tests/auto/widgets/widgets/widgets.pro3
10 files changed, 0 insertions, 850 deletions
diff --git a/tests/auto/widgets/widgets/qdoublevalidator/.gitignore b/tests/auto/widgets/widgets/qdoublevalidator/.gitignore
deleted file mode 100644
index 95c97bbc30..0000000000
--- a/tests/auto/widgets/widgets/qdoublevalidator/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tst_qdoublevalidator
diff --git a/tests/auto/widgets/widgets/qdoublevalidator/qdoublevalidator.pro b/tests/auto/widgets/widgets/qdoublevalidator/qdoublevalidator.pro
deleted file mode 100644
index 3e2ecfe2a6..0000000000
--- a/tests/auto/widgets/widgets/qdoublevalidator/qdoublevalidator.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG += testcase
-CONFIG += parallel_test
-TARGET = tst_qdoublevalidator
-QT += widgets testlib
-SOURCES += tst_qdoublevalidator.cpp
-
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/widgets/qdoublevalidator/tst_qdoublevalidator.cpp b/tests/auto/widgets/widgets/qdoublevalidator/tst_qdoublevalidator.cpp
deleted file mode 100644
index 632710e816..0000000000
--- a/tests/auto/widgets/widgets/qdoublevalidator/tst_qdoublevalidator.cpp
+++ /dev/null
@@ -1,408 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-
-
-#include <qvalidator.h>
-
-class tst_QDoubleValidator : public QObject
-{
- Q_OBJECT
-private slots:
- void validate_data();
- void validate();
- void validateThouSep_data();
- void validateThouSep();
- void validateIntEquiv_data();
- void validateIntEquiv();
- void notifySignals();
-};
-
-Q_DECLARE_METATYPE(QValidator::State);
-#define INV QValidator::Invalid
-#define ITM QValidator::Intermediate
-#define ACC QValidator::Acceptable
-
-void tst_QDoubleValidator::validateThouSep_data()
-{
- QTest::addColumn<QString>("localeName");
- QTest::addColumn<QString>("value");
- QTest::addColumn<QValidator::State>("result");
-
- QTest::newRow("1,000C") << "C" << QString("1,000") << ACC;
- QTest::newRow("1.000C") << "C" << QString("1.000") << ACC;
-
- QTest::newRow("1,000de") << "de" << QString("1,000") << ACC;
- QTest::newRow("1.000de") << "de" << QString("1.000") << ACC;
-
- QTest::newRow(".C") << "C" << QString(".") << ITM;
- QTest::newRow(".de") << "de" << QString(".") << INV;
- QTest::newRow(",C") << "C" << QString(",") << INV;
- QTest::newRow(",de") << "de" << QString(",") << ITM;
-}
-
-void tst_QDoubleValidator::validateThouSep()
-{
- QFETCH(QString, localeName);
- QFETCH(QString, value);
- QFETCH(QValidator::State, result);
- int dummy = 0;
-
- QDoubleValidator iv(-10000, 10000, 3, 0);
- iv.setNotation(QDoubleValidator::ScientificNotation);
- iv.setLocale(QLocale(localeName));
-
- QCOMPARE(iv.validate(value, dummy), result);
-}
-
-void tst_QDoubleValidator::validate_data()
-{
- QTest::addColumn<QString>("localeName");
- QTest::addColumn<double>("minimum");
- QTest::addColumn<double>("maximum");
- QTest::addColumn<int>("decimals");
- QTest::addColumn<QString>("value");
- QTest::addColumn<QValidator::State>("scientific_state");
- QTest::addColumn<QValidator::State>("standard_state");
-
- QTest::newRow("data0") << "C" << 0.0 << 100.0 << 1 << QString("50.0") << ACC << ACC;
- QTest::newRow("data1") << "C" << 00.0 << 100.0 << 1 << QString("500.0") << ITM << ITM;
- QTest::newRow("data1a") << "C" << 00.0 << 100.0 << 1 << QString("5001.0") << ITM << INV;
- QTest::newRow("data2") << "C" << 00.0 << 100.0 << 1 << QString("-35.0") << INV << INV;
- QTest::newRow("data3") << "C" << 00.0 << 100.0 << 1 << QString("a") << INV << INV;
- QTest::newRow("data4") << "C" << 0.0 << 100.0 << 1 << QString("-") << INV << INV;
- QTest::newRow("data5") << "C" << 0.0 << 100.0 << 1 << QString("100.0") << ACC << ACC;
- QTest::newRow("data6") << "C" << -100.0 << 100.0 << 1 << QString("-") << ITM << ITM;
- QTest::newRow("data7") << "C" << -100.0 << 100.0 << 1 << QString("-500.0") << ITM << ITM;
- QTest::newRow("data8") << "C" << -100.0 << 100.0 << 1 << QString("-100") << ACC << ACC;
- QTest::newRow("data9") << "C" << -100.0 << -10.0 << 1 << QString("10") << ITM << ITM;
- QTest::newRow("data10") << "C" << 0.3 << 0.5 << 5 << QString("0.34567") << ACC << ACC;
- QTest::newRow("data11") << "C" << -0.3 << -0.5 << 5 << QString("-0.345678") << INV << INV;
- QTest::newRow("data12") << "C" << -0.32 << 0.32 << 1 << QString("0") << ACC << ACC;
- QTest::newRow("data13") << "C" << 0.0 << 100.0 << 1 << QString("3456a") << INV << INV;
- QTest::newRow("data14") << "C" << -100.0 << 100.0 << 1 << QString("-3456a") << INV << INV;
- QTest::newRow("data15") << "C" << -100.0 << 100.0 << 1 << QString("a-3456") << INV << INV;
- QTest::newRow("data16") << "C" << -100.0 << 100.0 << 1 << QString("a-3456a") << INV << INV;
- QTest::newRow("data17") << "C" << 1229.0 << 1231.0 << 0 << QString("123e") << ITM << INV;
- QTest::newRow("data18") << "C" << 1229.0 << 1231.0 << 0 << QString("123e+") << ITM << INV;
- QTest::newRow("data19") << "C" << 1229.0 << 1231.0 << 0 << QString("123e+1") << ACC << INV;
- QTest::newRow("data20") << "C" << 12290.0 << 12310.0 << 0 << QString("123e+2") << ACC << INV;
- QTest::newRow("data21") << "C" << 12.290 << 12.310 << 2 << QString("123e-") << ITM << INV;
- QTest::newRow("data22") << "C" << 12.290 << 12.310 << 2 << QString("123e-1") << ACC << INV;
- QTest::newRow("data23") << "C" << 1.2290 << 1.2310 << 3 << QString("123e-2") << ACC << INV;
- QTest::newRow("data24") << "C" << 1229.0 << 1231.0 << 0 << QString("123E") << ITM << INV;
- QTest::newRow("data25") << "C" << 1229.0 << 1231.0 << 0 << QString("123E+") << ITM << INV;
- QTest::newRow("data26") << "C" << 1229.0 << 1231.0 << 0 << QString("123E+1") << ACC << INV;
- QTest::newRow("data27") << "C" << 12290.0 << 12310.0 << 0 << QString("123E+2") << ACC << INV;
- QTest::newRow("data28") << "C" << 12.290 << 12.310 << 2 << QString("123E-") << ITM << INV;
- QTest::newRow("data29") << "C" << 12.290 << 12.310 << 2 << QString("123E-1") << ACC << INV;
- QTest::newRow("data30") << "C" << 1.2290 << 1.2310 << 3 << QString("123E-2") << ACC << INV;
- QTest::newRow("data31") << "C" << 1.2290 << 1.2310 << 3 << QString("e") << ITM << INV;
- QTest::newRow("data32") << "C" << 1.2290 << 1.2310 << 3 << QString("e+") << ITM << INV;
- QTest::newRow("data33") << "C" << 1.2290 << 1.2310 << 3 << QString("e+1") << ITM << INV;
- QTest::newRow("data34") << "C" << 1.2290 << 1.2310 << 3 << QString("e-") << ITM << INV;
- QTest::newRow("data35") << "C" << 1.2290 << 1.2310 << 3 << QString("e-1") << ITM << INV;
- QTest::newRow("data36") << "C" << 1.2290 << 1.2310 << 3 << QString("E") << ITM << INV;
- QTest::newRow("data37") << "C" << 1.2290 << 1.2310 << 3 << QString("E+") << ITM << INV;
- QTest::newRow("data38") << "C" << 1.2290 << 1.2310 << 3 << QString("E+1") << ITM << INV;
- QTest::newRow("data39") << "C" << 1.2290 << 1.2310 << 3 << QString("E-") << ITM << INV;
- QTest::newRow("data40") << "C" << 1.2290 << 1.2310 << 3 << QString("E-1") << ITM << INV;
- QTest::newRow("data41") << "C" << -100.0 << 100.0 << 0 << QString("10e") << ITM << INV;
- QTest::newRow("data42") << "C" << -100.0 << 100.0 << 0 << QString("10e+") << ITM << INV;
- QTest::newRow("data43") << "C" << 0.01 << 0.09 << 2 << QString("0") << ITM << ITM;
- QTest::newRow("data44") << "C" << 0.0 << 10.0 << 1 << QString("11") << ITM << ITM;
- QTest::newRow("data45") << "C" << 0.0 << 10.0 << 2 << QString("11") << ITM << ITM;
- QTest::newRow("data46") << "C" << 0.0 << 100.0 << 0 << QString("0.") << ACC << ACC;
- QTest::newRow("data47") << "C" << 0.0 << 100.0 << 0 << QString("0.0") << INV << INV;
- QTest::newRow("data48") << "C" << 0.0 << 100.0 << 1 << QString("0.0") << ACC << ACC;
- QTest::newRow("data49") << "C" << 0.0 << 100.0 << 0 << QString(".") << ITM << ITM;
- QTest::newRow("data50") << "C" << 0.0 << 100.0 << 1 << QString(".") << ITM << ITM;
-
- QTest::newRow("data_de0") << "de" << 0.0 << 100.0 << 1 << QString("50,0") << ACC << ACC;
- QTest::newRow("data_de1") << "de" << 00.0 << 100.0 << 1 << QString("500,0") << ITM << ITM;
- QTest::newRow("data_de1a") << "de" << 00.0 << 100.0 << 1 << QString("5001,0") << ITM << INV;
- QTest::newRow("data_de0C") << "de" << 0.0 << 100.0 << 1 << QString("50,0") << ACC << ACC;
- QTest::newRow("data_de1C") << "de" << 00.0 << 100.0 << 1 << QString("500,0") << ITM << ITM;
- QTest::newRow("data_de1aC") << "de" << 00.0 << 100.0 << 1 << QString("5001,0") << ITM << INV;
- QTest::newRow("data_de2") << "de" << 00.0 << 100.0 << 1 << QString("-35,0") << INV << INV;
- QTest::newRow("data_de3") << "de" << 00.0 << 100.0 << 1 << QString("a") << INV << INV;
- QTest::newRow("data_de4") << "de" << 0.0 << 100.0 << 1 << QString("-") << INV << INV;
- QTest::newRow("data_de5") << "de" << 0.0 << 100.0 << 1 << QString("100,0") << ACC << ACC;
- QTest::newRow("data_de6") << "de" << -100.0 << 100.0 << 1 << QString("-") << ITM << ITM;
- QTest::newRow("data_de7") << "de" << -100.0 << 100.0 << 1 << QString("-500,0") << ITM << ITM;
- QTest::newRow("data_de8") << "de" << -100.0 << 100.0 << 1 << QString("-100") << ACC << ACC;
- QTest::newRow("data_de9") << "de" << -100.0 << -10.0 << 1 << QString("10") << ITM << ITM;
- QTest::newRow("data_de10") << "de" << 0.3 << 0.5 << 5 << QString("0,34567") << ACC << ACC;
- QTest::newRow("data_de11") << "de" << -0.3 << -0.5 << 5 << QString("-0,345678") << INV << INV;
- QTest::newRow("data_de12") << "de" << -0.32 << 0.32 << 1 << QString("0") << ACC << ACC;
- QTest::newRow("data_de13") << "de" << 0.0 << 100.0 << 1 << QString("3456a") << INV << INV;
- QTest::newRow("data_de14") << "de" << -100.0 << 100.0 << 1 << QString("-3456a") << INV << INV;
- QTest::newRow("data_de15") << "de" << -100.0 << 100.0 << 1 << QString("a-3456") << INV << INV;
- QTest::newRow("data_de16") << "de" << -100.0 << 100.0 << 1 << QString("a-3456a") << INV << INV;
- QTest::newRow("data_de17") << "de" << 1229.0 << 1231.0 << 0 << QString("123e") << ITM << INV;
- QTest::newRow("data_de18") << "de" << 1229.0 << 1231.0 << 0 << QString("123e+") << ITM << INV;
- QTest::newRow("data_de19") << "de" << 1229.0 << 1231.0 << 0 << QString("123e+1") << ACC << INV;
- QTest::newRow("data_de20") << "de" << 12290.0 << 12310.0 << 0 << QString("123e+2") << ACC << INV;
- QTest::newRow("data_de21") << "de" << 12.290 << 12.310 << 2 << QString("123e-") << ITM << INV;
- QTest::newRow("data_de22") << "de" << 12.290 << 12.310 << 2 << QString("123e-1") << ACC << INV;
- QTest::newRow("data_de23") << "de" << 1.2290 << 1.2310 << 3 << QString("123e-2") << ACC << INV;
- QTest::newRow("data_de24") << "de" << 1229.0 << 1231.0 << 0 << QString("123E") << ITM << INV;
- QTest::newRow("data_de25") << "de" << 1229.0 << 1231.0 << 0 << QString("123E+") << ITM << INV;
- QTest::newRow("data_de26") << "de" << 1229.0 << 1231.0 << 0 << QString("123E+1") << ACC << INV;
- QTest::newRow("data_de27") << "de" << 12290.0 << 12310.0 << 0 << QString("123E+2") << ACC << INV;
- QTest::newRow("data_de28") << "de" << 12.290 << 12.310 << 2 << QString("123E-") << ITM << INV;
- QTest::newRow("data_de29") << "de" << 12.290 << 12.310 << 2 << QString("123E-1") << ACC << INV;
- QTest::newRow("data_de30") << "de" << 1.2290 << 1.2310 << 3 << QString("123E-2") << ACC << INV;
- QTest::newRow("data_de31") << "de" << 1.2290 << 1.2310 << 3 << QString("e") << ITM << INV;
- QTest::newRow("data_de32") << "de" << 1.2290 << 1.2310 << 3 << QString("e+") << ITM << INV;
- QTest::newRow("data_de33") << "de" << 1.2290 << 1.2310 << 3 << QString("e+1") << ITM << INV;
- QTest::newRow("data_de34") << "de" << 1.2290 << 1.2310 << 3 << QString("e-") << ITM << INV;
- QTest::newRow("data_de35") << "de" << 1.2290 << 1.2310 << 3 << QString("e-1") << ITM << INV;
- QTest::newRow("data_de36") << "de" << 1.2290 << 1.2310 << 3 << QString("E") << ITM << INV;
- QTest::newRow("data_de37") << "de" << 1.2290 << 1.2310 << 3 << QString("E+") << ITM << INV;
- QTest::newRow("data_de38") << "de" << 1.2290 << 1.2310 << 3 << QString("E+1") << ITM << INV;
- QTest::newRow("data_de39") << "de" << 1.2290 << 1.2310 << 3 << QString("E-") << ITM << INV;
- QTest::newRow("data_de40") << "de" << 1.2290 << 1.2310 << 3 << QString("E-1") << ITM << INV;
- QTest::newRow("data_de41") << "de" << -100.0 << 100.0 << 0 << QString("10e") << ITM << INV;
- QTest::newRow("data_de42") << "de" << -100.0 << 100.0 << 0 << QString("10e+") << ITM << INV;
- QTest::newRow("data_de43") << "de" << 0.01 << 0.09 << 2 << QString("0") << ITM << ITM;
- QTest::newRow("data_de44") << "de" << 0.0 << 10.0 << 1 << QString("11") << ITM << ITM;
- QTest::newRow("data_de45") << "de" << 0.0 << 10.0 << 2 << QString("11") << ITM << ITM;
-
- QString arabicNum;
- arabicNum += QChar(1633); // "18.4" in arabic
- arabicNum += QChar(1640);
- arabicNum += QChar(1643);
- arabicNum += QChar(1636);
- QTest::newRow("arabic") << "ar" << 0.0 << 20.0 << 2 << arabicNum << ACC << ACC;
-
- // Confim no fallback to C locale
- QTest::newRow("data_C1") << "de" << 0.0 << 1000.0 << 2 << QString("1.000,00") << ACC << ACC;
- QTest::newRow("data_C2") << "de" << 0.0 << 1000.0 << 2 << QString("1,000.00") << INV << INV;
-}
-
-void tst_QDoubleValidator::validate()
-{
- QFETCH(QString, localeName);
- QFETCH(double, minimum);
- QFETCH(double, maximum);
- QFETCH(int, decimals);
- QFETCH(QString, value);
- QFETCH(QValidator::State, scientific_state);
- QFETCH(QValidator::State, standard_state);
-
- QLocale::setDefault(QLocale(localeName));
-
- QDoubleValidator dv(minimum, maximum, decimals, 0);
- int dummy;
- QCOMPARE((int)dv.validate(value, dummy), (int)scientific_state);
- dv.setNotation(QDoubleValidator::StandardNotation);
- QCOMPARE((int)dv.validate(value, dummy), (int)standard_state);
-}
-void tst_QDoubleValidator::notifySignals()
-{
- QLocale::setDefault(QLocale("C"));
-
- QDoubleValidator dv(0.1, 0.9, 10, 0);
- QSignalSpy topSpy(&dv, SIGNAL(topChanged(double)));
- QSignalSpy bottomSpy(&dv, SIGNAL(bottomChanged(double)));
- QSignalSpy decSpy(&dv, SIGNAL(decimalsChanged(int)));
- QSignalSpy changedSpy(&dv, SIGNAL(changed()));
-
- qRegisterMetaType<QDoubleValidator::Notation>("QDoubleValidator::Notation");
- QSignalSpy notSpy(&dv, SIGNAL(notationChanged(QDoubleValidator::Notation)));
-
- dv.setTop(0.8);
- QCOMPARE(topSpy.count(), 1);
- QCOMPARE(changedSpy.count(), 1);
- QVERIFY(dv.top() == 0.8);
- dv.setBottom(0.2);
- QCOMPARE(bottomSpy.count(), 1);
- QCOMPARE(changedSpy.count(), 2);
- QVERIFY(dv.bottom() == 0.2);
-
- dv.setRange(0.2, 0.7);
- QCOMPARE(topSpy.count(), 2);
- QCOMPARE(bottomSpy.count(), 1);
- QCOMPARE(decSpy.count(), 1);
- QCOMPARE(changedSpy.count(), 3);
- QVERIFY(dv.bottom() == 0.2);
- QVERIFY(dv.top() == 0.7);
- QVERIFY(dv.decimals() == 0.);
-
- dv.setRange(0.3, 0.7);
- QCOMPARE(topSpy.count(), 2);
- QCOMPARE(bottomSpy.count(), 2);
- QCOMPARE(changedSpy.count(), 4);
- QVERIFY(dv.bottom() == 0.3);
- QVERIFY(dv.top() == 0.7);
- QVERIFY(dv.decimals() == 0.);
-
- dv.setRange(0.4, 0.6);
- QCOMPARE(topSpy.count(), 3);
- QCOMPARE(bottomSpy.count(), 3);
- QCOMPARE(changedSpy.count(), 5);
- QVERIFY(dv.bottom() == 0.4);
- QVERIFY(dv.top() == 0.6);
- QVERIFY(dv.decimals() == 0.);
-
- dv.setDecimals(10);
- QCOMPARE(decSpy.count(), 2);
- QCOMPARE(changedSpy.count(), 6);
- QVERIFY(dv.decimals() == 10.);
-
-
- dv.setRange(0.4, 0.6, 100);
- QCOMPARE(topSpy.count(), 3);
- QCOMPARE(bottomSpy.count(), 3);
- QCOMPARE(decSpy.count(), 3);
- QCOMPARE(changedSpy.count(), 7);
- QVERIFY(dv.bottom() == 0.4);
- QVERIFY(dv.top() == 0.6);
- QVERIFY(dv.decimals() == 100.);
-
- dv.setNotation(QDoubleValidator::StandardNotation);
- QCOMPARE(notSpy.count(), 1);
- QCOMPARE(changedSpy.count(), 8);
- QVERIFY(dv.notation() == QDoubleValidator::StandardNotation);
-
- dv.setRange(dv.bottom(), dv.top(), dv.decimals());
- QCOMPARE(topSpy.count(), 3);
- QCOMPARE(bottomSpy.count(), 3);
- QCOMPARE(decSpy.count(), 3);
- QCOMPARE(changedSpy.count(), 8);
-
- dv.setNotation(dv.notation());
- QCOMPARE(notSpy.count(), 1);
- QCOMPARE(changedSpy.count(), 8);
-
- dv.setLocale(QLocale("C"));
- QCOMPARE(changedSpy.count(), 8);
-
- dv.setLocale(QLocale("en"));
- QCOMPARE(changedSpy.count(), 9);
-}
-
-void tst_QDoubleValidator::validateIntEquiv_data()
-{
- QTest::addColumn<double>("minimum");
- QTest::addColumn<double>("maximum");
- QTest::addColumn<QString>("input");
- QTest::addColumn<QValidator::State>("state");
-
- QTest::newRow("1.1") << 0.0 << 10.0 << QString("") << ITM;
- QTest::newRow("1.2") << 10.0 << 0.0 << QString("") << ITM;
-
- QTest::newRow("2.1") << 0.0 << 10.0 << QString("-") << INV;
- QTest::newRow("2.2") << 0.0 << 10.0 << QString("-0") << INV;
- QTest::newRow("2.3") << -10.0 << -1.0 << QString("+") << INV;
- QTest::newRow("2.4") << -10.0 << 10.0 << QString("-") << ITM;
- QTest::newRow("2.5") << -10.0 << 10.0 << QString("+") << ITM;
- QTest::newRow("2.5a") << -10.0 << -9.0 << QString("+") << INV;
- QTest::newRow("2.6") << -10.0 << 10.0 << QString("+0") << ACC;
- QTest::newRow("2.7") << -10.0 << 10.0 << QString("+1") << ACC;
- QTest::newRow("2.8") << -10.0 << 10.0 << QString("+-") << INV;
- QTest::newRow("2.9") << -10.0 << 10.0 << QString("-+") << INV;
-
- QTest::newRow("3.1") << 0.0 << 10.0 << QString("12345678901234567890") << INV;
- QTest::newRow("3.2") << 0.0 << 10.0 << QString("-12345678901234567890") << INV;
- QTest::newRow("3.3") << 0.0 << 10.0 << QString("000000000000000000000") << ACC;
- QTest::newRow("3.4") << 1.0 << 10.0 << QString("000000000000000000000") << ITM;
- QTest::newRow("3.5") << 0.0 << 10.0 << QString("-000000000000000000000") << INV;
- QTest::newRow("3.6") << -10.0 << -1.0 << QString("-000000000000000000000") << ITM;
- QTest::newRow("3.7") << -10.0 << -1.0 << QString("-0000000000000000000001") << ACC;
-
- QTest::newRow("4.1") << 0.0 << 10.0 << QString(" ") << INV;
- QTest::newRow("4.2") << 0.0 << 10.0 << QString(" 1") << INV;
- QTest::newRow("4.3") << 0.0 << 10.0 << QString("1 ") << INV;
- QTest::newRow("4.4") << 0.0 << 10.0 << QString("1.0") << INV;
- QTest::newRow("4.5") << 0.0 << 10.0 << QString("0.1") << INV;
- QTest::newRow("4.6") << 0.0 << 10.0 << QString(".1") << INV;
- QTest::newRow("4.7") << 0.0 << 10.0 << QString("-1.0") << INV;
-
- QTest::newRow("5.1a") << 6.0 << 8.0 << QString("5") << ITM;
- QTest::newRow("5.1b") << 6.0 << 8.0 << QString("56") << INV;
- QTest::newRow("5.2") << 6.0 << 8.0 << QString("7") << ACC;
- QTest::newRow("5.3a") << 6.0 << 8.0 << QString("9") << ITM;
- QTest::newRow("5.3b") << 6.0 << 8.0 << QString("-") << INV;
- QTest::newRow("5.4a") << -8.0 << -6.0 << QString("+") << INV;
- QTest::newRow("5.4b") << -8.0 << -6.0 << QString("+5") << INV;
- QTest::newRow("5.4c") << -8.0 << -6.0 << QString("-5") << ITM;
- QTest::newRow("5.5") << -8.0 << -6.0 << QString("-7") << ACC;
- QTest::newRow("5.6") << -8.0 << -6.0 << QString("-9") << ITM;
- QTest::newRow("5.7") << -8.0 << -6.0 << QString("5") << ITM;
- QTest::newRow("5.8") << -8.0 << -6.0 << QString("7") << ITM;
- QTest::newRow("5.9") << -8.0 << -6.0 << QString("9") << ITM;
- QTest::newRow("5.10") << -6.0 << 8.0 << QString("-5") << ACC;
- QTest::newRow("5.11") << -6.0 << 8.0 << QString("5") << ACC;
- QTest::newRow("5.12") << -6.0 << 8.0 << QString("-7") << ITM;
- QTest::newRow("5.13") << -6.0 << 8.0 << QString("7") << ACC;
- QTest::newRow("5.14") << -6.0 << 8.0 << QString("-9") << ITM;
- QTest::newRow("5.15") << -6.0 << 8.0 << QString("9") << ITM;
-
- QTest::newRow("6.1") << 100.0 << 102.0 << QString("11") << ITM;
- QTest::newRow("6.2") << 100.0 << 102.0 << QString("-11") << INV;
-
- QTest::newRow("7.1") << 0.0 << 10.0 << QString("100") << INV;
- QTest::newRow("7.2") << 0.0 << -10.0 << QString("100") << INV;
- QTest::newRow("7.3") << 0.0 << -10.0 << QString("-100") << INV;
- QTest::newRow("7.4") << -100.0 << 10.0 << QString("100") << ITM;
-}
-
-void tst_QDoubleValidator::validateIntEquiv()
-{
- QFETCH(double, minimum);
- QFETCH(double, maximum);
- QFETCH(QString, input);
- QFETCH(QValidator::State, state);
-
- QLocale::setDefault(QLocale("C"));
-
- QDoubleValidator dv(minimum, maximum, 0, 0);
- dv.setNotation(QDoubleValidator::StandardNotation);
- int dummy;
- QCOMPARE(dv.validate(input, dummy), state);
-}
-
-QTEST_APPLESS_MAIN(tst_QDoubleValidator)
-#include "tst_qdoublevalidator.moc"
diff --git a/tests/auto/widgets/widgets/qintvalidator/.gitignore b/tests/auto/widgets/widgets/qintvalidator/.gitignore
deleted file mode 100644
index c6d5c989f0..0000000000
--- a/tests/auto/widgets/widgets/qintvalidator/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tst_qintvalidator
diff --git a/tests/auto/widgets/widgets/qintvalidator/qintvalidator.pro b/tests/auto/widgets/widgets/qintvalidator/qintvalidator.pro
deleted file mode 100644
index 1afc806ee1..0000000000
--- a/tests/auto/widgets/widgets/qintvalidator/qintvalidator.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG += testcase
-CONFIG += parallel_test
-TARGET = tst_qintvalidator
-SOURCES += tst_qintvalidator.cpp
-QT += testlib
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp b/tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp
deleted file mode 100644
index a000bbebcc..0000000000
--- a/tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-#include <qvalidator.h>
-
-class tst_QIntValidator : public QObject
-{
- Q_OBJECT
-private slots:
- void validate_data();
- void validate();
- void validateArabic();
- void validateFrench();
- void notifySignals();
-};
-
-Q_DECLARE_METATYPE(QValidator::State);
-#define INV QValidator::Invalid
-#define INT QValidator::Intermediate
-#define ACC QValidator::Acceptable
-
-void tst_QIntValidator::validate_data()
-{
- QTest::addColumn<int>("minimum");
- QTest::addColumn<int>("maximum");
- QTest::addColumn<QString>("value");
- QTest::addColumn<QValidator::State>("state");
-
- QTest::newRow("data0") << 0 << 100 << QString("50") << ACC;
- QTest::newRow("data1") << 0 << 100 << QString("500") << INV;
- QTest::newRow("data1a") << 0 << 100 << QString("5000") << INV;
- QTest::newRow("data1b") << -100 << 0 << QString("50") << INT;
- QTest::newRow("data1c") << -100 << 0 << QString("500") << INV;
- QTest::newRow("data1d") << -100 << 0 << QString("5000") << INV;
- QTest::newRow("data2") << 0 << 100 << QString("-35") << INV;
- QTest::newRow("data3") << 0 << 100 << QString("a") << INV;
- QTest::newRow("data4") << 0 << 100 << QString("-") << INV;
- QTest::newRow("data5") << 0 << 100 << QString("100") << ACC;
- QTest::newRow("data6") << -100 << 100 << QString("-") << INT;
- QTest::newRow("data7") << -100 << 100 << QString("-500") << INV;
- QTest::newRow("data8") << -100 << 100 << QString("-100") << ACC;
- QTest::newRow("data9") << -100 << -10 << QString("10") << INT;
-
- QTest::newRow("data10") << 100 << 999 << QString("") << INT;
- QTest::newRow("data11") << 100 << 999 << QString("5") << INT;
- QTest::newRow("data12") << 100 << 999 << QString("50") << INT;
- QTest::newRow("data13") << 100 << 999 << QString("99") << INT;
- QTest::newRow("data14") << 100 << 999 << QString("100") << ACC;
- QTest::newRow("data15") << 100 << 999 << QString("101") << ACC;
- QTest::newRow("data16") << 100 << 999 << QString("998") << ACC;
- QTest::newRow("data17") << 100 << 999 << QString("999") << ACC;
- QTest::newRow("data18") << 100 << 999 << QString("1000") << INV;
- QTest::newRow("data19") << 100 << 999 << QString("-10") << INV;
-
- QTest::newRow("data20") << -999 << -100 << QString("50") << INT;
- QTest::newRow("data21") << -999 << -100 << QString("-") << INT;
- QTest::newRow("data22") << -999 << -100 << QString("-1") << INT;
- QTest::newRow("data23") << -999 << -100 << QString("-10") << INT;
- QTest::newRow("data24") << -999 << -100 << QString("-100") << ACC;
- QTest::newRow("data25") << -999 << -100 << QString("-500") << ACC;
- QTest::newRow("data26") << -999 << -100 << QString("-998") << ACC;
- QTest::newRow("data27") << -999 << -100 << QString("-999") << ACC;
- QTest::newRow("data28") << -999 << -100 << QString("-1000") << INV;
- QTest::newRow("data29") << -999 << -100 << QString("-2000") << INV;
-
- QTest::newRow("1.1") << 0 << 10 << QString("") << INT;
- QTest::newRow("1.2") << 10 << 0 << QString("") << INT;
-
- QTest::newRow("2.1") << 0 << 10 << QString("-") << INV;
- QTest::newRow("2.2") << 0 << 10 << QString("-0") << INV;
- QTest::newRow("2.3") << -10 << -1 << QString("+") << INV;
- QTest::newRow("2.4") << -10 << 10 << QString("-") << INT;
- QTest::newRow("2.5") << -10 << 10 << QString("+") << INT;
- QTest::newRow("2.6") << -10 << 10 << QString("+0") << ACC;
- QTest::newRow("2.7") << -10 << 10 << QString("+1") << ACC;
- QTest::newRow("2.8") << -10 << 10 << QString("+-") << INV;
- QTest::newRow("2.9") << -10 << 10 << QString("-+") << INV;
-
- QTest::newRow("3.1") << 0 << 10 << QString("12345678901234567890") << INV;
- QTest::newRow("3.2") << 0 << 10 << QString("-12345678901234567890") << INV;
- QTest::newRow("3.3") << 0 << 10 << QString("000000000000000000000") << ACC;
- QTest::newRow("3.4") << 1 << 10 << QString("000000000000000000000") << INT;
- QTest::newRow("3.5") << 0 << 10 << QString("-000000000000000000000") << INV;
- QTest::newRow("3.6") << -10 << -1 << QString("-000000000000000000000") << INT;
- QTest::newRow("3.7") << -10 << -1 << QString("-0000000000000000000001") << ACC;
-
- QTest::newRow("4.1") << 0 << 10 << QString(" ") << INV;
- QTest::newRow("4.2") << 0 << 10 << QString(" 1") << INV;
- QTest::newRow("4.3") << 0 << 10 << QString("1 ") << INV;
- QTest::newRow("4.4") << 0 << 10 << QString("1.0") << INV;
- QTest::newRow("4.5") << 0 << 10 << QString("0.1") << INV;
- QTest::newRow("4.6") << 0 << 10 << QString(".1") << INV;
- QTest::newRow("4.7") << 0 << 10 << QString("-1.0") << INV;
-
- QTest::newRow("5.1") << 6 << 8 << QString("5") << INT;
- QTest::newRow("5.2") << 6 << 8 << QString("7") << ACC;
- QTest::newRow("5.3") << 6 << 8 << QString("9") << INV;
- QTest::newRow("5.3a") << 6 << 8 << QString("19") << INV;
- QTest::newRow("5.4") << -8 << -6 << QString("-5") << INT;
- QTest::newRow("5.5") << -8 << -6 << QString("-7") << ACC;
- QTest::newRow("5.6") << -8 << -6 << QString("-9") << INV;
- QTest::newRow("5.6a") << -8 << -6 << QString("-19") << INV;
- QTest::newRow("5.7") << -8 << -6 << QString("5") << INT;
- QTest::newRow("5.8") << -8 << -6 << QString("7") << INT;
- QTest::newRow("5.9") << -8 << -6 << QString("9") << INV;
- QTest::newRow("5.10") << -6 << 8 << QString("-5") << ACC;
- QTest::newRow("5.11") << -6 << 8 << QString("5") << ACC;
- QTest::newRow("5.12") << -6 << 8 << QString("-7") << INV;
- QTest::newRow("5.13") << -6 << 8 << QString("7") << ACC;
- QTest::newRow("5.14") << -6 << 8 << QString("-9") << INV;
- QTest::newRow("5.15") << -6 << 8 << QString("9") << INV;
-
- QTest::newRow("6.1") << 100 << 102 << QString("11") << INT;
- QTest::newRow("6.2") << 100 << 102 << QString("-11") << INV;
-
- QTest::newRow("7.1") << 0 << 10 << QString("100") << INV;
- QTest::newRow("7.2") << 0 << -10 << QString("100") << INV;
- QTest::newRow("7.3") << 0 << -10 << QString("-100") << INV;
- QTest::newRow("7.4") << -100 << 10 << QString("100") << INT;
-
- QTest::newRow("8.1") << -100 << -10 << QString("+") << INV;
- QTest::newRow("8.2") << -100 << -10 << QString("+50") << INV;
- QTest::newRow("8.3") << -100 << -10 << QString("50") << INT;
- QTest::newRow("8.4") << 10 << 100 << QString("-") << INV;
- QTest::newRow("8.5") << 10 << 100 << QString("-50") << INV;
- QTest::newRow("8.6") << 10 << 100 << QString("5") << INT;
- QTest::newRow("8.7") << -1 << 100 << QString("-") << INT;
- QTest::newRow("8.8") << -1 << 100 << QString("-50") << INV;
- QTest::newRow("8.9") << -1 << 100 << QString("5") << ACC;
- QTest::newRow("8.10") << -1 << 100 << QString("+") << INT;
- QTest::newRow("8.11") << -1 << 100 << QString("+50") << ACC;
-
- QTest::newRow("9.0") << -10 << 10 << QString("000") << ACC;
- QTest::newRow("9.1") << -10 << 10 << QString("008") << ACC;
- QTest::newRow("9.2") << -10 << 10 << QString("-008") << ACC;
- QTest::newRow("9.3") << -10 << 10 << QString("00010") << ACC;
- QTest::newRow("9.4") << -10 << 10 << QString("-00010") << ACC;
- QTest::newRow("9.5") << -10 << 10 << QString("00020") << INV;
- QTest::newRow("9.6") << -10 << 10 << QString("-00020") << INV;
-
-}
-
-void tst_QIntValidator::validateArabic()
-{
- QString arabicNum;
- arabicNum += QChar(1633); // "18" in arabic
- arabicNum += QChar(1640);
-
- QIntValidator validator(-20, 20, 0);
- validator.setLocale(QLocale(QLocale::Arabic, QLocale::SaudiArabia));
- int i;
- QCOMPARE(validator.validate(arabicNum, i), QValidator::Acceptable);
-
-}
-
-
-void tst_QIntValidator::validateFrench()
-{
- QIntValidator validator(-2000, 2000, 0);
- validator.setLocale(QLocale::French);
- int i;
- QString s = QLatin1String("1 ");
- QCOMPARE(validator.validate(s, i), QValidator::Acceptable);
- validator.fixup(s);
- QCOMPARE(s, s);
-
- s = QLatin1String("1 000");
- QCOMPARE(validator.validate(s, i), QValidator::Acceptable);
- validator.fixup(s);
- QCOMPARE(s, s);
-
-
- s = QLatin1String("1 0 00");
- QCOMPARE(validator.validate(s, i), QValidator::Intermediate);
- validator.fixup(s);
- QCOMPARE(s, validator.locale().toString(1000));
-
- // Confim no fallback to C locale
- s = QLatin1String("1,000");
- QCOMPARE(validator.validate(s, i), QValidator::Invalid);
- validator.setLocale(QLocale::C);
- QCOMPARE(validator.validate(s, i), QValidator::Acceptable);
-}
-
-void tst_QIntValidator::validate()
-{
- QFETCH(int, minimum);
- QFETCH(int, maximum);
- QFETCH(QString, value);
- QFETCH(QValidator::State, state);
-
- QIntValidator iv(minimum, maximum, 0);
- iv.setLocale(QLocale::C);
- int dummy;
- QCOMPARE((int)iv.validate(value, dummy), (int)state);
-}
-
-void tst_QIntValidator::notifySignals()
-{
- QLocale::setDefault(QLocale("C"));
-
- QIntValidator iv(0, 10, 0);
- QSignalSpy topSpy(&iv, SIGNAL(topChanged(int)));
- QSignalSpy bottomSpy(&iv, SIGNAL(bottomChanged(int)));
- QSignalSpy changedSpy(&iv, SIGNAL(changed()));
-
- iv.setTop(9);
- QCOMPARE(topSpy.count(), 1);
- QCOMPARE(changedSpy.count(), 1);
- QVERIFY(iv.top() == 9);
- iv.setBottom(1);
- QCOMPARE(bottomSpy.count(), 1);
- QCOMPARE(changedSpy.count(), 2);
- QVERIFY(iv.bottom() == 1);
-
- iv.setRange(1, 8);
- QCOMPARE(topSpy.count(), 2);
- QCOMPARE(bottomSpy.count(), 1);
- QCOMPARE(changedSpy.count(), 3);
- QVERIFY(iv.top() == 8);
- QVERIFY(iv.bottom() == 1);
-
- iv.setRange(2, 8);
- QCOMPARE(topSpy.count(), 2);
- QCOMPARE(bottomSpy.count(), 2);
- QCOMPARE(changedSpy.count(), 4);
- QVERIFY(iv.top() == 8);
- QVERIFY(iv.bottom() == 2);
-
- iv.setRange(3, 7);
- QCOMPARE(topSpy.count(), 3);
- QCOMPARE(bottomSpy.count(), 3);
- QCOMPARE(changedSpy.count(), 5);
- QVERIFY(iv.top() == 7);
- QVERIFY(iv.bottom() == 3);
-
- iv.setRange(3, 7);
- QCOMPARE(topSpy.count(), 3);
- QCOMPARE(bottomSpy.count(), 3);
- QCOMPARE(changedSpy.count(), 5);
-
- iv.setLocale(QLocale("C"));
- QCOMPARE(changedSpy.count(), 5);
-
- iv.setLocale(QLocale("en"));
- QCOMPARE(changedSpy.count(), 6);
-}
-
-QTEST_MAIN(tst_QIntValidator)
-#include "tst_qintvalidator.moc"
diff --git a/tests/auto/widgets/widgets/qregexpvalidator/.gitignore b/tests/auto/widgets/widgets/qregexpvalidator/.gitignore
deleted file mode 100644
index cff9b076b2..0000000000
--- a/tests/auto/widgets/widgets/qregexpvalidator/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tst_qregexpvalidator
diff --git a/tests/auto/widgets/widgets/qregexpvalidator/qregexpvalidator.pro b/tests/auto/widgets/widgets/qregexpvalidator/qregexpvalidator.pro
deleted file mode 100644
index f2797466e3..0000000000
--- a/tests/auto/widgets/widgets/qregexpvalidator/qregexpvalidator.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG += testcase
-CONFIG += parallel_test
-TARGET = tst_qregexpvalidator
-SOURCES += tst_qregexpvalidator.cpp
-QT += testlib
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/widgets/qregexpvalidator/tst_qregexpvalidator.cpp b/tests/auto/widgets/widgets/qregexpvalidator/tst_qregexpvalidator.cpp
deleted file mode 100644
index 77075372f8..0000000000
--- a/tests/auto/widgets/widgets/qregexpvalidator/tst_qregexpvalidator.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-#include <qregexp.h>
-
-
-#include <qvalidator.h>
-
-class tst_QRegExpValidator : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QRegExpValidator();
- virtual ~tst_QRegExpValidator();
-
-
- // I can think of no other way to do this for the moment
- enum State { Invalid=0, Intermediate=1, Acceptable=2 };
-public slots:
- void init();
- void cleanup();
-private slots:
- void validate_data();
- void validate();
-};
-
-tst_QRegExpValidator::tst_QRegExpValidator()
-{
-}
-
-tst_QRegExpValidator::~tst_QRegExpValidator()
-{
-
-}
-
-void tst_QRegExpValidator::init()
-{
-}
-
-void tst_QRegExpValidator::cleanup()
-{
-}
-
-void tst_QRegExpValidator::validate_data()
-{
-
- QTest::addColumn<QString>("rx");
- QTest::addColumn<QString>("value");
- QTest::addColumn<int>("state");
-
- QTest::newRow( "data0" ) << QString("[1-9]\\d{0,3}") << QString("0") << 0;
- QTest::newRow( "data1" ) << QString("[1-9]\\d{0,3}") << QString("12345") << 0;
- QTest::newRow( "data2" ) << QString("[1-9]\\d{0,3}") << QString("1") << 2;
-
- QTest::newRow( "data3" ) << QString("\\S+") << QString("myfile.txt") << 2;
- QTest::newRow( "data4" ) << QString("\\S+") << QString("my file.txt") << 0;
-
- QTest::newRow( "data5" ) << QString("[A-C]\\d{5}[W-Z]") << QString("a12345Z") << 0;
- QTest::newRow( "data6" ) << QString("[A-C]\\d{5}[W-Z]") << QString("A12345Z") << 2;
- QTest::newRow( "data7" ) << QString("[A-C]\\d{5}[W-Z]") << QString("B12") << 1;
-
- QTest::newRow( "data8" ) << QString("read\\S?me(\\.(txt|asc|1st))?") << QString("readme") << 2;
- QTest::newRow( "data9" ) << QString("read\\S?me(\\.(txt|asc|1st))?") << QString("read me.txt") << 0;
- QTest::newRow( "data10" ) << QString("read\\S?me(\\.(txt|asc|1st))?") << QString("readm") << 1;
-}
-
-void tst_QRegExpValidator::validate()
-{
- QFETCH( QString, rx );
- QFETCH( QString, value );
- QFETCH( int, state );
-
- QRegExpValidator rv( 0 );
- QSignalSpy spy(&rv, SIGNAL(regExpChanged(const QRegExp&)));
- QSignalSpy changedSpy(&rv, SIGNAL(changed()));
-
- rv.setRegExp( QRegExp( rx ) );
- int dummy;
- QCOMPARE( (int)rv.validate( value, dummy ), state );
- QCOMPARE(spy.count(), 1);
- QCOMPARE(changedSpy.count(), 1);
-}
-
-QTEST_MAIN(tst_QRegExpValidator)
-#include "tst_qregexpvalidator.moc"
diff --git a/tests/auto/widgets/widgets/widgets.pro b/tests/auto/widgets/widgets/widgets.pro
index 0497cd205e..12dfc8f7c8 100644
--- a/tests/auto/widgets/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets/widgets.pro
@@ -14,11 +14,9 @@ SUBDIRS=\
qdialogbuttonbox \
qdockwidget \
qdoublespinbox \
- qdoublevalidator \
qfocusframe \
qfontcombobox \
qgroupbox \
- qintvalidator \
qlabel \
qlcdnumber \
qlineedit \
@@ -31,7 +29,6 @@ SUBDIRS=\
qprogressbar \
qpushbutton \
qradiobutton \
- qregexpvalidator \
qscrollarea \
qscrollbar \
qsizegrip \