diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-29 20:25:35 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-29 20:25:35 (GMT) |
commit | 3acc686f9b2de7a261fc28e256b9f87ee5e341bc (patch) | |
tree | 83f1869e327afaf0031dcbe33298236227a9d700 /tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp | |
parent | b4afd4e4cabce0347e155803afd8ff1a7b90f080 (diff) | |
parent | f75d82c7c3364c5f4e5b3799cbeb9daae4cf6e61 (diff) | |
download | Qt-3acc686f9b2de7a261fc28e256b9f87ee5e341bc.zip Qt-3acc686f9b2de7a261fc28e256b9f87ee5e341bc.tar.gz Qt-3acc686f9b2de7a261fc28e256b9f87ee5e341bc.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (54 commits)
update qml.qch to version 4.7
Undefined is undefined, and now qml warns about it
Fix so window will resize with the root object (broken by
Avoid duplicate code for testing initial sizes
Remove an unnecessary connect() in TextInput
Ensure micro focus is updated in TextEdit and TextInput
Fix flow layout not taking into account whether it's width and height are implicit or not.
Avoid binding loop.
Ensure Loader item change listener is removed when Loader is destroyed
Adapt all qmlviewer testcases to the code changes in the actual viewer.
Stop QMLLauncher from crashing on exit on Mac when quitting app via the
VisualDataModel hasModelChildren role shadowed user roles.
Allow positioning of ListView items width sub-pixel precision.
Examples clean up
Docs
Improve appearance when scaling
Tweak Qt Demo Behaviour
forget to rename the moc include when renaming deviceorientation_maemo.cpp
fix namespace macros
fix QML Viewer resize modes
...
Diffstat (limited to 'tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index f7ba7a1..f1a367f 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -73,6 +73,8 @@ private slots: void width(); void wrap(); void textFormat(); + void alignments(); + void alignments_data(); // ### these tests may be trivial void hAlign(); @@ -297,6 +299,65 @@ void tst_qdeclarativetextedit::textFormat() } } +void tst_qdeclarativetextedit::alignments_data() +{ + QTest::addColumn<int>("hAlign"); + QTest::addColumn<int>("vAlign"); + QTest::addColumn<QString>("expectfile"); + + QTest::newRow("LT") << int(Qt::AlignLeft) << int(Qt::AlignTop) << SRCDIR "/data/alignments_lt.png"; + QTest::newRow("RT") << int(Qt::AlignRight) << int(Qt::AlignTop) << SRCDIR "/data/alignments_rt.png"; + QTest::newRow("CT") << int(Qt::AlignHCenter) << int(Qt::AlignTop) << SRCDIR "/data/alignments_ct.png"; + + QTest::newRow("LB") << int(Qt::AlignLeft) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_lb.png"; + QTest::newRow("RB") << int(Qt::AlignRight) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_rb.png"; + QTest::newRow("CB") << int(Qt::AlignHCenter) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_cb.png"; + + QTest::newRow("LC") << int(Qt::AlignLeft) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_lc.png"; + QTest::newRow("RC") << int(Qt::AlignRight) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_rc.png"; + QTest::newRow("CC") << int(Qt::AlignHCenter) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_cc.png"; +} + + +void tst_qdeclarativetextedit::alignments() +{ + QFETCH(int, hAlign); + QFETCH(int, vAlign); + QFETCH(QString, expectfile); + +#ifdef Q_WS_X11 + // Font-specific, but not likely platform-specific, so only test on one platform + QFont fn; + fn.setRawName("-misc-fixed-medium-r-*-*-8-*-*-*-*-*-*-*"); + QApplication::setFont(fn); +#endif + + QDeclarativeView *canvas = createView(SRCDIR "/data/alignments.qml"); + + canvas->show(); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas)); + + QObject *ob = canvas->rootObject(); + QVERIFY(ob != 0); + ob->setProperty("horizontalAlignment",hAlign); + ob->setProperty("verticalAlignment",vAlign); + QTRY_COMPARE(ob->property("running").toBool(),false); + QImage actual(canvas->width(), canvas->height(), QImage::Format_RGB32); + actual.fill(qRgb(255,255,255)); + QPainter p(&actual); + canvas->render(&p); + + QImage expect(expectfile); + +#ifdef Q_WS_X11 + // Font-specific, but not likely platform-specific, so only test on one platform + QCOMPARE(actual,expect); +#endif +} + + //the alignment tests may be trivial o.oa void tst_qdeclarativetextedit::hAlign() { |