diff options
author | axis <qt-info@nokia.com> | 2009-04-24 14:03:55 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-04-27 07:09:01 (GMT) |
commit | e74c8dc65e2feffb9a55d00aee5ca634fba41df8 (patch) | |
tree | 3a131f9235fb6a455793178d8313655e4fd0036e /tests/auto/qabstractitemview/tst_qabstractitemview.cpp | |
parent | 8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76 (diff) | |
parent | 211bea9838bcc2acd7f54b65468fe1be2d81b1e0 (diff) | |
download | Qt-e74c8dc65e2feffb9a55d00aee5ca634fba41df8.zip Qt-e74c8dc65e2feffb9a55d00aee5ca634fba41df8.tar.gz Qt-e74c8dc65e2feffb9a55d00aee5ca634fba41df8.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Configure.exe recompiled with MSVC6.
Conflicts:
configure.exe
examples/network/network.pro
src/gui/dialogs/qfiledialog_p.h
src/gui/dialogs/qfilesystemmodel_p.h
src/gui/kernel/qapplication.cpp
tests/auto/_Categories/qmake.txt
tests/auto/qfile/test/test.pro
tests/auto/qfile/tst_qfile.cpp
tests/auto/qlibrary/tst_qlibrary.cpp
tests/auto/qline/tst_qline.cpp
tests/auto/qstyle/tst_qstyle.cpp
tests/auto/qtextstream/tst_qtextstream.cpp
tests/auto/qtranslator/qtranslator.pro
tests/auto/qwaitcondition/tst_qwaitcondition.cpp
translations/qt_ja_JP.ts
Diffstat (limited to 'tests/auto/qabstractitemview/tst_qabstractitemview.cpp')
-rw-r--r-- | tests/auto/qabstractitemview/tst_qabstractitemview.cpp | 68 |
1 files changed, 42 insertions, 26 deletions
diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp index 2d55ca1..69b310c 100644 --- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp @@ -53,6 +53,8 @@ #include <qspinbox.h> #include <qitemdelegate.h> #include <qpushbutton.h> +#include <qscrollbar.h> +#include <qboxlayout.h> #include "../../shared/util.h" //TESTED_CLASS= @@ -211,6 +213,7 @@ private slots: void setCurrentIndex(); void task221955_selectedEditor(); + void task250754_fontChange(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -233,11 +236,8 @@ void tst_QAbstractItemView::getSetCheck() MyAbstractItemDelegate *var1 = new MyAbstractItemDelegate; obj1->setItemDelegate(var1); QCOMPARE((QAbstractItemDelegate*)var1, obj1->itemDelegate()); -#if QT_VERSION >= 0x040200 - // Itemviews in Qt < 4.2 have asserts for this. Qt >= 4.2 should handle this gracefully obj1->setItemDelegate((QAbstractItemDelegate *)0); QCOMPARE((QAbstractItemDelegate *)0, obj1->itemDelegate()); -#endif delete var1; // EditTriggers QAbstractItemView::editTriggers() @@ -279,26 +279,6 @@ void tst_QAbstractItemView::getSetCheck() obj1->setAlternatingRowColors(true); QCOMPARE(true, obj1->alternatingRowColors()); -#if QT_VERSION < 0x040200 - // int QAbstractItemView::horizontalStepsPerItem() - // void QAbstractItemView::setHorizontalStepsPerItem(int) - obj1->tst_setHorizontalStepsPerItem(0); - QCOMPARE(0, obj1->tst_horizontalStepsPerItem()); - obj1->tst_setHorizontalStepsPerItem(INT_MIN); - QCOMPARE(INT_MIN, obj1->tst_horizontalStepsPerItem()); - obj1->tst_setHorizontalStepsPerItem(INT_MAX); - QCOMPARE(INT_MAX, obj1->tst_horizontalStepsPerItem()); - - // int QAbstractItemView::verticalStepsPerItem() - // void QAbstractItemView::setVerticalStepsPerItem(int) - obj1->tst_setVerticalStepsPerItem(0); - QCOMPARE(0, obj1->tst_verticalStepsPerItem()); - obj1->tst_setVerticalStepsPerItem(INT_MIN); - QCOMPARE(INT_MIN, obj1->tst_verticalStepsPerItem()); - obj1->tst_setVerticalStepsPerItem(INT_MAX); - QCOMPARE(INT_MAX, obj1->tst_verticalStepsPerItem()); -#endif - // State QAbstractItemView::state() // void QAbstractItemView::setState(State) obj1->tst_setState(TestView::tst_State(TestView::NoState)); @@ -314,13 +294,11 @@ void tst_QAbstractItemView::getSetCheck() obj1->tst_setState(TestView::tst_State(TestView::CollapsingState)); QCOMPARE(TestView::tst_State(TestView::CollapsingState), obj1->tst_state()); -#if QT_VERSION >= 0x040200 // QWidget QAbstractScrollArea::viewport() // void setViewport(QWidget*) QWidget *vp = new QWidget; obj1->setViewport(vp); QCOMPARE(vp, obj1->viewport()); -#endif QCOMPARE(16, obj1->autoScrollMargin()); obj1->setAutoScrollMargin(20); @@ -1186,8 +1164,46 @@ void tst_QAbstractItemView::task221955_selectedEditor() button->setFocus(); QTest::qWait(50); QVERIFY(tree.selectionModel()->selectedIndexes().isEmpty()); +} + +void tst_QAbstractItemView::task250754_fontChange() +{ + QString app_css = qApp->styleSheet(); + qApp->setStyleSheet("/* */"); + + QWidget w; + QTreeView tree(&w); + QVBoxLayout *vLayout = new QVBoxLayout(&w); + vLayout->addWidget(&tree); + + QStandardItemModel *m = new QStandardItemModel(this); + for (int i=0; i<5; ++i) { + QStandardItem *item = new QStandardItem(QString("Item number %1").arg(i)); + for (int j=0; j<5; ++j) { + QStandardItem *child = new QStandardItem(QString("Child Item number %1").arg(j)); + item->setChild(j, 0, child); + } + m->setItem(i, 0, item); + } + tree.setModel(m); + + w.show(); + w.resize(150,150); + QTest::qWait(30); + QFont font = tree.font(); + font.setPointSize(5); + tree.setFont(font); + QTest::qWait(30); + + QVERIFY(!tree.verticalScrollBar()->isVisible()); + + font.setPointSize(45); + tree.setFont(font); + QTest::qWait(30); + //now with the huge items, the scrollbar must be visible + QVERIFY(tree.verticalScrollBar()->isVisible()); - + qApp->setStyleSheet(app_css); } QTEST_MAIN(tst_QAbstractItemView) |