[partition] Stub of a test of scandevice
This commit is contained in:
parent
e294221a2d
commit
22ba21f937
@ -52,9 +52,6 @@ calamares_add_test(
|
||||
CreateLayoutsTests.cpp
|
||||
LIBRARIES
|
||||
kpmcore
|
||||
calamares
|
||||
calamaresui
|
||||
Qt5::Gui
|
||||
DEFINITIONS ${_partition_defs}
|
||||
)
|
||||
|
||||
@ -63,6 +60,10 @@ calamares_add_test(
|
||||
SOURCES
|
||||
${PartitionModule_SOURCE_DIR}/jobs/AutoMountManagementJob.cpp
|
||||
AutoMountTests.cpp
|
||||
LIBRARIES
|
||||
calamares
|
||||
)
|
||||
|
||||
calamares_add_test(
|
||||
partitiondevicestest
|
||||
SOURCES
|
||||
DevicesTests.cpp
|
||||
)
|
||||
|
56
src/modules/partition/tests/DevicesTests.cpp
Normal file
56
src/modules/partition/tests/DevicesTests.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
/* === 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 "core/DeviceList.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
class DevicesTests : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DevicesTests();
|
||||
|
||||
private Q_SLOTS:
|
||||
void testKPMScanDevices();
|
||||
void testPartUtilScanDevices();
|
||||
};
|
||||
|
||||
DevicesTests::DevicesTests() {}
|
||||
|
||||
void
|
||||
DevicesTests::testKPMScanDevices()
|
||||
{
|
||||
Logger::setupLogLevel( Logger::LOGVERBOSE );
|
||||
|
||||
#if defined( WITH_KPMCORE4API )
|
||||
cDebug() << "Getting devices via KPMCore";
|
||||
CoreBackend* backend = CoreBackendManager::self()->backend();
|
||||
DeviceList devices = backend->scanDevices( /* not includeReadOnly, not includeLoopback */ ScanFlag( 0 ) );
|
||||
cDebug() << Logger::SubEntry << "Done getting devices.";
|
||||
#else
|
||||
cWarning() << "Test skipped; use KPMCore4";
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
DevicesTests::testPartUtilScanDevices()
|
||||
{
|
||||
Logger::setupLogLevel( Logger::LOGVERBOSE );
|
||||
|
||||
cDebug() << "Getting devices via PartUtils";
|
||||
auto l = PartUtils::getDevices();
|
||||
cDebug() << Logger::SubEntry << "Done getting devices.";
|
||||
|
||||
QVERIFY( l.count() > 0 );
|
||||
}
|
Loading…
Reference in New Issue
Block a user