diff options
author | Andy Shaw <andy.shaw@qt.io> | 2017-11-21 13:05:45 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2018-02-02 00:16:57 +0000 |
commit | 5a10cf060e6c843f05d8bd820a4be4bb08f277ec (patch) | |
tree | 22425f0d59b53d5aee90467717aac1125338004d /tests | |
parent | 9c08bd6dd6666164089595ffa01dae1bcbf73097 (diff) |
Prevent invalid characters being entered at the appropriate times
When a validator does not allow for certain characters to be entered,
then it should not allow these to be entered in even if an input mask
is set. This fixes a regression introduced in
1b21b73e89942d567c90a17a3bf7a7ecae3de258.
The test modified is because this is in fact a general limitation when
combining validators and input masks, when a separator is used.
Whereas the original patch did allow this to be possible, this is now
not possible again.
Task-number: QTBUG-64616
Change-Id: Ic6a3f40a9faa7c04abc055cfc2752044fddd33a0
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 9b526f80c5..5b2c585a92 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -6143,9 +6143,17 @@ void tst_qquicktextinput::keypress_inputMask_withValidator_data() KeyList keys; // inserting '1111.11' then two backspaces keys << Qt::Key_Home << "1111.11" << Qt::Key_Backspace << Qt::Key_Backspace; - QTest::newRow("backspaceWithRegExp") << QString("9999.99;_") << 0.0 << 0.0 << 0 + QTest::newRow("backspaceWithRegExp") << QString("9999;_") << 0.0 << 0.0 << 0 << QString("/^[-]?((\\.\\d+)|(\\d+(\\.\\d+)?))$/") - << keys << QString("1111.") << QString("1111.__"); + << keys << QString("11") << QString("11__"); + } + { + KeyList keys; + // inserting '99' - QTBUG-64616 + keys << Qt::Key_Home << "99"; + QTest::newRow("invalidTextWithRegExp") << QString("X9;_") << 0.0 << 0.0 << 0 + << QString("/[+-][0+9]/") + << keys << QString("") << QString("__"); } } |