From bd7ce75f26ae646176b22310c8cdbf568c7516dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Mon, 2 Dec 2019 14:33:39 +0100 Subject: Do not emit inputMaskChanged when setting the same input mask If you did not specify a blank character (e.g. "; " as suffix) it would internally add that suffix to the property, resulting in that the property itself actually got a "; " suffix even when not specified. So when setting the same input mask again, it wouldn't match the existing inputMask property, and it would emit inputMaskChanged again. Change-Id: Ia47d63d56c640b4be9d6d0a704ddfaff01befbdb Fixes: QTBUG-80190 Reviewed-by: Richard Moe Gustavsen --- tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index cab4e1145f..6f24ca8ded 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -6411,6 +6411,14 @@ void tst_qquicktextinput::setInputMask() QQuickTextInput *textInput = qobject_cast(textInputComponent.create()); QVERIFY(textInput != nullptr); + // [QTBUG-80190] check if setting the same property value again doesn't emit an + // inputMaskChanged signal + QString unescapedMask = mask; // mask is escaped, because '\' is also escape in a JS string + unescapedMask.replace(QLatin1String("\\\\"), QLatin1String("\\")); // simple unescape + QSignalSpy spy(textInput, SIGNAL(inputMaskChanged(const QString &))); + textInput->setInputMask(unescapedMask); + QCOMPARE(spy.count(), 0); + // then either insert using insert() or keyboard if (insert_text) { textInput->insert(0, input); -- cgit v1.2.3