File: testutilsloader.cpp

package info (click to toggle)
owncloud-client 6.0.3.18040%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 15,260 kB
  • sloc: cpp: 56,365; python: 5,573; sh: 189; makefile: 38
file content (28 lines) | stat: -rw-r--r-- 887 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "configfile.h"
#include "gui/networkinformation.h"
#include "logger.h"
#include "resources/loadresources.h"
#include "testutils.h"

#include <QCoreApplication>

namespace {
void setUpTests()
{
    // load the resources
    static const OCC::ResourcesLoader resources;

    static auto dir = OCC::TestUtils::createTempDir();
    OCC::ConfigFile::setConfDir(QStringLiteral("%1/config").arg(dir.path())); // we don't want to pollute the user's config file

    OCC::Logger::instance()->setLogFile(QStringLiteral("-"));
    OCC::Logger::instance()->addLogRule({ QStringLiteral("sync.httplogger=true") });
    OCC::Logger::instance()->setLogDebug(true);

    OCC::Account::setCommonCacheDirectory(QStringLiteral("%1/cache").arg(dir.path()));

    // ensure we have an instance of NetworkInformation
    OCC::NetworkInformation::instance();
}
Q_COREAPP_STARTUP_FUNCTION(setUpTests)
}