summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-03-31 10:12:43 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-03-31 10:12:43 (GMT)
commit93135ba7f52e0ccbbcd8bda390a69d089da62b83 (patch)
treeedbdf52864f6e430aabc876316c9f29fdc66c019 /tests
parent0c439d67f567ba2e7a1b9ada4e3953e5e598f168 (diff)
downloadQt-93135ba7f52e0ccbbcd8bda390a69d089da62b83.zip
Qt-93135ba7f52e0ccbbcd8bda390a69d089da62b83.tar.gz
Qt-93135ba7f52e0ccbbcd8bda390a69d089da62b83.tar.bz2
Revert 4.6 commits that shouldn't be in 4.7.
Commits reverted: 880e4935410769b8337d75f219bef70493c4bb2c 82a306e7dda06909801f576bbbbebb59dc41c563 6cb935dd89a391f792f8ad42012b5c7c38712f17 ebd1c45822aca087be994c898cfb01cd41599429 4e4c0055d59978850796ff8c1b5015e17459e8d2
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 2a1c55a..3313240 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -111,6 +111,8 @@ private slots:
void fontPropagationSceneChange();
void geometry_data();
void geometry();
+ void width();
+ void height();
void getContentsMargins_data();
void getContentsMargins();
void initStyleOption_data();
@@ -766,14 +768,42 @@ void tst_QGraphicsWidget::geometry()
{
SubQGraphicsWidget widget;
QCOMPARE(widget.geometry(), QRectF(widget.pos(), widget.size()));
-
+ QSignalSpy spy(&widget, SIGNAL(geometryChanged()));
QFETCH(QPointF, pos);
QFETCH(QSizeF, size);
widget.setPos(pos);
widget.resize(size);
+ if (!size.isNull())
+ QCOMPARE(spy.count(), 1);
QCOMPARE(widget.geometry(), QRectF(pos, size));
}
+void tst_QGraphicsWidget::width()
+{
+ QGraphicsWidget w;
+ QCOMPARE(w.property("width").toReal(), qreal(0));
+ QSignalSpy spy(&w, SIGNAL(widthChanged()));
+ w.setProperty("width", qreal(50));
+ QCOMPARE(w.property("width").toReal(), qreal(50));
+ QCOMPARE(spy.count(), 1);
+ //calling old school setGeometry should work too
+ w.setGeometry(0, 0, 200, 200);
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_QGraphicsWidget::height()
+{
+ QGraphicsWidget w;
+ QCOMPARE(w.property("height").toReal(), qreal(0));
+ QSignalSpy spy(&w, SIGNAL(heightChanged()));
+ w.setProperty("height", qreal(50));
+ QCOMPARE(w.property("height").toReal(), qreal(50));
+ QCOMPARE(spy.count(), 1);
+ //calling old school setGeometry should work too
+ w.setGeometry(0, 0, 200, 200);
+ QCOMPARE(spy.count(), 2);
+}
+
void tst_QGraphicsWidget::getContentsMargins_data()
{
QTest::addColumn<qreal>("left");
@@ -913,6 +943,7 @@ void tst_QGraphicsWidget::layout()
layout->addItem(item);
children.append(item);
}
+ QSignalSpy spy(&widget, SIGNAL(layoutChanged()));
widget.setLayout(layout);
QTRY_COMPARE(widget.layout(), static_cast<QGraphicsLayout*>(layout));
@@ -921,7 +952,7 @@ void tst_QGraphicsWidget::layout()
QCOMPARE(item->parentWidget(), (QGraphicsWidget *)&widget);
QVERIFY(item->geometry() != QRectF(0, 0, -1, -1));
}
-
+ QCOMPARE(spy.count(), 1);
// don't crash
widget.setLayout(0);
}