File indexing completed on 2024-05-12 16:45:28

0001 /***************************************************************************
0002  * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr
0003  * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  ***************************************************************************/
0006 /** @file
0007  * This file is a test script.
0008  *
0009  * @author Stephane MANKOWSKI / Guillaume DE BURE
0010  */
0011 #include "skgtestmacro.h"
0012 #include "skgreport.h"
0013 
0014 /**
0015  * The main function of the unit test
0016  * @param argc the number of arguments
0017  * @param argv the list of arguments
0018  */
0019 int main(int argc, char** argv)
0020 {
0021     Q_UNUSED(argc)
0022     Q_UNUSED(argv)
0023 
0024     // Init test
0025     SKGINITTEST(true)
0026 
0027     SKGDocument document1;
0028     SKGTESTERROR(QStringLiteral("PARAM:initialize"), document1.initialize(), true)
0029 
0030     SKGReport* rep = document1.getReport();
0031     rep->getPeriod();
0032     rep->setPeriod(QStringLiteral("2013-01"));
0033     rep->getPrevious();
0034     SKGTEST(QStringLiteral("REP:getMonth"), rep->getPeriod(), QStringLiteral("2013-01"))
0035     SKGTEST(QStringLiteral("REP:getPreviousMonth"), rep->getPreviousPeriod(), QStringLiteral("2012-12"))
0036 
0037     QString html;
0038     SKGTESTERROR(QStringLiteral("REP:getReportFromTemplate"),  SKGReport::getReportFromTemplate(rep, SKGTest::getTestPath(QStringLiteral("IN")) % "/missing.txt", html), false)
0039 
0040     rep->getPrevious();
0041     rep->setPeriod(QStringLiteral("2013-02"));
0042     rep->cleanCache();
0043     delete rep;
0044 
0045 
0046     // End test
0047     SKGENDTEST()
0048 }