summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-11-10 03:45:31 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-11-10 03:45:31 (GMT)
commit5f7837cea3184f122796b4f1b51758534cedf356 (patch)
treeaa81807801632437480ece97d906369018a2325b /tests
parente3dabb89cd82967ebdbd384154d2db5086f42669 (diff)
downloadQt-5f7837cea3184f122796b4f1b51758534cedf356.zip
Qt-5f7837cea3184f122796b4f1b51758534cedf356.tar.gz
Qt-5f7837cea3184f122796b4f1b51758534cedf356.tar.bz2
Improve text edit test
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
index 2b10df5..4dc036d 100644
--- a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
+++ b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
@@ -69,6 +69,9 @@ private slots:
void vAlign();
void font();
void color();
+ void textMargin();
+ void persistentSelection();
+ void focusOnPress();
void selection();
void cursorDelegate();
@@ -433,6 +436,55 @@ void tst_qmlgraphicstextedit::color()
}
}
+void tst_qmlgraphicstextedit::textMargin()
+{
+ for(qreal i=0; i<=10; i+=0.3){
+ QString componentStr = "import Qt 4.6\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }";
+ QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
+ QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create());
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->textMargin(), i);
+ }
+}
+
+void tst_qmlgraphicstextedit::persistentSelection()
+{
+ {
+ QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: true; text: \"Hello World\" }";
+ QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
+ QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create());
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->persistentSelection(), true);
+ }
+
+ {
+ QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: false; text: \"Hello World\" }";
+ QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
+ QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create());
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->persistentSelection(), false);
+ }
+}
+
+void tst_qmlgraphicstextedit::focusOnPress()
+{
+ {
+ QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: true; text: \"Hello World\" }";
+ QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
+ QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create());
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->focusOnPress(), true);
+ }
+
+ {
+ QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: false; text: \"Hello World\" }";
+ QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
+ QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create());
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->focusOnPress(), false);
+ }
+}
+
void tst_qmlgraphicstextedit::selection()
{
QString testStr = standard[0];//TODO: What should happen for multiline/rich text?