summaryrefslogtreecommitdiffstats
path: root/tests/auto/qwidget/tst_qwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qwidget/tst_qwidget.cpp')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 09af941..5521873 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -4389,7 +4389,6 @@ class WinIdChangeWidget : public QWidget {
public:
WinIdChangeWidget(QWidget *p = 0)
: QWidget(p)
- , m_winIdChangeEventCount(0)
{
}
@@ -4397,13 +4396,14 @@ protected:
bool event(QEvent *e)
{
if (e->type() == QEvent::WinIdChange) {
- ++m_winIdChangeEventCount;
+ m_winIdList.append(internalWinId());
return true;
}
return QWidget::event(e);
}
public:
- int m_winIdChangeEventCount;
+ QList<WId> m_winIdList;
+ int winIdChangeEventCount() const { return m_winIdList.count(); }
};
void tst_QWidget::winIdChangeEvent()
@@ -4414,7 +4414,7 @@ void tst_QWidget::winIdChangeEvent()
const WId winIdBefore = widget.internalWinId();
const WId winIdAfter = widget.winId();
QVERIFY(winIdBefore != winIdAfter);
- QCOMPARE(widget.m_winIdChangeEventCount, 1);
+ QCOMPARE(widget.winIdChangeEventCount(), 1);
}
{
@@ -4423,11 +4423,13 @@ void tst_QWidget::winIdChangeEvent()
QWidget parent1, parent2;
WinIdChangeWidget child(&parent1);
const WId winIdBefore = child.winId();
- QCOMPARE(child.m_winIdChangeEventCount, 1);
+ QCOMPARE(child.winIdChangeEventCount(), 1);
child.setParent(&parent2);
const WId winIdAfter = child.internalWinId();
QVERIFY(winIdBefore != winIdAfter);
- QCOMPARE(child.m_winIdChangeEventCount, 2);
+ QCOMPARE(child.winIdChangeEventCount(), 3);
+ // winId is set to zero during reparenting
+ QVERIFY(0 == child.m_winIdList[1]);
}
{
@@ -4437,15 +4439,16 @@ void tst_QWidget::winIdChangeEvent()
QWidget parent(&grandparent1);
WinIdChangeWidget child(&parent);
const WId winIdBefore = child.winId();
- QCOMPARE(child.m_winIdChangeEventCount, 1);
+ QCOMPARE(child.winIdChangeEventCount(), 1);
parent.setParent(&grandparent2);
const WId winIdAfter = child.internalWinId();
#ifdef Q_OS_SYMBIAN
QVERIFY(winIdBefore != winIdAfter);
- QCOMPARE(child.m_winIdChangeEventCount, 2);
+ QVERIFY(winIdAfter != 0);
+ QCOMPARE(child.winIdChangeEventCount(), 2);
#else
QCOMPARE(winIdBefore, winIdAfter);
- QCOMPARE(child.m_winIdChangeEventCount, 1);
+ QCOMPARE(child.winIdChangeEventCount(), 1);
#endif
}
@@ -4457,7 +4460,7 @@ void tst_QWidget::winIdChangeEvent()
child.setParent(&parent2);
const WId winIdAfter = child.internalWinId();
QCOMPARE(winIdBefore, winIdAfter);
- QCOMPARE(child.m_winIdChangeEventCount, 0);
+ QCOMPARE(child.winIdChangeEventCount(), 0);
}
{
@@ -4466,12 +4469,14 @@ void tst_QWidget::winIdChangeEvent()
WinIdChangeWidget child(&parent);
child.winId();
const WId winIdBefore = child.internalWinId();
- QCOMPARE(child.m_winIdChangeEventCount, 1);
+ QCOMPARE(child.winIdChangeEventCount(), 1);
const Qt::WindowFlags flags = child.windowFlags();
child.setWindowFlags(flags | Qt::Window);
const WId winIdAfter = child.internalWinId();
QVERIFY(winIdBefore != winIdAfter);
- QCOMPARE(child.m_winIdChangeEventCount, 2);
+ QCOMPARE(child.winIdChangeEventCount(), 3);
+ // winId is set to zero during reparenting
+ QVERIFY(0 == child.m_winIdList[1]);
}
}