[preservefiles] Add (stub) tests

This commit is contained in:
Adriaan de Groot 2021-12-13 15:04:23 +01:00
parent 90f6ea1fc8
commit 8b5e49d980
2 changed files with 77 additions and 2 deletions

View File

@ -3,8 +3,6 @@
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
#
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui )
calamares_add_plugin( preservefiles
TYPE job
EXPORT_MACRO PLUGINDLLEXPORT_PRO
@ -15,3 +13,10 @@ calamares_add_plugin( preservefiles
SHARED_LIB
EMERGENCY
)
calamares_add_test(
preservefilestest
SOURCES
Item.cpp
Tests.cpp
)

View File

@ -0,0 +1,70 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2021 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#include "Item.h"
#include "Settings.h"
#include "utils/CalamaresUtilsSystem.h"
#include "utils/Logger.h"
#include "utils/Yaml.h"
#include <QtTest/QtTest>
class PreserveFilesTests : public QObject
{
Q_OBJECT
public:
PreserveFilesTests();
~PreserveFilesTests() override {}
private Q_SLOTS:
void initTestCase();
/*
void testOneUrl();
void testUrls_data();
void testUrls();
void testBadConfigDoesNotResetUrls();
*/
void testTrue();
};
PreserveFilesTests::PreserveFilesTests() {}
void
PreserveFilesTests::initTestCase()
{
Logger::setupLogLevel( Logger::LOGDEBUG );
cDebug() << "PreserveFiles test started.";
// Ensure we have a system object, expect it to be a "bogus" one
CalamaresUtils::System* system = CalamaresUtils::System::instance();
QVERIFY( system );
cDebug() << Logger::SubEntry << "System @" << Logger::Pointer( system );
const auto* settings = Calamares::Settings::instance();
if ( !settings )
{
(void)new Calamares::Settings( true );
}
}
void
PreserveFilesTests::testTrue()
{
QVERIFY( true );
}
QTEST_GUILESS_MAIN( PreserveFilesTests )
#include "utils/moc-warnings.h"
#include "Tests.moc"