summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtreeview
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@nokia.com>2010-07-27 07:43:10 (GMT)
committerHarald Fernengel <harald.fernengel@nokia.com>2010-11-02 14:28:59 (GMT)
commit2eb6556bac03bde101e2135be1114d6835341678 (patch)
treea339c1a476e0f49a55b37b16dea61dd7e2e72059 /tests/auto/qtreeview
parent7a763f19996bc892a63d021e64c570cbfb13f391 (diff)
downloadQt-2eb6556bac03bde101e2135be1114d6835341678.zip
Qt-2eb6556bac03bde101e2135be1114d6835341678.tar.gz
Qt-2eb6556bac03bde101e2135be1114d6835341678.tar.bz2
Fixed QTreeView autotest to use a dummy toplevel widget
Diffstat (limited to 'tests/auto/qtreeview')
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index c7b53e9..3c2bf15 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -2379,11 +2379,12 @@ void tst_QTreeView::extendedSelection()
QFETCH(int, selectedCount);
QStandardItemModel model(5, 2);
- QTreeView view;
+ QWidget topLevel;
+ QTreeView view(&topLevel);
view.resize(qMax(mousePressPos.x() * 2, 200), qMax(mousePressPos.y() * 2, 200));
view.setModel(&model);
view.setSelectionMode(QAbstractItemView::ExtendedSelection);
- view.show();
+ topLevel.show();
QTest::mousePress(view.viewport(), Qt::LeftButton, 0, mousePressPos);
QCOMPARE(view.selectionModel()->selectedIndexes().count(), selectedCount);
}
@@ -3280,9 +3281,10 @@ void tst_QTreeView::task220298_selectColumns()
void tst_QTreeView::task224091_appendColumns()
{
QStandardItemModel *model = new QStandardItemModel();
- QTreeView *treeView = new QTreeView();
+ QWidget* topLevel= new QWidget;
+ QTreeView *treeView = new QTreeView(topLevel);
treeView->setModel(model);
- treeView->show();
+ topLevel->show();
treeView->resize(50,50);
QTest::qWaitForWindowShown(treeView);
@@ -3299,7 +3301,7 @@ void tst_QTreeView::task224091_appendColumns()
QTRY_VERIFY(treeView->verticalScrollBar()->isVisible());
- delete treeView;
+ delete topLevel;
delete model;
}
@@ -3758,7 +3760,8 @@ void tst_QTreeView::taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint()
void tst_QTreeView::keyboardNavigationWithDisabled()
{
- QTreeView view;
+ QWidget topLevel;
+ QTreeView view(&topLevel);
QStandardItemModel model(90, 0);
for (int i = 0; i < 90; i ++) {
model.setItem(i, new QStandardItem(QString::number(i)));
@@ -3767,10 +3770,10 @@ void tst_QTreeView::keyboardNavigationWithDisabled()
view.setModel(&model);
view.resize(200, view.visualRect(model.index(0,0)).height()*10);
- view.show();
- QApplication::setActiveWindow(&view);
- QTest::qWaitForWindowShown(&view);
- QTRY_VERIFY(view.isActiveWindow());
+ topLevel.show();
+ QApplication::setActiveWindow(&topLevel);
+ QTest::qWaitForWindowShown(&topLevel);
+ QTRY_VERIFY(topLevel.isActiveWindow());
view.setCurrentIndex(model.index(1, 0));
QTest::keyClick(view.viewport(), Qt::Key_Up);