2
* Copyright (C) 2015 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: James Henstridge <james.henstridge@canonical.com>
24
#include <QGuiApplication>
26
#include <QtQuickTest/quicktest.h>
27
#include <QTemporaryDir>
29
#include <testsetup.h>
30
#include "utils/artserver.h"
31
#include "utils/dbusserver.h"
38
cachedir_.reset(new QTemporaryDir(TESTBINDIR "/qml-test.XXXXXX"));
39
setenv("XDG_CACHE_HOME", cachedir_->path().toUtf8().constData(), true);
41
dbus_server_.reset(new DBusServer());
51
std::unique_ptr<QTemporaryDir> cachedir_;
52
std::unique_ptr<DBusServer> dbus_server_;
53
ArtServer fake_art_server_;
56
// Expose static test configuration to QML
57
QJSValue make_test_config(QQmlEngine*, QJSEngine* scriptEngine)
59
QJSValue config = scriptEngine->newObject();
60
config.setProperty("sourceDir", TESTSRCDIR);
61
config.setProperty("buildDir", TESTBINDIR);
62
config.setProperty("mediaDir", TESTDATADIR);
66
int main(int argc, char** argv)
68
QGuiApplication app(argc, argv);
70
setenv("GSETTINGS_BACKEND", "memory", true);
71
setenv("GSETTINGS_SCHEMA_DIR", GSETTINGS_SCHEMA_DIR, true);
72
setenv("TN_UTILDIR", TESTBINDIR "/../src/vs-thumb", true);
73
qmlRegisterSingletonType("testconfig", 1, 0, "Config", make_test_config);
74
qmlProtectModule("testconfig", 1);
77
return quick_test_main(argc, argv, "Thumbnailer", TESTSRCDIR "/qml");