Move qRegisterMetaType back to SetUpTestCase(). Add comment

regarding ownership of the optional argument to MusicBrainzClient().
This commit is contained in:
Mattias Andersson 2014-06-02 16:34:03 +02:00
parent 9a06e7822c
commit ac162c3477
2 changed files with 6 additions and 3 deletions

View File

@ -39,7 +39,8 @@ class MusicBrainzClient : public QObject {
public:
// The second argument allows for specifying a custom network access
// manager. It is used in tests.
// manager. It is used in tests. The ownership of network
// is not transferred.
MusicBrainzClient(QObject* parent = nullptr,
QNetworkAccessManager* network = nullptr);

View File

@ -38,11 +38,13 @@ Q_DECLARE_METATYPE(ResultList);
class MusicBrainzClientTest : public ::testing::Test {
protected:
void SetUp() {
mock_network_.reset(new MockNetworkAccessManager);
static void SetUpTestCase() {
qRegisterMetaType<ResultList>("MusicBrainzClient::ResultList");
}
void SetUp() {
mock_network_.reset(new MockNetworkAccessManager);
}
// Reads the data from a file into a QByteArray and returns it.
QByteArray ReadDataFromFile(const QString& filename) {