aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicktextinput
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2019-12-02 14:33:39 +0100
committerJan Arve Sæther <jan-arve.saether@qt.io>2019-12-02 15:43:01 +0100
commitbd7ce75f26ae646176b22310c8cdbf568c7516dd (patch)
tree1666a5b666b61477c9709d0bc05c5614b7c5cf04 /tests/auto/quick/qquicktextinput
parent23df1603f514407d245a2740f32f589318ef654e (diff)
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 <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicktextinput')
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp8
1 files changed, 8 insertions, 0 deletions
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<QQuickTextInput*>(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);