summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-11-24 08:36:15 (GMT)
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-11-24 10:16:31 (GMT)
commitd13d0246352a5d6c26d28d2b8ff8313eb30f6299 (patch)
tree6a677d47c6274eb401510a6dede5593b9bb520c0 /tests
parenta051076bb1a60577fe7e6ef23166f50e4bbd0bc4 (diff)
downloadQt-d13d0246352a5d6c26d28d2b8ff8313eb30f6299.zip
Qt-d13d0246352a5d6c26d28d2b8ff8313eb30f6299.tar.gz
Qt-d13d0246352a5d6c26d28d2b8ff8313eb30f6299.tar.bz2
Fixed tst_qwidget::winIdChangeEvent
During reparenting of a native widget, the winId is now first set to zero before being set to the new value. Reviewed-by: Jason Barron
Diffstat (limited to 'tests')
-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]);
}
}