File indexing completed on 2024-05-19 04:32:39

0001 #ifndef SIMPLETEST_H
0002 #define SIMPLETEST_H
0003 
0004 #include <QtTest>
0005 #include <QTest>
0006 #include <QStandardPaths>
0007 #include <QLocale>
0008 // #include <KLocalizedString>
0009 #include <KoTestConfig.h>
0010 #include <KisSynchronizedConnection.h>
0011 
0012 #define SIMPLE_MAIN_IMPL(TestObject) \
0013     qputenv("LANGUAGE", "en"); \
0014     QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); \
0015     QStandardPaths::setTestModeEnabled(true); \
0016     KisSynchronizedConnectionBase::setAutoModeForUnittestsEnabled(true); \
0017     qputenv("EXTRA_RESOURCE_DIRS", QByteArray(KRITA_RESOURCE_DIRS_FOR_TESTS)); \
0018     qputenv("KRITA_PLUGIN_PATH", QByteArray(KRITA_PLUGINS_DIR_FOR_TESTS)); \
0019     QApplication app(argc, argv); \
0020     app.setAttribute(Qt::AA_Use96Dpi, true); \
0021     /*QLocale en_US(QLocale::English, QLocale::UnitedStates); \
0022     KLocalizedString::setLanguages(QStringList() << QStringLiteral("en_US"));*/ \
0023     QTEST_DISABLE_KEYPAD_NAVIGATION \
0024     TestObject tc; \
0025     QTEST_SET_MAIN_SOURCE_PATH \
0026     return QTest::qExec(&tc, argc, argv);
0027 
0028 #define SIMPLE_TEST_MAIN(TestObject) \
0029 int main(int argc, char *argv[]) \
0030 { \
0031     QStandardPaths::setTestModeEnabled(true); \
0032     SIMPLE_MAIN_IMPL(TestObject) \
0033 }
0034 
0035 #endif // SIMPLETEST_H