summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/qheaderview/tst_qheaderview.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp
index da0a0bb..5252ec6 100644
--- a/tests/auto/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/qheaderview/tst_qheaderview.cpp
@@ -196,6 +196,7 @@ private slots:
void QTBUG12268_hiddenMovedSectionSorting();
protected:
+ QWidget *topLevel;
QHeaderView *view;
QStandardItemModel *model;
};
@@ -345,7 +346,8 @@ void tst_QHeaderView::cleanupTestCase()
void tst_QHeaderView::init()
{
- view = new QHeaderView(Qt::Vertical);
+ topLevel = new QWidget();
+ view = new QHeaderView(Qt::Vertical,topLevel);
// Some initial value tests before a model is added
QCOMPARE(view->length(), 0);
QVERIFY(view->sizeHint() == QSize(0,0));
@@ -373,7 +375,8 @@ void tst_QHeaderView::init()
QSignalSpy spy(view, SIGNAL(sectionCountChanged(int, int)));
view->setModel(model);
QCOMPARE(spy.count(), 1);
- view->show();
+ view->resize(200,200);
+ topLevel->show();
}
void tst_QHeaderView::cleanup()
@@ -508,7 +511,7 @@ void tst_QHeaderView::stretch()
view->resize(viewSize);
view->setStretchLastSection(true);
QCOMPARE(view->stretchLastSection(), true);
- view->show();
+ topLevel->show();
QCOMPARE(view->width(), viewSize.width());
QCOMPARE(view->visualIndexAt(view->viewport()->height() - 5), 3);
@@ -674,7 +677,7 @@ void tst_QHeaderView::visualIndexAt()
QFETCH(QList<int>, visual);
view->setStretchLastSection(true);
- view->show();
+ topLevel->show();
for (int i = 0; i < hidden.count(); ++i)
view->setSectionHidden(hidden.at(i), true);
@@ -682,6 +685,8 @@ void tst_QHeaderView::visualIndexAt()
for (int j = 0; j < from.count(); ++j)
view->moveSection(from.at(j), to.at(j));
+ QTest::qWait(100);
+
for (int k = 0; k < coordinate.count(); ++k)
QCOMPARE(view->visualIndexAt(coordinate.at(k)), visual.at(k));
}
@@ -696,7 +701,7 @@ void tst_QHeaderView::length()
view->setFont(font);
#endif
view->setStretchLastSection(true);
- view->show();
+ topLevel->show();
//minimumSectionSize should be the size of the last section of the widget is not tall enough
int length = view->minimumSectionSize();
@@ -708,7 +713,7 @@ void tst_QHeaderView::length()
QCOMPARE(length, view->length());
view->setStretchLastSection(false);
- view->show();
+ topLevel->show();
QVERIFY(length != view->length());
@@ -759,7 +764,7 @@ void tst_QHeaderView::logicalIndexAt()
QCOMPARE(view->logicalIndexAt(0), 0);
QCOMPARE(view->logicalIndexAt(1), 0);
- view->show();
+ topLevel->show();
view->setStretchLastSection(true);
// First item
QCOMPARE(view->logicalIndexAt(0), 0);
@@ -1062,7 +1067,7 @@ void tst_QHeaderView::resizeWithResizeModes()
view->resizeSection(i, sections.at(i));
view->setResizeMode(i, (QHeaderView::ResizeMode)modes.at(i));
}
- view->show();
+ topLevel->show();
view->resize(size, size);
for (int j = 0; j < expected.count(); ++j)
QCOMPARE(view->sectionSize(j), expected.at(j));
@@ -1160,7 +1165,7 @@ void tst_QHeaderView::resizeSection()
view->resize(400, 400);
- view->show();
+ topLevel->show();
view->setMovable(true);
view->setStretchLastSection(false);
@@ -2035,14 +2040,14 @@ void tst_QHeaderView::QTBUG7833_sectionClicked()
QTest::mouseClick(tv.horizontalHeader()->viewport(), Qt::LeftButton, Qt::NoModifier,
- QPoint(tv.horizontalHeader()->sectionViewportPosition(11) + 5, 5));
+ QPoint(tv.horizontalHeader()->sectionViewportPosition(11) + tv.horizontalHeader()->sectionSize(11)/2, 5));
QCOMPARE(clickedSpy.count(), 1);
QCOMPARE(pressedSpy.count(), 1);
QCOMPARE(clickedSpy.at(0).at(0).toInt(), 11);
QCOMPARE(pressedSpy.at(0).at(0).toInt(), 11);
QTest::mouseClick(tv.horizontalHeader()->viewport(), Qt::LeftButton, Qt::NoModifier,
- QPoint(tv.horizontalHeader()->sectionViewportPosition(8) + 5, 5));
+ QPoint(tv.horizontalHeader()->sectionViewportPosition(8) + tv.horizontalHeader()->sectionSize(0)/2, 5));
QCOMPARE(clickedSpy.count(), 2);
QCOMPARE(pressedSpy.count(), 2);
@@ -2050,7 +2055,7 @@ void tst_QHeaderView::QTBUG7833_sectionClicked()
QCOMPARE(pressedSpy.at(1).at(0).toInt(), 8);
QTest::mouseClick(tv.horizontalHeader()->viewport(), Qt::LeftButton, Qt::NoModifier,
- QPoint(tv.horizontalHeader()->sectionViewportPosition(0) + 5, 5));
+ QPoint(tv.horizontalHeader()->sectionViewportPosition(0) + tv.horizontalHeader()->sectionSize(0)/2, 5));
QCOMPARE(clickedSpy.count(), 3);
QCOMPARE(pressedSpy.count(), 3);