File indexing completed on 2024-10-06 10:14:13

0001 /*
0002  *  SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #include <QtQuickTest>
0008 #include <QQmlEngine>
0009 #include <QQmlContext>
0010 
0011 #include <KLocalizedContext>
0012 #include <KLocalizedString>
0013 
0014 #include "example_albummodel.h"
0015 
0016 class KirigamiAddonsSetup : public QObject
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     KirigamiAddonsSetup()
0022     {
0023     }
0024 
0025 public Q_SLOTS:
0026     void qmlEngineAvailable(QQmlEngine *engine)
0027     {
0028         KLocalizedString::setApplicationDomain("kirigami-addons");
0029         engine->rootContext()->setContextObject(new KLocalizedContext(engine));
0030 
0031         qmlRegisterType<ExampleAlbumModel>("test.artefacts", 1, 0, "ExampleAlbumModel");
0032 
0033         engine->rootContext()->setContextProperty(QLatin1String("dataDir"), QVariant(QLatin1String(DATA_DIR)));
0034     }
0035 };
0036 
0037 QUICK_TEST_MAIN_WITH_SETUP(KirigamiAddons, KirigamiAddonsSetup)
0038 
0039 #include "qmltests.moc"