diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-06-09 16:31:02 +0200 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-06-20 08:22:58 +0000 |
commit | 3847f51530bad6242f83aabab98e28934bde7cc6 (patch) | |
tree | 71c686b2799a94b02dc7a9e4cb28e36cf5038234 /tests/auto/quick/qmltests/data | |
parent | 3398abfc1b5b789d11592aada0b5860e36a50041 (diff) |
Add test for form validation's sub validation message
Since commit 8b0d048b02c1f1cb24fdb83f11791507df246e05 there is no test
for sub validation messages. Add new test based on test case of the
following fix: https://codereview.chromium.org/1671613003
Change-Id: I73de2a6709ebaa52bfe87b81b4b6f8a1cf072de8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/quick/qmltests/data')
-rw-r--r-- | tests/auto/quick/qmltests/data/forms.html | 8 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_formValidation.qml | 20 |
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/quick/qmltests/data/forms.html b/tests/auto/quick/qmltests/data/forms.html index d137c98f0..18133eca6 100644 --- a/tests/auto/quick/qmltests/data/forms.html +++ b/tests/auto/quick/qmltests/data/forms.html @@ -28,5 +28,13 @@ <input type="email" value="invalid" required/> <input type="submit" name="email_invalid"/> </form> + <form> + <input type="text" title="empty input" required/> + <input type="submit" name="input_empty"/> + </form> + <form> + <input type="text" pattern="Lorem ipsum" value="Lorem Ipsum" title="Should type 'Lorem ipsum'"/> + <input type="submit" name="lorem_ipsum"/> + </form> </body> </html> diff --git a/tests/auto/quick/qmltests/data/tst_formValidation.qml b/tests/auto/quick/qmltests/data/tst_formValidation.qml index f8d6c4e15..cae41821c 100644 --- a/tests/auto/quick/qmltests/data/tst_formValidation.qml +++ b/tests/auto/quick/qmltests/data/tst_formValidation.qml @@ -89,5 +89,25 @@ TestWebEngineView { showSpy.wait() compare(showSpy.signalArguments[1][0], "Please include an '@' in the email address. 'invalid' is missing an '@'.") } + + function test_textForm() { + webEngineView.url = Qt.resolvedUrl("forms.html#input_empty") + verify(webEngineView.waitForLoadSucceeded()) + keyPress(Qt.Key_Enter) + showSpy.wait() + compare(showSpy.signalArguments[0][0], "Please fill out this field.") + // Title should be shown for pattern mismatch only + compare(showSpy.signalArguments[0][1], "") + + webEngineView.url = Qt.resolvedUrl("about:blank") + verify(webEngineView.waitForLoadSucceeded()) + + webEngineView.url = Qt.resolvedUrl("forms.html#lorem_ipsum") + verify(webEngineView.waitForLoadSucceeded()) + keyPress(Qt.Key_Enter) + showSpy.wait() + compare(showSpy.signalArguments[1][0], "Please match the requested format.") + compare(showSpy.signalArguments[1][1], "Should type 'Lorem ipsum'") + } } } |