File indexing completed on 2024-05-12 05:20:02
0001 /* 0002 This file is part of Kleopatra's test suite. 0003 SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include <KAboutData> 0011 #include <KLocalizedString> 0012 #include <QDir> 0013 #include <QTest> 0014 #ifndef KLEO_TEST_GNUPGHOME 0015 #error KLEO_TEST_GNUPGHOME not defined! 0016 #endif 0017 0018 // based on qtest_kde.h 0019 #define QTEST_KLEOMAIN(TestObject) \ 0020 int main(int argc, char *argv[]) \ 0021 { \ 0022 qputenv("GNUPGHOME", KLEO_TEST_GNUPGHOME); \ 0023 qputenv("LC_ALL", "C"); \ 0024 qputenv("KDEHOME", QFile::encodeName(QDir::homePath() + QLatin1StringView("/.kde-unit-test"))); \ 0025 KAboutData aboutData(QLatin1StringView("qttest"), i18n("qttest"), QLatin1String("version")); \ 0026 QApplication app(argc, argv); \ 0027 app.setApplicationName(QLatin1StringView("qttest")); \ 0028 TestObject tc; \ 0029 return QTest::qExec(&tc, argc, argv); \ 0030 }