summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2015-12-20 11:10:18 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2015-12-20 11:10:18 +0100
commit7d7359ae6388dfd5b629422eb6bd40e2b55abfa5 (patch)
treee7fb7fd9f47fdd3345cbe09e070f4df42efddc15 /rbutil/rbutilqt
parent70baf0f7be98d5a2dfa429c95deb41440a23bea1 (diff)
Fix and extend HttpGet unit test again.
Fix wrong initialization (why did that compile?) and add check for progress signal. Change-Id: I83a193252afcf66acaa333750b0ac2ef83e38478
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r--rbutil/rbutilqt/test/test-httpget.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/rbutil/rbutilqt/test/test-httpget.cpp b/rbutil/rbutilqt/test/test-httpget.cpp
index c6f5abf9fc..0388081452 100644
--- a/rbutil/rbutilqt/test/test-httpget.cpp
+++ b/rbutil/rbutilqt/test/test-httpget.cpp
@@ -169,8 +169,9 @@ class TestHttpGet : public QObject
bool m_waitTimeoutOccured;
QString m_now;
QDir m_cachedir;
- HttpGet *m_getter = NULL;
- QSignalSpy *m_doneSpy = NULL;
+ HttpGet *m_getter;
+ QSignalSpy *m_doneSpy;
+ QSignalSpy *m_progressSpy;
};
@@ -183,6 +184,7 @@ void TestHttpGet::init(void)
m_cachedir = temporaryFolder();
m_getter = new HttpGet(this);
m_doneSpy = new QSignalSpy(m_getter, SIGNAL(done(bool)));
+ m_progressSpy = new QSignalSpy(m_getter, SIGNAL(dataReadProgress(int, int)));
m_waitTimeoutOccured = false;
}
@@ -194,6 +196,7 @@ void TestHttpGet::cleanup(void)
}
if(m_daemon) { delete m_daemon; m_daemon = NULL; }
if(m_doneSpy) { delete m_doneSpy; m_doneSpy = NULL; }
+ if(m_progressSpy) { delete m_progressSpy; m_progressSpy = NULL; }
}
void TestHttpGet::testFileUrlRequest(void)
@@ -214,6 +217,7 @@ void TestHttpGet::testFileUrlRequest(void)
QCOMPARE(m_daemon->lastRequestData().size(), 0);
QCOMPARE(m_getter->readAll(), teststring.toLatin1());
QCOMPARE(m_getter->httpResponse(), 200);
+ QCOMPARE(m_progressSpy->at(0).at(0).toInt(), 0);
}
@@ -423,6 +427,8 @@ void TestHttpGet::testContentToBuffer(void)
QCOMPARE(m_getter->readAll(), QByteArray(TEST_BINARY_BLOB));
// sizeof(TEST_BINARY_BLOB) will include an additional terminating NULL.
QCOMPARE((unsigned long)m_getter->readAll().size(), sizeof(TEST_BINARY_BLOB) - 1);
+ QCOMPARE(m_progressSpy->at(m_progressSpy->count() - 1).at(0).toInt(), (int)sizeof(TEST_BINARY_BLOB) - 1);
+ QCOMPARE(m_progressSpy->at(m_progressSpy->count() - 1).at(1).toInt(), (int)sizeof(TEST_BINARY_BLOB) - 1);
}
void TestHttpGet::testContentToFile(void)