File indexing completed on 2024-04-14 05:39:13

0001 /*
0002     SPDX-FileCopyrightText: 2007 Nicolas Ternisien <nicolas.ternisien@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include <QTest>
0008 
0009 #include "testUtil.h"
0010 
0011 #include "analyzer.h"
0012 #include "globals.h"
0013 
0014 #include "logFile.h"
0015 #include "logLevel.h"
0016 #include "logMode.h"
0017 #include "logViewModel.h"
0018 #include "logViewWidget.h"
0019 
0020 #include "ksystemlog_debug.h"
0021 
0022 class LogModeFactoryTest : public QObject
0023 {
0024     Q_OBJECT
0025 
0026 private Q_SLOTS:
0027 
0028     void initTestCase();
0029 
0030     void testLogModes();
0031 
0032     void testReaderFactory();
0033 
0034 private:
0035     TestUtil testUtil;
0036 };
0037 
0038 void LogModeFactoryTest::initTestCase()
0039 {
0040     testUtil.registerLogModeFactories();
0041 }
0042 
0043 void LogModeFactoryTest::testLogModes()
0044 {
0045     LogMode *systemLogMode = Globals::instance().findLogMode(QStringLiteral("systemLogMode"));
0046     QVERIFY(systemLogMode);
0047 
0048     QCOMPARE(systemLogMode->id(), QString::fromLatin1("systemLogMode"));
0049 }
0050 
0051 void LogModeFactoryTest::testReaderFactory()
0052 {
0053     LogViewModel *model = nullptr;
0054     Analyzer *systemAnalyzer = testUtil.createAnalyzer(QStringLiteral("systemLogMode"), &model);
0055 
0056     QVERIFY(systemAnalyzer);
0057     QVERIFY(model);
0058     delete systemAnalyzer;
0059 }
0060 
0061 QTEST_MAIN(LogModeFactoryTest)
0062 
0063 #include "logModeFactoryTest.moc"