Make the inputRejected test compatible with -no-feature-clipboard

Qt for QNX is, by default, built without the clipboard feature.

Change-Id: Ie8a36ceb0c0f0a695ae7d0fcf6f0bd70d2a43e0c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Rafael Roquetto <rafael@roquetto.com>
This commit is contained in:
James McDonnell 2019-06-24 14:59:20 -04:00
parent 5dc318d5e8
commit 12d37e70a7

View File

@ -4842,6 +4842,7 @@ void tst_QLineEdit::inputRejected()
QCOMPARE(spyInputRejected.count(), 0);
QTest::keyClicks(testWidget, "fgh");
QCOMPARE(spyInputRejected.count(), 3);
#if QT_CONFIG(clipboard)
testWidget->clear();
spyInputRejected.clear();
QApplication::clipboard()->setText("ijklmno");
@ -4849,6 +4850,7 @@ void tst_QLineEdit::inputRejected()
// The first 5 characters are accepted, but
// the last 2 are not.
QCOMPARE(spyInputRejected.count(), 1);
#endif
testWidget->setMaxLength(INT_MAX);
testWidget->clear();
@ -4859,11 +4861,13 @@ void tst_QLineEdit::inputRejected()
QCOMPARE(spyInputRejected.count(), 0);
QTest::keyClicks(testWidget, "a#");
QCOMPARE(spyInputRejected.count(), 2);
#if QT_CONFIG(clipboard)
testWidget->clear();
spyInputRejected.clear();
QApplication::clipboard()->setText("a#");
testWidget->paste();
QCOMPARE(spyInputRejected.count(), 1);
#endif
testWidget->clear();
testWidget->setValidator(0);