summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp27
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp10
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index e9d6f1d..f7ea4ce 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -236,6 +236,7 @@ private slots:
void contextMenuEvent();
void contextMenuEvent_ItemIgnoresTransformations();
void update();
+ void update2();
void views();
void event();
void eventsToDisabledItems();
@@ -2779,6 +2780,32 @@ void tst_QGraphicsScene::update()
QCOMPARE(region, QRectF(-100, -100, 200, 200));
}
+void tst_QGraphicsScene::update2()
+{
+ QGraphicsScene scene;
+ scene.setSceneRect(-200, -200, 200, 200);
+ CustomView view;
+ view.setScene(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(250);
+ view.repaints = 0;
+
+ // Make sure QGraphicsScene::update only requires one event-loop iteration
+ // before the view is updated.
+ scene.update();
+ qApp->processEvents();
+ QCOMPARE(view.repaints, 1);
+ view.repaints = 0;
+
+ // The same for partial scene updates.
+ scene.update(QRectF(-100, -100, 100, 100));
+ qApp->processEvents();
+ QCOMPARE(view.repaints, 1);
+}
+
void tst_QGraphicsScene::views()
{
QGraphicsScene scene;
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index cb1cb9b..f2bfb1f 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -1003,6 +1003,7 @@ void tst_QNetworkReply::stateChecking()
QCOMPARE(reply->request(), req);
QCOMPARE(int(reply->operation()), int(QNetworkAccessManager::GetOperation));
QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QCOMPARE(reply->isFinished(), false);
QCOMPARE(reply->url(), url);
reply->abort();
@@ -1324,6 +1325,9 @@ void tst_QNetworkReply::getErrors()
QTEST(reply->readAll().isEmpty(), "dataIsEmpty");
+ QVERIFY(reply->isFinished());
+ QVERIFY(!reply->isRunning());
+
QFETCH(int, httpStatusCode);
if (httpStatusCode != 0) {
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), httpStatusCode);
@@ -3237,6 +3241,8 @@ void tst_QNetworkReply::downloadProgress()
connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
&QTestEventLoop::instance(), SLOT(exitLoop()));
QVERIFY(spy.isValid());
+ QVERIFY(!reply->isFinished());
+ QVERIFY(reply->isRunning());
QCoreApplication::instance()->processEvents();
if (!server.hasPendingConnections())
@@ -3257,6 +3263,8 @@ void tst_QNetworkReply::downloadProgress()
QTestEventLoop::instance().enterLoop(2);
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(spy.count() > 0);
+ QVERIFY(!reply->isFinished());
+ QVERIFY(reply->isRunning());
QList<QVariant> args = spy.last();
QCOMPARE(args.at(0).toInt(), i*data.size());
@@ -3270,6 +3278,8 @@ void tst_QNetworkReply::downloadProgress()
QTestEventLoop::instance().enterLoop(2);
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(spy.count() > 0);
+ QVERIFY(!reply->isRunning());
+ QVERIFY(reply->isFinished());
QList<QVariant> args = spy.last();
QCOMPARE(args.at(0).toInt(), loopCount * data.size());