2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Henri Lampela - henri.lampela@ixonos.com
6 Jussi Laitinen - jussi.laitinen@ixonos.com
8 Situare is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 Situare is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Situare; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23 #include <QNetworkRequest>
25 #include "networkreplymock.h"
27 NetworkReplyMock::NetworkReplyMock(QObject *parent)
28 : QNetworkReply(parent)
33 void NetworkReplyMock::setError(NetworkError errorCode, const QString &errorString)
35 qDebug() << __PRETTY_FUNCTION__;
36 QNetworkReply::setError(errorCode, errorString);
40 qint64 NetworkReplyMock::readData(char *data, qint64 maxLen)
42 qDebug() << __PRETTY_FUNCTION__;
43 if (m_offset < m_content.size()) {
44 qint64 number = qMin(maxLen, m_content.size() - m_offset);
45 memcpy(data, m_content.constData() + m_offset, number);
54 QByteArray NetworkReplyMock::readAll()
59 qint64 NetworkReplyMock::bytesAvailable() const
61 qDebug() << __PRETTY_FUNCTION__;
62 return m_content.size() - m_offset;
65 void NetworkReplyMock::setUrl(const QUrl &url)
67 qDebug() << __PRETTY_FUNCTION__;
68 QNetworkReply::setUrl(url);
71 void NetworkReplyMock::abort()
73 qDebug() << __PRETTY_FUNCTION__;
76 void NetworkReplyMock::test()
78 qDebug() << __PRETTY_FUNCTION__;
81 void NetworkReplyMock::setData(const QByteArray &content)
83 qDebug() << __PRETTY_FUNCTION__;
84 // setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/png"));
85 // setHeader(QNetworkRequest::ContentLengthHeader, QVariant(this->m_content.size()));
86 m_content.append(content);
87 qDebug() << "Content size: " << m_content.size();