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

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 "skgbankincludes.h"
0013 #include "skgimportexportmanager.h"
0014 
0015 /**
0016  * The main function of the unit test
0017  * @param argc the number of arguments
0018  * @param argv the list of arguments
0019  */
0020 int main(int argc, char** argv)
0021 {
0022     Q_UNUSED(argc)
0023     Q_UNUSED(argv)
0024 
0025     // Init test
0026     SKGINITTEST(true) {
0027         // Test import OFX skrooge
0028         SKGDocumentBank document1;
0029         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0030 
0031         SKGError err;
0032         {
0033             // Scope of the transaction
0034             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0035             SKGImportExportManager impmissing(&document1, QUrl::fromLocalFile(QStringLiteral("missingfile.ofx")));
0036             SKGTESTERROR(QStringLiteral("imp1.importFile"), impmissing.importFile(), false)
0037 
0038             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/ofx_spec160_stmtrs_example.ofx"));
0039             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0040             // document1.dump ( DUMPOPERATION|DUMPACCOUNT );
0041         }
0042 
0043         {
0044             // To check double import
0045             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0046             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/ofx_spec160_stmtrs_example.ofx"));
0047             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0048         }
0049         SKGAccountObject account;
0050         SKGTESTERROR(QStringLiteral("ACCOUNT.getObjectByName"), SKGNamedObject::getObjectByName(&document1, QStringLiteral("v_account"), QStringLiteral("999988"), account), true)
0051         SKGTESTERROR(QStringLiteral("ACCOUNT.load"), account.load(), true)
0052         SKGTEST(QStringLiteral("ACCOUNT:getCurrentAmount"), SKGServices::doubleToString(account.getCurrentAmount()), QStringLiteral("200.29"))
0053     }
0054 
0055     {
0056         // Test import OFX skrooge
0057         SKGDocumentBank document1;
0058         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0059 
0060         SKGError err;
0061         {
0062             // Scope of the transaction
0063             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0064             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/ofx_spec201_stmtrs_example.ofx"));
0065             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0066             // document1.dump ( DUMPOPERATION|DUMPACCOUNT );
0067         }
0068 
0069         SKGAccountObject account;
0070         SKGTESTERROR(QStringLiteral("ACCOUNT.getObjectByName"), SKGNamedObject::getObjectByName(&document1, QStringLiteral("v_account"), QStringLiteral("999988"), account), true)
0071         SKGTESTERROR(QStringLiteral("ACCOUNT.load"), account.load(), true)
0072         SKGTEST(QStringLiteral("ACCOUNT:getCurrentAmount"), SKGServices::doubleToString(account.getCurrentAmount()), QStringLiteral("200.29"))
0073     }
0074 
0075     {
0076         // Test import OFX skrooge
0077         SKGDocumentBank document1;
0078         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0079 
0080         SKGError err;
0081         {
0082             // Scope of the transaction
0083             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0084             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/t1.ofx"));
0085             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0086             // document1.dump ( DUMPOPERATION|DUMPACCOUNT );
0087         }
0088 
0089         SKGAccountObject account;
0090         SKGTESTERROR(QStringLiteral("ACCOUNT.getObjectByName"), SKGNamedObject::getObjectByName(&document1, QStringLiteral("v_account"), QStringLiteral("Investment account 12345 at broker ameritrade.com"), account), true)
0091         SKGTESTERROR(QStringLiteral("ACCOUNT.load"), account.load(), true)
0092         SKGTEST(QStringLiteral("ACCOUNT:getCurrentAmount"), SKGServices::doubleToString(account.getCurrentAmount()), QStringLiteral("1672.84"))
0093     }
0094 
0095     {
0096         // Test import OFX skrooge
0097         SKGDocumentBank document1;
0098         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0099 
0100         SKGError err;
0101         {
0102             // Scope of the transaction
0103             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0104             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/385366.ofx"));
0105             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0106             // document1.dump ( DUMPOPERATION|DUMPACCOUNT );
0107         }
0108 
0109         SKGAccountObject account;
0110         SKGTESTERROR(QStringLiteral("ACCOUNT.getObjectByName"), SKGNamedObject::getObjectByName(&document1, QStringLiteral("v_account"), QStringLiteral("Investment account 209830947 at broker fidelity.com"), account), true)
0111         SKGTESTERROR(QStringLiteral("ACCOUNT.load"), account.load(), true)
0112         SKGTEST(QStringLiteral("ACCOUNT:getCurrentAmount"), SKGServices::doubleToString(account.getCurrentAmount()), QStringLiteral("-1.818989404e-12"))
0113     }
0114 
0115     {
0116         // Test import OFX skrooge
0117         SKGDocumentBank document1;
0118         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0119 
0120         SKGError err;
0121         {
0122             // Scope of the transaction
0123             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0124             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/430130.ofx"));
0125             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0126             // document1.dump ( DUMPOPERATION|DUMPACCOUNT );
0127         }
0128 
0129         SKGAccountObject account;
0130         SKGTESTERROR(QStringLiteral("ACCOUNT.getObjectByName"), SKGNamedObject::getObjectByName(&document1, QStringLiteral("v_account"), QStringLiteral("1234567L123"), account), true)
0131         SKGTESTERROR(QStringLiteral("ACCOUNT.load"), account.load(), true)
0132         SKGTEST(QStringLiteral("ACCOUNT:getCurrentAmount"), SKGServices::doubleToString(account.getCurrentAmount()), QStringLiteral("-8238.77"))
0133         SKGTEST(QStringLiteral("ACCOUNT:getCurrentAmount"), account.getAttribute(QStringLiteral("f_importbalance")), QStringLiteral("-8238.77"))
0134     }
0135 
0136     {
0137         // Test import OFX skrooge
0138         SKGDocumentBank document1;
0139         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0140 
0141         SKGError err;
0142         {
0143             // Scope of the transaction
0144             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0145             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/ca_remi.ofx"));
0146             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0147             // document1.dump ( DUMPOPERATION|DUMPACCOUNT );
0148         }
0149         QStringList oResult;
0150         SKGTESTERROR(QStringLiteral("ACCOUNT:getDistinctValues"), document1.getDistinctValues(QStringLiteral("account"), QStringLiteral("t_name"), oResult), true)
0151         SKGTEST(QStringLiteral("ACCOUNT:oResult.size"), oResult.size(), 5)
0152 
0153 
0154         /*SKGAccountObject account;
0155         SKGTESTERROR(QStringLiteral("ACCOUNT.getObjectByName"), SKGNamedObject::getObjectByName(&document1,QStringLiteral("v_account"), QStringLiteral("1234567L123"), account), true)
0156         SKGTESTERROR(QStringLiteral("ACCOUNT.load"), account.load(), true)
0157         SKGTEST(QStringLiteral("ACCOUNT:getCurrentAmount"),SKGServices::doubleToString(account.getCurrentAmount()), QStringLiteral("3366.86"))*/
0158     }
0159 
0160     {
0161         // Test import OFX with initial balance
0162         SKGDocumentBank document1;
0163         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0164 
0165         SKGError err;
0166         {
0167             // Scope of the transaction
0168             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0169             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/initial_balance.ofx"));
0170             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0171             // document1.dump ( DUMPOPERATION|DUMPACCOUNT );
0172         }
0173 
0174         SKGAccountObject account;
0175         SKGTESTERROR(QStringLiteral("ACCOUNT.getObjectByName"), SKGNamedObject::getObjectByName(&document1, QStringLiteral("v_account"), QStringLiteral("40080030367683"), account), true)
0176         SKGTESTERROR(QStringLiteral("ACCOUNT.load"), account.load(), true)
0177         SKGTEST(QStringLiteral("ACCOUNT:getCurrentAmount"), SKGServices::doubleToString(account.getCurrentAmount()), QStringLiteral("5036.46"))
0178     }
0179 
0180     {
0181         // Test import OFX with initial balance after rename of account
0182         SKGDocumentBank document1;
0183         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0184 
0185         SKGError err;
0186         {
0187             // Create account
0188             SKGBEGINTRANSACTION(document1, QStringLiteral("CREATE_ACCOUNT"), err)
0189             SKGTESTERROR(QStringLiteral("DOC.addOrModifyAccount"), document1.addOrModifyAccount(QStringLiteral("COURANT"), QStringLiteral("111111"), QStringLiteral("BANK")), true)
0190         }
0191         {
0192             // Scope of the transaction
0193             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0194             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/bug_statement.ofx"));
0195             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0196             // document1.dump ( DUMPOPERATION|DUMPACCOUNT );
0197         }
0198 
0199         SKGAccountObject account;
0200         SKGTESTERROR(QStringLiteral("ACCOUNT.getObjectByName"), SKGNamedObject::getObjectByName(&document1, QStringLiteral("v_account"), QStringLiteral("COURANT"), account), true)
0201         SKGTESTERROR(QStringLiteral("ACCOUNT.load"), account.load(), true)
0202         SKGTEST(QStringLiteral("ACCOUNT:getCurrentAmount"), SKGServices::doubleToString(account.getCurrentAmount()), QStringLiteral("7645.86"))
0203     }
0204 
0205     {
0206         // Test BUG 234771
0207         SKGDocumentBank document1;
0208         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0209 
0210         SKGError err;
0211         {
0212             // Create an account without number
0213             SKGBEGINTRANSACTION(document1, QStringLiteral("CREATE_ACCOUNT"), err)
0214             SKGTESTERROR(QStringLiteral("DOC.addOrModifyAccount"), document1.addOrModifyAccount(QStringLiteral("COURANT"), QLatin1String(""), QStringLiteral("BANK")), true)
0215         }
0216         {
0217             // Create an account without number
0218             SKGBEGINTRANSACTION(document1, QStringLiteral("CREATE_ACCOUNT"), err)
0219             SKGTESTERROR(QStringLiteral("DOC.addOrModifyAccount"), document1.addOrModifyAccount(QStringLiteral("COURANT2"), QLatin1String(""), QStringLiteral("BANK")), true)
0220         }
0221         {
0222             // Scope of the transaction
0223             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0224             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/234771.ofx"));
0225             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0226             // document1.dump ( DUMPOPERATION|DUMPACCOUNT );
0227         }
0228 
0229         // Test BUG 319706
0230         bool existMode = false;
0231         SKGTESTERROR(QStringLiteral("doc.existObjects"), document1.existObjects(QStringLiteral("operation"), QStringLiteral("t_mode<>''"), existMode), true)
0232         SKGTESTBOOL("doc.existMode", existMode, true)
0233     }
0234 
0235     {
0236         // Test UTF-8 - 284843
0237         SKGDocumentBank document1;
0238         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0239 
0240         SKGError err;
0241         {
0242             // Scope of the transaction
0243             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0244             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/284843.ofx"));
0245             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0246         }
0247 
0248         int nb = 0;
0249         SKGTESTERROR(QStringLiteral("PAYEE.getNbObjects"), document1.getNbObjects(QStringLiteral("v_payee"), "t_name='" % QStringLiteral("カ-ド") % "'", nb), true)
0250         SKGTEST(QStringLiteral("PAYEE.getNbObjects"), nb, 1)
0251         document1.dump(DUMPPAYEE);
0252     }
0253 
0254     {
0255         // Test UTF-8
0256         SKGDocumentBank document1;
0257         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0258 
0259         SKGError err;
0260         {
0261             // Scope of the transaction
0262             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0263             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/UTF8.ofx"));
0264             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0265         }
0266     }
0267 
0268     {
0269         // Test 255133
0270         SKGDocumentBank document1;
0271         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0272 
0273         SKGError err;
0274         {
0275             // Scope of the transaction
0276             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0277             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/exception.ofx"));
0278             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0279         }
0280     }
0281 
0282     {
0283         // Test import OFX skrooge
0284         SKGDocumentBank document1;
0285         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0286 
0287         SKGError err;
0288         {
0289             // Scope of the transaction
0290             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0291             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/missing_file.ofx"));
0292             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), false)
0293         }
0294     }
0295 
0296     {
0297         // Test export OFX skrooge
0298         SKGDocumentBank document1;
0299         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0300 
0301         SKGError err;
0302         {
0303             // Scope of the transaction
0304             SKGImportExportManager exp(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("OUT")) % "/skgtestimportofx/export.ofx"));
0305             SKGTESTERROR(QStringLiteral("imp1.exportFile"), exp.exportFile(), false)
0306         }
0307     }
0308 
0309     {
0310         // Test 336320
0311         SKGDocumentBank document1;
0312         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0313 
0314         SKGError err;
0315         {
0316             // Scope of the transaction
0317             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0318             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/336320.ofx"));
0319             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0320         }
0321 
0322         int nb1 = 0;
0323         SKGTESTERROR(QStringLiteral("PAYEE.getNbObjects"), document1.getNbObjects(QStringLiteral("operation"), QLatin1String(""), nb1), true)
0324 
0325         {
0326             // Scope of the transaction
0327             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0328             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/336320.ofx"));
0329             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0330         }
0331 
0332         int nb2 = 0;
0333         SKGTESTERROR(QStringLiteral("PAYEE.getNbObjects"), document1.getNbObjects(QStringLiteral("operation"), QLatin1String(""), nb2), true)
0334 
0335         SKGTEST(QStringLiteral("PAYEE.getNbObjects"), nb1, nb2)
0336     }
0337 
0338     {
0339         // Test handling of debit amount with wrong sign
0340         SKGDocumentBank document1;
0341         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0342 
0343         SKGError err;
0344         {
0345             // Scope of the transaction
0346             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0347             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/debit_pos.ofx"));
0348             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0349         }
0350 
0351         bool existDebitPos = false;
0352         SKGTESTERROR(QStringLiteral("doc.existObjects"), document1.existObjects(QStringLiteral("v_operation"), QStringLiteral("t_mode='Debit' and f_currentamount>0"), existDebitPos), true)
0353         SKGTESTBOOL("doc.existDebitPos", existDebitPos, false)
0354     }
0355 
0356     {
0357         // Test import OFX with missing id on transactions (Theo Raves)
0358         SKGDocumentBank document1;
0359         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0360 
0361         SKGError err;
0362         {
0363             // Scope of the transaction
0364             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0365             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/mut.ofx"));
0366             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0367         }
0368 
0369         SKGAccountObject account;
0370         SKGTESTERROR(QStringLiteral("ACCOUNT.getObjectByName"), SKGNamedObject::getObjectByName(&document1, QStringLiteral("v_account"), QStringLiteral("11111111000"), account), true)
0371         SKGTESTERROR(QStringLiteral("ACCOUNT.load"), account.load(), true)
0372         SKGTEST(QStringLiteral("ACCOUNT:getCurrentAmount"), SKGServices::doubleToString(account.getCurrentAmount()), QStringLiteral("-12.34"))
0373     }
0374 
0375     {
0376         // Test import OFX from GNUCASH fr Android
0377         SKGDocumentBank document1;
0378         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0379 
0380         SKGError err;
0381         {
0382             // Scope of the transaction
0383             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0384             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/20150818_133327_gnucash_export.ofx"));
0385             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0386         }
0387     }
0388 
0389     {
0390         // Test import OFX from GNUCASH fr Android
0391         SKGDocumentBank document1;
0392         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0393 
0394         SKGError err;
0395         {
0396             // Scope of the transaction
0397             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0398             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/FEE.ofx"));
0399             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0400         }
0401 
0402         SKGAccountObject account;
0403         SKGTESTERROR(QStringLiteral("ACCOUNT.getObjectByName"), SKGNamedObject::getObjectByName(&document1, QStringLiteral("v_account"), QStringLiteral("1234567L123"), account), true)
0404         SKGTESTERROR(QStringLiteral("ACCOUNT.load"), account.load(), true)
0405         SKGTEST(QStringLiteral("ACCOUNT:getCurrentAmount"), SKGServices::doubleToString(account.getCurrentAmount()), QStringLiteral("-18294.69"))
0406     }
0407 
0408     {
0409         // 406321
0410         SKGDocumentBank document1;
0411         SKGTESTERROR(QStringLiteral("document1.load()"), document1.load(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/406321.skg"), true)
0412 
0413         SKGError err;
0414         {
0415             // Scope of the transaction
0416             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0417             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/406321.ofx"));
0418             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0419         }
0420 
0421         // 406741
0422         int nb2 = 0;
0423         SKGTESTERROR(QStringLiteral("imp1.getNbObjects"), document1.getNbObjects(QStringLiteral("operation"), QStringLiteral("d_date>'2000-01-01'"), nb2), true)
0424         SKGTEST(QStringLiteral("OPERATION:nb"), SKGServices::intToString(nb2), QStringLiteral("5"))
0425     }
0426 
0427     {
0428         // 406321
0429         SKGDocumentBank document1;
0430         SKGTESTERROR(QStringLiteral("document1.load()"), document1.load(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/406321.skg"), true)
0431 
0432         SKGError err;
0433         {
0434             // Scope of the transaction
0435             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0436             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/406321_2.ofx"));
0437             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0438         }
0439     }
0440 
0441     {
0442         // 412494
0443         SKGDocumentBank document1;
0444         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0445         SKGError err;
0446         {
0447             // Scope of the transaction
0448             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0449             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/412494.qfx"));
0450             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0451             SKGDocument::SKGMessageList messages;
0452             SKGTESTERROR(QStringLiteral("imp1.getMessages"), document1.getMessages(document1.getCurrentTransaction(), messages, true), true)
0453             bool test = false;
0454             for (const auto& msg : qAsConst(messages)) {
0455                 SKGTRACE << "Message:" << msg.Text << SKGENDL;
0456                 if (msg.Text.contains(QStringLiteral("0 transactions imported")) ||
0457                     msg.Text.contains(QStringLiteral("1 transaction imported"))) {
0458                     test = true;
0459                 }
0460             }
0461             SKGTEST(QStringLiteral("message.0 transactions imported"), static_cast<unsigned int>(test), 1)
0462         }
0463     }
0464 
0465     {
0466         // 421302
0467         SKGDocumentBank document1;
0468         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0469         SKGError err;
0470         {
0471             // Create an account without number
0472             SKGBEGINTRANSACTION(document1, QStringLiteral("CREATE_ACCOUNT"), err)
0473             SKGTESTERROR(QStringLiteral("DOC.addOrModifyAccount"), document1.addOrModifyAccount(QStringLiteral("COURANT"), QStringLiteral("5823485"), QStringLiteral("BANK")), true)
0474             SKGObjectBase account;
0475             SKGTESTERROR(QStringLiteral("DOC.getObject"), document1.getObject(QStringLiteral("v_account"), QStringLiteral("t_name='COURANT'"), account), true)
0476             SKGTESTERROR(QStringLiteral("ACCOUNT.setProperty"), account.setProperty(QStringLiteral("alias"), QStringLiteral("XXXX485")), true)
0477         }
0478         {
0479             // Scope of the transaction
0480             SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_OFX"), err)
0481             SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportofx/XXXX485.ofx"));
0482             SKGTESTERROR(QStringLiteral("imp1.importFile"), imp1.importFile(), true)
0483             document1.dump(DUMPACCOUNT | DUMPPARAMETERS);
0484             int nb2 = 0;
0485             SKGTESTERROR(QStringLiteral("imp1.getNbObjects"), document1.getNbObjects(QStringLiteral("account"), QString(), nb2), true)
0486             SKGTEST(QStringLiteral("ACCOUNT:nb"), SKGServices::intToString(nb2), QStringLiteral("1"))
0487         }
0488     }
0489     // End test
0490     SKGENDTEST()
0491 }