diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2010-07-29 07:46:48 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2010-07-29 07:46:48 (GMT) |
commit | 940b5b23268193d58d7e229bf97a22276098790b (patch) | |
tree | af532e70e2646012b6a856bab48a105389bc2098 /tests/auto/qlistview | |
parent | d1e1f49ea0b742fd655112fdb30f5751e142a766 (diff) | |
parent | 0041606aefae5da0ff6c8187540f3eff33cbb643 (diff) | |
download | Qt-940b5b23268193d58d7e229bf97a22276098790b.zip Qt-940b5b23268193d58d7e229bf97a22276098790b.tar.gz Qt-940b5b23268193d58d7e229bf97a22276098790b.tar.bz2 |
Merge remote branch 'origin/4.6' into 4.7-from-4.6
Conflicts:
src/3rdparty/webkit/VERSION
src/3rdparty/webkit/WebKit/qt/ChangeLog
src/gui/itemviews/qlistview.cpp
tests/auto/qlistview/tst_qlistview.cpp
tests/auto/qnetworkreply/test/test.pro
tests/auto/qsocks5socketengine/qsocks5socketengine.pro
Diffstat (limited to 'tests/auto/qlistview')
-rw-r--r-- | tests/auto/qlistview/tst_qlistview.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 5112ee0..425ac89 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -45,6 +45,7 @@ #include <qabstractitemmodel.h> #include <qapplication.h> #include <qlistview.h> +#include <qlistwidget.h> #include <qitemdelegate.h> #include <qstandarditemmodel.h> #include <qstringlistmodel.h> @@ -125,6 +126,8 @@ private slots: void taskQTBUG_5877_skippingItemInPageDownUp(); void taskQTBUG_9455_wrongScrollbarRanges(); void styleOptionViewItem(); + void taskQTBUG_12308_artihmeticException(); + void taskQTBUG_12308_wrongFlowLayout(); }; // Testing get/set functions @@ -2002,5 +2005,53 @@ void tst_QListView::styleOptionViewItem() QApplication::processEvents(); } +void tst_QListView::taskQTBUG_12308_artihmeticException() +{ + QListWidget lw; + lw.setLayoutMode(QListView::Batched); + lw.setViewMode(QListView::IconMode); + for (int i = 0; i < lw.batchSize() + 1; i++) { + QListWidgetItem *item = new QListWidgetItem(); + item->setText(QString("Item %L1").arg(i)); + lw.addItem(item); + item->setHidden(true); + } + lw.show(); + QTest::qWaitForWindowShown(&lw); + // No crash, it's all right. +} + +class Delegate12308 : public QStyledItemDelegate +{ + Q_OBJECT +public: + Delegate12308(QObject *parent = 0) : QStyledItemDelegate(parent) + { } + + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const + { + QVERIFY(option.rect.topLeft() != QPoint(-1, -1)); + QStyledItemDelegate::paint(painter, option, index); + } +}; + +void tst_QListView::taskQTBUG_12308_wrongFlowLayout() +{ + QListWidget lw; + Delegate12308 delegate; + lw.setLayoutMode(QListView::Batched); + lw.setViewMode(QListView::IconMode); + lw.setItemDelegate(&delegate); + for (int i = 0; i < lw.batchSize() + 1; i++) { + QListWidgetItem *item = new QListWidgetItem(); + item->setText(QString("Item %L1").arg(i)); + lw.addItem(item); + if (!item->text().contains(QString::fromAscii("1"))) + item->setHidden(true); + } + lw.show(); + QTest::qWaitForWindowShown(&lw); +} + QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" |