summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2010-02-12 04:12:04 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2010-02-12 04:12:04 (GMT)
commit697f8f9921701a5da3ef8a97c97f33ade1db8ecf (patch)
tree8ae25c8391b9422dfacd6cb10f1339e8f4e02556 /tests
parent3aa16c105b7f9e55e804ee6bbb738dd267e484f2 (diff)
downloadQt-697f8f9921701a5da3ef8a97c97f33ade1db8ecf.zip
Qt-697f8f9921701a5da3ef8a97c97f33ade1db8ecf.tar.gz
Qt-697f8f9921701a5da3ef8a97c97f33ade1db8ecf.tar.bz2
Adds inputMethodHint property to TextEdit and TextInput.
Reviewed-by: Martin Jones
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qmlgraphicstextedit/data/inputmethodhints.qml6
-rw-r--r--tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp16
-rw-r--r--tests/auto/declarative/qmlgraphicstextinput/data/inputmethodhints.qml6
-rw-r--r--tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp16
4 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/inputmethodhints.qml b/tests/auto/declarative/qmlgraphicstextedit/data/inputmethodhints.qml
new file mode 100644
index 0000000..c3d4c16
--- /dev/null
+++ b/tests/auto/declarative/qmlgraphicstextedit/data/inputmethodhints.qml
@@ -0,0 +1,6 @@
+import Qt 4.6
+
+TextEdit {
+ text: "Hello world!"
+ inputMethodHints: Qt.ImhNoPredictiveText
+}
diff --git a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
index 99e8259..2bfb280 100644
--- a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
+++ b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
@@ -76,6 +76,7 @@ private slots:
void persistentSelection();
void focusOnPress();
void selection();
+ void inputMethodHints();
void cursorDelegate();
void delegateLoading();
@@ -600,6 +601,21 @@ void tst_qmlgraphicstextedit::selection()
QVERIFY(textEditObject->selectedText().size() == 10);
}
+void tst_qmlgraphicstextedit::inputMethodHints()
+{
+ QmlView *canvas = createView(SRCDIR "/data/inputMethodHints.qml");
+ canvas->execute();
+ canvas->show();
+ canvas->setFocus();
+
+ QVERIFY(canvas->root() != 0);
+ QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit *>(canvas->root());
+ QVERIFY(textEditObject != 0);
+ QVERIFY(textEditObject->inputMethodHints() & Qt::ImhNoPredictiveText);
+ textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly);
+ QVERIFY(textEditObject->inputMethodHints() & Qt::ImhUppercaseOnly);
+}
+
void tst_qmlgraphicstextedit::cursorDelegate()
{
QmlView* view = createView(SRCDIR "/data/cursorTest.qml");
diff --git a/tests/auto/declarative/qmlgraphicstextinput/data/inputmethodhints.qml b/tests/auto/declarative/qmlgraphicstextinput/data/inputmethodhints.qml
new file mode 100644
index 0000000..b404682
--- /dev/null
+++ b/tests/auto/declarative/qmlgraphicstextinput/data/inputmethodhints.qml
@@ -0,0 +1,6 @@
+import Qt 4.6
+
+TextInput {
+ text: "Hello world!"
+ inputMethodHints: Qt.ImhNoPredictiveText
+}
diff --git a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp b/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp
index 7896464..c8fe446 100644
--- a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp
+++ b/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp
@@ -65,6 +65,7 @@ private slots:
void maxLength();
void masks();
void validators();
+ void inputMethodHints();
void cursorDelegate();
void navigation();
@@ -489,6 +490,21 @@ void tst_qmlgraphicstextinput::validators()
QCOMPARE(strInput->hasAcceptableInput(), true);
}
+void tst_qmlgraphicstextinput::inputMethodHints()
+{
+ QmlView *canvas = createView(SRCDIR "/data/inputMethodHints.qml");
+ canvas->execute();
+ canvas->show();
+ canvas->setFocus();
+
+ QVERIFY(canvas->root() != 0);
+ QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput *>(canvas->root());
+ QVERIFY(textinputObject != 0);
+ QVERIFY(textinputObject->inputMethodHints() & Qt::ImhNoPredictiveText);
+ textinputObject->setInputMethodHints(Qt::ImhUppercaseOnly);
+ QVERIFY(textinputObject->inputMethodHints() & Qt::ImhUppercaseOnly);
+}
+
/*
TextInput element should only handle left/right keys until the cursor reaches
the extent of the text, then they should ignore the keys.