File indexing completed on 2024-04-28 09:41:28

0001 /*
0002     SPDX-FileCopyrightText: 2007 Nicolas Ternisien <nicolas.ternisien@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 
0011 #include <QString>
0012 
0013 class LogViewModel;
0014 class Analyzer;
0015 
0016 #include "logFile.h"
0017 #include "logLine.h"
0018 
0019 #include "globals.h"
0020 
0021 class TestUtil : public QObject
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     TestUtil();
0027 
0028     ~TestUtil() override;
0029 
0030     /*
0031      * Init method, used to register existing Log Modes
0032      */
0033     void registerLogModeFactories() const;
0034 
0035     LogViewModel *defineLogViewModel(Analyzer *analyzer) const;
0036 
0037     /**
0038      * Find a reader and initialize it.
0039      * If the model == nullptr, then a new model is created and the pointer is update
0040      */
0041     Analyzer *createAnalyzer(const QString &logModeName, LogViewModel **model) const;
0042 
0043     /*
0044      * Delete the reader provided in parameter
0045      */
0046     void destroyReader(Analyzer *analyzer) const;
0047 
0048     /*
0049      * Create a LogFile list from a single resourceFileName
0050      */
0051     QVector<LogFile> createLogFiles(const QString &resourceFileName) const;
0052 
0053     /*
0054      * Add the "addedLines" list to the file "fileName"
0055      */
0056     void addLogLines(const QString &fileName, const QStringList &addedLines) const;
0057 
0058     /*
0059      * Test every fields of the logLine with the other parameters
0060      */
0061     void testLine(LogLine *line, const QString &originalFileName, LogLevel *logLevel, const QDateTime &time, const QStringList &items) const;
0062 };