diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-16 00:13:24 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-16 00:13:24 (GMT) |
commit | e4e566272f41a27b7b160c6e1344d24f66ad022c (patch) | |
tree | 0a0ab20cb0dca377a4c6129882daee3719342e60 /tests/auto/declarative | |
parent | 338d6ca0d2d98c8c3ffc8c29b8135de8e0bb8a7b (diff) | |
parent | 2eb67032ea81aa105a854644f337ad5377c2994e (diff) | |
download | Qt-e4e566272f41a27b7b160c6e1344d24f66ad022c.zip Qt-e4e566272f41a27b7b160c6e1344d24f66ad022c.tar.gz Qt-e4e566272f41a27b7b160c6e1344d24f66ad022c.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests/auto/declarative')
6 files changed, 59 insertions, 7 deletions
diff --git a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp index 7ab598f..f78e564 100644 --- a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp +++ b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp @@ -433,10 +433,10 @@ void tst_qfxtextedit::selection() void tst_qfxtextedit::cursorDelegate() { - QmlView* view = new QmlView(0); - view->show(); - view->setUrl(QUrl("data/cursorTest.qml")); + QmlView* view = createView(SRCDIR "/data/cursorTest.qml"); view->execute(); + view->show(); + view->setFocus(); QFxTextEdit *textEditObject = view->root()->findChild<QFxTextEdit*>("textEditObject"); QVERIFY(textEditObject != 0); QVERIFY(textEditObject->findChild<QFxItem*>("cursorInstance")); @@ -467,6 +467,7 @@ void tst_qfxtextedit::navigation() QmlView *canvas = createView(SRCDIR "/data/navigation.qml"); canvas->execute(); canvas->show(); + canvas->setFocus(); QVERIFY(canvas->root() != 0); @@ -474,6 +475,7 @@ void tst_qfxtextedit::navigation() QVERIFY(input != 0); QTRY_VERIFY(input->hasFocus() == true); + QEXPECT_FAIL("", "Depends on QT-2236", Abort); simulateKey(canvas, Qt::Key_Left); QVERIFY(input->hasFocus() == false); simulateKey(canvas, Qt::Key_Right); diff --git a/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp b/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp index bd0b9c3..069574c 100644 --- a/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp +++ b/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp @@ -310,6 +310,7 @@ void tst_qfxtextinput::navigation() QmlView *canvas = createView(SRCDIR "/data/navigation.qml"); canvas->execute(); canvas->show(); + canvas->setFocus(); QVERIFY(canvas->root() != 0); @@ -329,7 +330,30 @@ void tst_qfxtextinput::navigation() void tst_qfxtextinput::cursorDelegate() { - //TODO:Get the QFxTextEdit test passing first + QmlView* view = createView(SRCDIR "/data/cursorTest.qml"); + view->execute(); + view->show(); + view->setFocus(); + QFxTextInput *textInputObject = view->root()->findChild<QFxTextInput*>("textInputObject"); + QVERIFY(textInputObject != 0); + QVERIFY(textInputObject->findChild<QFxItem*>("cursorInstance")); + //Test Delegate gets created + textInputObject->setFocus(true); + QFxItem* delegateObject = textInputObject->findChild<QFxItem*>("cursorInstance"); + QVERIFY(delegateObject); + //Test Delegate gets moved + for(int i=0; i<= textInputObject->text().length(); i++){ + textInputObject->setCursorPosition(i); + //+5 is because the TextInput cursorRect is just a 10xHeight area centered on cursor position + QCOMPARE(textInputObject->cursorRect().x() + 5, qRound(delegateObject->x())); + QCOMPARE(textInputObject->cursorRect().y(), qRound(delegateObject->y())); + } + textInputObject->setCursorPosition(0); + QCOMPARE(textInputObject->cursorRect().x()+5, qRound(delegateObject->x())); + QCOMPARE(textInputObject->cursorRect().y(), qRound(delegateObject->y())); + //Test Delegate gets deleted + textInputObject->setCursorDelegate(0); + QVERIFY(!textInputObject->findChild<QFxItem*>("cursorInstance")); } void tst_qfxtextinput::simulateKey(QmlView *view, int key) diff --git a/tests/auto/declarative/qmllanguage/data/i18nNameSpace.qml b/tests/auto/declarative/qmllanguage/data/i18nNameSpace.qml new file mode 100644 index 0000000..c0b2f94 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/i18nNameSpace.qml @@ -0,0 +1,5 @@ +import Test 1.0 as Áâãäå + +Áâãäå.MyTypeObject { + stringProperty: "Test áâãäå: 40" +} diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp index b68d9bf..8d4ae65 100644 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp @@ -126,14 +126,14 @@ void tst_qmllanguage::initTestCase() // For utf-8 locale, this will be data/I18nType??????????.qml where ?????????? is 5 8-bit characters, UTF-8 encoded QFile in(TEST_FILE(QLatin1String("I18nType30.qml")).toLocalFile()); QVERIFY(in.open(QIODevice::ReadOnly)); - QFile out(TEST_FILE(QString::fromUtf8("I18nType\303\241\303\242\303\243\303\244\303\245.qml")).toLocalFile()); + QFile out(TEST_FILE(QString::fromUtf8("I18nType\303\201\303\242\303\243\303\244\303\245.qml")).toLocalFile()); QVERIFY(out.open(QIODevice::WriteOnly)); out.write(in.readAll()); } void tst_qmllanguage::cleanupTestCase() { - QVERIFY(QFile::remove(TEST_FILE(QString::fromUtf8("I18nType\303\241\303\242\303\243\303\244\303\245.qml")).toLocalFile())); + QVERIFY(QFile::remove(TEST_FILE(QString::fromUtf8("I18nType\303\201\303\242\303\243\303\244\303\245.qml")).toLocalFile())); } void tst_qmllanguage::errors_data() @@ -711,6 +711,7 @@ void tst_qmllanguage::i18n_data() QTest::newRow("i18nDeclaredPropertyUse") << "i18nDeclaredPropertyUse.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 15"); QTest::newRow("i18nScript") << "i18nScript.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 20"); QTest::newRow("i18nType") << "i18nType.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 30"); + QTest::newRow("i18nNameSpace") << "i18nNameSpace.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 40"); } void tst_qmllanguage::i18n() diff --git a/tests/auto/declarative/visual/qfxtext/elide/multilength.qml b/tests/auto/declarative/visual/qfxtext/elide/multilength.qml new file mode 100644 index 0000000..6cd37b4 --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/elide/multilength.qml @@ -0,0 +1,20 @@ +import Qt 4.6 + +Rectangle { + width: 500 + height: 50 + color: "lightBlue" + Rectangle { + width: MyText.width + height: MyText.height + color: "white" + anchors.centerIn: parent + Text { + id: MyText + width: NumberAnimation { from: 500; to: 0; running: true; repeat: true; duration: 1000 } + elide: "ElideRight" + text: "aaaaaaa bbbbbbb ccccccc\x9Caaaaa bbbbb ccccc\x9Caaa bbb ccc\x9Ca b c" + text: "Brevity is the soul of wit, and tediousness the limbs and outward flourishes.\x9CBrevity is a great charm of eloquence.\x9CBe concise!\x9CSHHHHHHHHHHHHHHHHHHHHHHHHHHHH" + } + } +} diff --git a/tests/auto/declarative/visual/tst_visual.cpp b/tests/auto/declarative/visual/tst_visual.cpp index 367166d..cb32085 100644 --- a/tests/auto/declarative/visual/tst_visual.cpp +++ b/tests/auto/declarative/visual/tst_visual.cpp @@ -112,7 +112,7 @@ QString tst_visual::toTestScript(const QString &file, Mode mode) QString("data"); QString testname = file.mid(index + 1, file.length() - index - 5); - if (platformsuffix && (mode == UpdatePlatformVisuals || QDir(testdata+QLatin1String(platformsuffix)).exists())) { + if (platformsuffix && (mode == UpdatePlatformVisuals || QFile::exists(testdata+QLatin1String(platformsuffix)+QDir::separator()+testname))) { QString platformdir = testdata + QLatin1String(platformsuffix); if (mode == UpdatePlatformVisuals) { Q_ASSERT(QDir().mkpath(platformdir)); |