summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-07-13 16:34:32 -0700
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-07-13 16:36:10 -0700
commitd38fe875c7850ca2c6ca28f91e94ae276735fac8 (patch)
treee5c92cef74e0853490d77cf0139b23f00d548a6e /tests/auto
parentac4e848c9802377b7c4ff673180f28b9ca76b746 (diff)
parent627f0a7f7d775ecd263b95dd07fca44bfcb0c5cf (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/widgets/widgets/qmainwindowlayout.cpp Change-Id: I306b4f5ad11bceb336c9091241b468d455fe6bb6
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/io/qfile/BLACKLIST6
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/BLACKLIST3
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp8
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp19
-rw-r--r--tests/auto/corelib/tools/qtime/tst_qtime.cpp15
-rw-r--r--tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp5
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp108
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp83
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp11
10 files changed, 234 insertions, 28 deletions
diff --git a/tests/auto/corelib/io/qfile/BLACKLIST b/tests/auto/corelib/io/qfile/BLACKLIST
index e3bc093c83..8d636d40b8 100644
--- a/tests/auto/corelib/io/qfile/BLACKLIST
+++ b/tests/auto/corelib/io/qfile/BLACKLIST
@@ -1,8 +1,10 @@
# QTBUG-48455
[readLineStdin]
-msvc-2015
+msvc-2015 ci
+msvc-2017 ci
[readLineStdin_lineByLine]
-msvc-2015
+msvc-2015 ci
+msvc-2017 ci
[openStandardStreamsFileDescriptors]
osx
[openStandardStreamsBufferedStreams]
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index 0ee7599b2c..154c7ec5bf 100644
--- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -568,6 +568,10 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
QCOMPARE(fileChangedSpy.count(), 0);
QCOMPARE(dirChangedSpy.count(), 1);
+ // QTBUG-61792, removal should succeed (bug on Windows which uses one change
+ // notification per directory).
+ QVERIFY(watcher.removePath(testDir.absolutePath()));
+
QVERIFY(temporaryDir.rmdir(testDirName));
}
diff --git a/tests/auto/corelib/io/qprocess/BLACKLIST b/tests/auto/corelib/io/qprocess/BLACKLIST
index 216faa7fb4..a278af12d3 100644
--- a/tests/auto/corelib/io/qprocess/BLACKLIST
+++ b/tests/auto/corelib/io/qprocess/BLACKLIST
@@ -2,4 +2,5 @@
redhatenterpriselinuxworkstation-6.6
# QTBUG-48455
[fileWriterProcess]
-msvc-2015
+msvc-2015 ci
+msvc-2017 ci
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 97fce88f19..bddc1cd2b2 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -2558,6 +2558,8 @@ void tst_QVariant::variantMap()
QVariant v3 = QVariant(QMetaType::type("QMap<QString, QVariant>"), &map);
QCOMPARE(qvariant_cast<QVariantMap>(v3).value("test").toInt(), 42);
+ QCOMPARE(v, QVariant(v.toHash()));
+
// multi-keys
map.insertMulti("test", 47);
v = map;
@@ -2565,6 +2567,8 @@ void tst_QVariant::variantMap()
QCOMPARE(map2, map);
map2 = v.toMap();
QCOMPARE(map2, map);
+
+ QCOMPARE(v, QVariant(v.toHash()));
}
void tst_QVariant::variantHash()
@@ -2587,6 +2591,8 @@ void tst_QVariant::variantHash()
QVariant v3 = QVariant(QMetaType::type("QHash<QString, QVariant>"), &hash);
QCOMPARE(qvariant_cast<QVariantHash>(v3).value("test").toInt(), 42);
+ QCOMPARE(v, QVariant(v.toMap()));
+
// multi-keys
hash.insertMulti("test", 47);
v = hash;
@@ -2594,6 +2600,8 @@ void tst_QVariant::variantHash()
QCOMPARE(hash2, hash);
hash2 = v.toHash();
QCOMPARE(hash2, hash);
+
+ QCOMPARE(v, QVariant(v.toMap()));
}
class CustomQObject : public QObject {
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index 661074ac16..88984feff7 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -1309,10 +1309,11 @@ void tst_QLocale::formatTime_data()
QTest::newRow("28") << QTime(1, 2, 3, 456) << "H:m:s.z" << "1:2:3.456";
QTest::newRow("29") << QTime(1, 2, 3, 456) << "H:m:s.zz" << "1:2:3.456456";
QTest::newRow("30") << QTime(1, 2, 3, 456) << "H:m:s.zzz" << "1:2:3.456";
- QTest::newRow("31") << QTime(1, 2, 3, 4) << "H:m:s.z" << "1:2:3.4";
- QTest::newRow("32") << QTime(1, 2, 3, 4) << "H:m:s.zzz" << "1:2:3.004";
- QTest::newRow("33") << QTime() << "H:m:s.zzz" << "";
- QTest::newRow("34") << QTime(1, 2, 3, 4) << "dd MM yyyy H:m:s.zzz" << "dd MM yyyy 1:2:3.004";
+ QTest::newRow("31") << QTime(1, 2, 3, 400) << "H:m:s.z" << "1:2:3.4";
+ QTest::newRow("32") << QTime(1, 2, 3, 4) << "H:m:s.z" << "1:2:3.004";
+ QTest::newRow("33") << QTime(1, 2, 3, 4) << "H:m:s.zzz" << "1:2:3.004";
+ QTest::newRow("34") << QTime() << "H:m:s.zzz" << "";
+ QTest::newRow("35") << QTime(1, 2, 3, 4) << "dd MM yyyy H:m:s.zzz" << "dd MM yyyy 1:2:3.004";
}
void tst_QLocale::formatTime()
@@ -1551,10 +1552,12 @@ void tst_QLocale::toDateTime_data()
<< "d/M/yyyy hh:h:mm" << "1/12/1974 05:5:14";
QTest::newRow("2C") << "C" << QDateTime(QDate(1974, 12, 1), QTime(15, 0, 0))
<< "d/M/yyyyy h" << "1/12/1974y 15";
- QTest::newRow("4C") << "C" << QDateTime(QDate(1974, 1, 1), QTime(0, 0, 0))
- << "d/M/yyyy zzz" << "1/1/1974 000";
- QTest::newRow("5C") << "C" << QDateTime(QDate(1974, 1, 1), QTime(0, 0, 0))
- << "dd/MM/yyy z" << "01/01/74y 0";
+ QTest::newRow("4C") << "C" << QDateTime(QDate(1974, 1, 1), QTime(0, 0, 0, 1))
+ << "d/M/yyyy zzz" << "1/1/1974 001";
+ QTest::newRow("5C") << "C" << QDateTime(QDate(1974, 1, 1), QTime(0, 0, 0, 1))
+ << "dd/MM/yyy z" << "01/01/74y 001";
+ QTest::newRow("5Cbis") << "C" << QDateTime(QDate(1974, 1, 1), QTime(0, 0, 0, 100))
+ << "dd/MM/yyy z" << "01/01/74y 1";
QTest::newRow("8C") << "C" << QDateTime(QDate(1974, 12, 2), QTime(0, 0, 13))
<< "ddddd/MMMMM/yy ss" << "Monday2/December12/74 13";
QTest::newRow("9C") << "C" << QDateTime(QDate(1974, 12, 1), QTime(0, 0, 13))
diff --git a/tests/auto/corelib/tools/qtime/tst_qtime.cpp b/tests/auto/corelib/tools/qtime/tst_qtime.cpp
index 71bf39fc4e..162047b537 100644
--- a/tests/auto/corelib/tools/qtime/tst_qtime.cpp
+++ b/tests/auto/corelib/tools/qtime/tst_qtime.cpp
@@ -560,6 +560,8 @@ void tst_QTime::fromStringFormat_data()
QTest::newRow("data9") << QString("2221") << QString("hhhh") << invalidTime();
QTest::newRow("data10") << QString("02:23PM") << QString("hh:mmAP") << QTime(14,23,0,0);
QTest::newRow("data11") << QString("02:23pm") << QString("hh:mmap") << QTime(14,23,0,0);
+ QTest::newRow("short-msecs-lt100") << QString("10:12:34:045") << QString("hh:m:ss:z") << QTime(10,12,34,45);
+ QTest::newRow("short-msecs-gt100") << QString("10:12:34:45") << QString("hh:m:ss:z") << QTime(10,12,34,450);
}
void tst_QTime::fromStringFormat()
@@ -711,12 +713,13 @@ void tst_QTime::toStringFormat_data()
QTest::addColumn<QString>("format");
QTest::addColumn<QString>("str");
- QTest::newRow( "data0" ) << QTime(0,0,0,0) << QString("h:m:s:z") << QString("0:0:0:0");
- QTest::newRow( "data1" ) << QTime(10,12,34,53) << QString("hh:mm:ss:zzz") << QString("10:12:34:053");
- QTest::newRow( "data2" ) << QTime(10,12,34,45) << QString("hh:m:ss:z") << QString("10:12:34:45");
- QTest::newRow( "data3" ) << QTime(10,12,34,45) << QString("hh:ss ap") << QString("10:34 am");
- QTest::newRow( "data4" ) << QTime(22,12,34,45) << QString("hh:zzz AP") << QString("10:045 PM");
- QTest::newRow( "data5" ) << QTime(230,230,230,230) << QString("hh:mm:ss") << QString();
+ QTest::newRow( "midnight" ) << QTime(0,0,0,0) << QString("h:m:s:z") << QString("0:0:0:0");
+ QTest::newRow( "full" ) << QTime(10,12,34,53) << QString("hh:mm:ss:zzz") << QString("10:12:34:053");
+ QTest::newRow( "short-msecs-lt100" ) << QTime(10,12,34,45) << QString("hh:m:ss:z") << QString("10:12:34:045");
+ QTest::newRow( "short-msecs-gt100" ) << QTime(10,12,34,450) << QString("hh:m:ss:z") << QString("10:12:34:45");
+ QTest::newRow( "am-pm" ) << QTime(10,12,34,45) << QString("hh:ss ap") << QString("10:34 am");
+ QTest::newRow( "AM-PM" ) << QTime(22,12,34,45) << QString("hh:zzz AP") << QString("10:045 PM");
+ QTest::newRow( "invalid" ) << QTime(230,230,230,230) << QString("hh:mm:ss") << QString();
}
void tst_QTime::toStringFormat()
diff --git a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
index 0edc5a92ea..20cd8caad3 100644
--- a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
+++ b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
@@ -1083,6 +1083,11 @@ void tst_QDBusAbstractAdaptor::methodCallsPeer_data()
void tst_QDBusAbstractAdaptor::methodCallsPeer()
{
+ if (QSysInfo::productType().compare("opensuse", Qt::CaseInsensitive) == 0
+ && QSysInfo::productVersion() == QLatin1String("42.1")
+ && qgetenv("QTEST_ENVIRONMENT").split(' ').contains("ci")) {
+ QSKIP("This test is occasionally hanging in the CI");
+ }
QDBusConnection con("peer");
QVERIFY(con.isConnected());
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index ed5b9fabb6..779783d5ec 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -303,6 +303,8 @@ private slots:
void blendNullRGB32();
void toRGB64();
+ void fillPolygon();
+
private:
void fillData();
void setPenColor(QPainter& p);
@@ -5144,6 +5146,112 @@ void tst_QPainter::toRGB64()
}
}
+void tst_QPainter::fillPolygon()
+{
+ QImage image(50, 50, QImage::Format_RGB32);
+ image.fill(Qt::white);
+
+ QPainter painter(&image);
+ QBrush brush(Qt::black, Qt::SolidPattern);
+ painter.setBrush(brush);
+
+ QPen pen(Qt::red, 0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+ painter.setPen(pen);
+
+ const QPoint diamondpoints[5] = {
+ QPoint(-15, 0),
+ QPoint(0, -15),
+ QPoint(15, 0),
+ QPoint(0, 15),
+ QPoint(-15, 0)
+ };
+ enum { Outside1, Border1, Inside, Border2, Outside2 } state;
+
+ for (int i = 0; i < 16 ; i++)
+ {
+ for (int j = 0; j < 16 ; j++)
+ {
+ image.fill(Qt::white);
+ painter.resetTransform();
+ painter.translate(25 + i/16., 25 + j/16.);
+ painter.drawPolygon(diamondpoints, 5);
+
+ for (int x = 0; x < 50; x++) {
+ state = Outside1;
+ for (int y = 0; y < 50; y++) {
+ QRgb c = image.pixel(x, y);
+ switch (state) {
+ case Outside1:
+ if (c == QColor(Qt::red).rgb())
+ state = Border1;
+ else
+ QCOMPARE(c, QColor(Qt::white).rgb());
+ break;
+ case Border1:
+ if (c == QColor(Qt::black).rgb())
+ state = Inside;
+ else if (c == QColor(Qt::white).rgb())
+ state = Outside2;
+ else
+ QCOMPARE(c, QColor(Qt::red).rgb());
+ break;
+ case Inside:
+ if (c == QColor(Qt::red).rgb())
+ state = Border2;
+ else
+ QCOMPARE(c, QColor(Qt::black).rgb());
+ break;
+ case Border2:
+ if (c == QColor(Qt::white).rgb())
+ state = Outside2;
+ else
+ QCOMPARE(c, QColor(Qt::red).rgb());
+ break;
+ case Outside2:
+ QCOMPARE(c, QColor(Qt::white).rgb());
+ }
+ }
+ }
+ for (int y = 0; y < 50; y++) {
+ state = Outside1;
+ for (int x = 0; x < 50; x++) {
+ QRgb c = image.pixel(x, y);
+ switch (state) {
+ case Outside1:
+ if (c == QColor(Qt::red).rgb())
+ state = Border1;
+ else
+ QCOMPARE(c, QColor(Qt::white).rgb());
+ break;
+ case Border1:
+ if (c == QColor(Qt::black).rgb())
+ state = Inside;
+ else if (c == QColor(Qt::white).rgb())
+ state = Outside2;
+ else
+ QCOMPARE(c, QColor(Qt::red).rgb());
+ break;
+ case Inside:
+ if (c == QColor(Qt::red).rgb())
+ state = Border2;
+ else
+ QCOMPARE(c, QColor(Qt::black).rgb());
+ break;
+ case Border2:
+ if (c == QColor(Qt::white).rgb())
+ state = Outside2;
+ else
+ QCOMPARE(c, QColor(Qt::red).rgb());
+ break;
+ case Outside2:
+ QCOMPARE(c, QColor(Qt::white).rgb());
+ }
+ }
+ }
+ }
+ }
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index a89f8f3c8a..b9785c35ac 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -60,6 +60,10 @@ static inline HWND getHWNDForWidget(const QWidget *widget)
}
#endif // Q_OS_WIN
+Q_DECLARE_METATYPE(QAbstractItemView::ScrollMode)
+Q_DECLARE_METATYPE(QMargins)
+Q_DECLARE_METATYPE(QSize)
+
// Make a widget frameless to prevent size constraints of title bars
// from interfering (Windows).
static inline void setFrameless(QWidget *w)
@@ -902,10 +906,11 @@ class PublicListView : public QListView
class TestDelegate : public QItemDelegate
{
public:
- TestDelegate(QObject *parent) : QItemDelegate(parent), m_sizeHint(50,50) {}
+ explicit TestDelegate(QObject *parent, const QSize &sizeHint = QSize(50,50))
+ : QItemDelegate(parent), m_sizeHint(sizeHint) {}
QSize sizeHint(const QStyleOptionViewItem &, const QModelIndex &) const { return m_sizeHint; }
- QSize m_sizeHint;
+ const QSize m_sizeHint;
};
typedef QList<int> IntList;
@@ -1250,9 +1255,7 @@ void tst_QListView::scrollBarRanges()
lv.setModel(&model);
lv.resize(250, 130);
- TestDelegate *delegate = new TestDelegate(&lv);
- delegate->m_sizeHint = QSize(100, rowHeight);
- lv.setItemDelegate(delegate);
+ lv.setItemDelegate(new TestDelegate(&lv, QSize(100, rowHeight)));
topLevel.show();
for (int h = 30; h <= 210; ++h) {
@@ -1268,14 +1271,18 @@ void tst_QListView::scrollBarAsNeeded_data()
{
QTest::addColumn<QSize>("size");
QTest::addColumn<int>("itemCount");
+ QTest::addColumn<QAbstractItemView::ScrollMode>("verticalScrollMode");
+ QTest::addColumn<QMargins>("viewportMargins");
+ QTest::addColumn<QSize>("delegateSize");
QTest::addColumn<int>("flow");
QTest::addColumn<bool>("horizontalScrollBarVisible");
QTest::addColumn<bool>("verticalScrollBarVisible");
-
QTest::newRow("TopToBottom, count:0")
<< QSize(200, 100)
<< 0
+ << QListView::ScrollPerItem
+ << QMargins() << QSize()
<< int(QListView::TopToBottom)
<< false
<< false;
@@ -1283,6 +1290,8 @@ void tst_QListView::scrollBarAsNeeded_data()
QTest::newRow("TopToBottom, count:1")
<< QSize(200, 100)
<< 1
+ << QListView::ScrollPerItem
+ << QMargins() << QSize()
<< int(QListView::TopToBottom)
<< false
<< false;
@@ -1290,13 +1299,46 @@ void tst_QListView::scrollBarAsNeeded_data()
QTest::newRow("TopToBottom, count:20")
<< QSize(200, 100)
<< 20
+ << QListView::ScrollPerItem
+ << QMargins() << QSize()
+ << int(QListView::TopToBottom)
+ << false
+ << true;
+
+ QTest::newRow("TopToBottom, fixed size, count:4")
+ << QSize(200, 200)
+ << 4
+ << QListView::ScrollPerPixel
+ << QMargins() << QSize(40, 40)
+ << int(QListView::TopToBottom)
+ << false
+ << false;
+
+ // QTBUG-61383, vertical case: take viewport margins into account
+ QTest::newRow("TopToBottom, fixed size, vertical margins, count:4")
+ << QSize(200, 200)
+ << 4
+ << QListView::ScrollPerPixel
+ << QMargins(0, 50, 0, 50) << QSize(40, 40)
<< int(QListView::TopToBottom)
<< false
<< true;
+ // QTBUG-61383, horizontal case: take viewport margins into account
+ QTest::newRow("TopToBottom, fixed size, horizontal margins, count:4")
+ << QSize(200, 200)
+ << 4
+ << QListView::ScrollPerPixel
+ << QMargins(50, 0, 50, 0) << QSize(120, 40)
+ << int(QListView::TopToBottom)
+ << true
+ << false;
+
QTest::newRow("LeftToRight, count:0")
<< QSize(200, 100)
<< 0
+ << QListView::ScrollPerItem
+ << QMargins() << QSize()
<< int(QListView::LeftToRight)
<< false
<< false;
@@ -1304,6 +1346,8 @@ void tst_QListView::scrollBarAsNeeded_data()
QTest::newRow("LeftToRight, count:1")
<< QSize(200, 100)
<< 1
+ << QListView::ScrollPerItem
+ << QMargins() << QSize()
<< int(QListView::LeftToRight)
<< false
<< false;
@@ -1311,17 +1355,31 @@ void tst_QListView::scrollBarAsNeeded_data()
QTest::newRow("LeftToRight, count:20")
<< QSize(200, 100)
<< 20
+ << QListView::ScrollPerItem
+ << QMargins() << QSize()
<< int(QListView::LeftToRight)
<< true
<< false;
}
+
+class ScrollBarTestListView : public QListView
+{
+ public:
+ explicit ScrollBarTestListView(QWidget *p) : QListView(p) {}
+
+ using QAbstractScrollArea::setViewportMargins;
+};
+
void tst_QListView::scrollBarAsNeeded()
{
QFETCH(QSize, size);
QFETCH(int, itemCount);
+ QFETCH(QAbstractItemView::ScrollMode, verticalScrollMode);
+ QFETCH(QMargins, viewportMargins);
+ QFETCH(QSize, delegateSize);
QFETCH(int, flow);
QFETCH(bool, horizontalScrollBarVisible);
QFETCH(bool, verticalScrollBarVisible);
@@ -1330,10 +1388,17 @@ void tst_QListView::scrollBarAsNeeded()
const int rowCounts[3] = {0, 1, 20};
QWidget topLevel;
- QListView lv(&topLevel);
+ topLevel.setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QStringLiteral("::")
+ + QLatin1String(QTest::currentDataTag()));
+ ScrollBarTestListView lv(&topLevel);
lv.setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
lv.setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+ lv.setVerticalScrollMode(verticalScrollMode);
+ lv.setViewportMargins(viewportMargins);
lv.setFlow((QListView::Flow)flow);
+ if (!delegateSize.isEmpty())
+ lv.setItemDelegate(new TestDelegate(&lv, delegateSize));
+
QStringListModel model(&lv);
lv.setModel(&model);
lv.resize(size);
@@ -2380,9 +2445,7 @@ void tst_QListView::horizontalScrollingByVerticalWheelEvents()
QListView lv;
lv.setWrapping(true);
- TestDelegate *delegate = new TestDelegate(&lv);
- delegate->m_sizeHint = QSize(100, 100);
- lv.setItemDelegate(delegate);
+ lv.setItemDelegate(new TestDelegate(&lv, QSize(100, 100)));
QtTestModel model;
model.colCount = 1;
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index a0ba91ba4a..3f7fdd6f6f 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -3106,7 +3106,6 @@ void tst_QLineEdit::inputMaskAndValidator()
void tst_QLineEdit::maxLengthAndInputMask()
{
- // Really a test for #30447
QLineEdit *testWidget = ensureTestWidget();
QVERIFY(testWidget->inputMask().isNull());
testWidget->setMaxLength(10);
@@ -3114,6 +3113,16 @@ void tst_QLineEdit::maxLengthAndInputMask()
testWidget->setInputMask(QString());
QVERIFY(testWidget->inputMask().isNull());
QCOMPARE(testWidget->maxLength(), 10);
+
+ testWidget->setInputMask("XXXX");
+ QCOMPARE(testWidget->maxLength(), 4);
+
+ testWidget->setMaxLength(15);
+ QCOMPARE(testWidget->maxLength(), 4);
+
+ // 8 \ => raw string with 4 \ => input mask with 2 \ => maxLength = 2
+ testWidget->setInputMask("\\\\\\\\");
+ QCOMPARE(testWidget->maxLength(), 2);
}