1 /* 2 * Copyright (c) 2018 Boudewijn Rempt <boud@valdyas.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef KISTEST 20 #define KISTEST 21 22 #include <KoConfig.h> 23 #include <QApplication> 24 #include <QTest> 25 #include <QLoggingCategory> 26 #include <QtTest/qtestsystem.h> 27 #include <set> 28 29 #if defined(QT_NETWORK_LIB) 30 # include <QtTest/qtest_network.h> 31 #endif 32 #include <QtTest/qtest_widgets.h> 33 34 #ifdef QT_KEYPAD_NAVIGATION 35 # define QTEST_DISABLE_KEYPAD_NAVIGATION QApplication::setNavigationMode(Qt::NavigationModeNone); 36 #else 37 # define QTEST_DISABLE_KEYPAD_NAVIGATION 38 #endif 39 40 #define KISTEST_MAIN(TestObject) \ 41 int main(int argc, char *argv[]) \ 42 { \ 43 qputenv("QT_LOGGING_RULES", ""); \ 44 QLoggingCategory::setFilterRules(QStringLiteral("krita.*.debug=false"));\ 45 qputenv("EXTRA_RESOURCE_DIRS", QByteArray(KRITA_EXTRA_RESOURCE_DIRS)); \ 46 QApplication app(argc, argv); \ 47 app.setAttribute(Qt::AA_Use96Dpi, true); \ 48 QTEST_DISABLE_KEYPAD_NAVIGATION \ 49 TestObject tc; \ 50 QTEST_SET_MAIN_SOURCE_PATH \ 51 return QTest::qExec(&tc, argc, argv); \ 52 } 53 54 55 56 57 58 #endif 59