diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2010-08-12 12:31:24 (GMT) |
---|---|---|
committer | Jesper Thomschutz <jesper.thomschutz@nokia.com> | 2010-08-13 09:01:00 (GMT) |
commit | c12f452dc06a9a0dfb244dc5124cfca0b3973b0d (patch) | |
tree | 117247515a061a1ecf689c9993aed23ed5329b2d /tests | |
parent | b004dad34039300abfc1058439f6c57063ea8080 (diff) | |
download | Qt-c12f452dc06a9a0dfb244dc5124cfca0b3973b0d.zip Qt-c12f452dc06a9a0dfb244dc5124cfca0b3973b0d.tar.gz Qt-c12f452dc06a9a0dfb244dc5124cfca0b3973b0d.tar.bz2 |
Properly emit geometryChanged() when the position change.
Also emit the signal at the very end, so people can rely on the resize
event to adjust some stuff in their item.
Reviewed-by:yoann
(cherry picked from commit 3ee89bc0830f69d44f272eff5a0c886bff33c92e)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index a771332..bda22eb 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -111,6 +111,7 @@ private slots: void fontPropagationSceneChange(); void geometry_data(); void geometry(); + void geometryChanged(); void width(); void height(); void getContentsMargins_data(); @@ -776,11 +777,28 @@ void tst_QGraphicsWidget::geometry() QFETCH(QSizeF, size); widget.setPos(pos); widget.resize(size); - if (!size.isNull()) + if (!size.isNull() && !pos.isNull()) + QCOMPARE(spy.count(), 2); + if (!size.isNull() && pos.isNull()) QCOMPARE(spy.count(), 1); QCOMPARE(widget.geometry(), QRectF(pos, size)); } +void tst_QGraphicsWidget::geometryChanged() +{ + QGraphicsWidget w; + w.setGeometry(0, 0, 200, 200); + QCOMPARE(w.geometry(), QRectF(0, 0, 200, 200)); + QSignalSpy spy(&w, SIGNAL(geometryChanged())); + w.setGeometry(0, 0, 100, 100); + QCOMPARE(spy.count(), 1); + QCOMPARE(w.geometry(), QRectF(0, 0, 100, 100)); + w.setPos(10, 10); + QCOMPARE(spy.count(), 2); + QCOMPARE(w.geometry(), QRectF(10, 10, 100, 100)); + +} + void tst_QGraphicsWidget::width() { QGraphicsWidget w; |