File indexing completed on 2022-09-27 12:38:59

0001 /*
0002     SPDX-FileCopyrightText: 2014 Andreas Xavier <andxav at zoho dot com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 /**
0007 @file
0008 This file collects some utility classes that are used in multiple unit tests
0009 **/
0010 
0011 #include "parleyunittestutilities.h"
0012 
0013 using namespace UnitTestUtilities;
0014 
0015 TemporaryVocDoc::TemporaryVocDoc()
0016     : QTemporaryFile(QStringLiteral("XXXXXX.kvtml"))
0017 {
0018     this->open();
0019     this->close();
0020 }
0021 
0022 TemporaryVocDoc::~TemporaryVocDoc()
0023 {
0024 }
0025 
0026 MinimalTempVocDoc::MinimalTempVocDoc()
0027 {
0028     const QString generator = QStringLiteral("File Locking Unit Tests");
0029     const QString author = QStringLiteral("File Locking Test");
0030     const QString lang = QStringLiteral("File Locking Language Name");
0031     const QString locale = QStringLiteral("en");
0032 
0033     KEduVocIdentifier lang0;
0034     lang0.setName(lang);
0035     lang0.setLocale(locale);
0036 
0037     KEduVocDocument *doc = new KEduVocDocument();
0038     doc->setAuthor(author);
0039     doc->appendIdentifier(lang0);
0040     doc->setGenerator(generator);
0041     doc->saveAs(QUrl::fromLocalFile(fileName()), KEduVocDocument::Kvtml);
0042     delete doc;
0043 }
0044 
0045 /** Destructor*/
0046 MinimalTempVocDoc::~MinimalTempVocDoc()
0047 {
0048 }