diff options
Diffstat (limited to 'tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp')
-rw-r--r-- | tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp | 52 |
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? |