Apply coding style globally again

This commit is contained in:
Adriaan de Groot 2020-10-12 14:27:01 +02:00
parent cff24bdd79
commit a955791766
21 changed files with 125 additions and 126 deletions

View file

@ -11,9 +11,9 @@
#include "core/PartitionLayout.h"
#include "utils/Logger.h"
#include "partition/KPMManager.h"
#include "JobQueue.h"
#include "partition/KPMManager.h"
#include "utils/Logger.h"
#include <core/lvmdevice.h>
#include <core/partition.h>
@ -57,72 +57,72 @@ void
CreateLayoutsTests::testFixedSizePartition()
{
PartitionLayout layout = PartitionLayout();
TestDevice dev( QString( "test" ), LOGICAL_SIZE, 5_GiB/LOGICAL_SIZE );
TestDevice dev( QString( "test" ), LOGICAL_SIZE, 5_GiB / LOGICAL_SIZE );
PartitionRole role( PartitionRole::Role::Any );
QList< Partition* > partitions;
if (!layout.addEntry( QString( "/" ), QString( "5MiB" ) ))
if ( !layout.addEntry( QString( "/" ), QString( "5MiB" ) ) )
{
QFAIL( qPrintable( "Unable to create / partition" ) );
}
partitions = layout.execute( static_cast<Device *>(&dev), 0, dev.totalLogical(), nullptr, nullptr, role );
partitions = layout.execute( static_cast< Device* >( &dev ), 0, dev.totalLogical(), nullptr, nullptr, role );
QCOMPARE( partitions.count(), 1 );
QCOMPARE( partitions[0]->length(), 5_MiB/LOGICAL_SIZE );
QCOMPARE( partitions[ 0 ]->length(), 5_MiB / LOGICAL_SIZE );
}
void
CreateLayoutsTests::testPercentSizePartition()
{
PartitionLayout layout = PartitionLayout();
TestDevice dev( QString( "test" ), LOGICAL_SIZE, 5_GiB/LOGICAL_SIZE );
TestDevice dev( QString( "test" ), LOGICAL_SIZE, 5_GiB / LOGICAL_SIZE );
PartitionRole role( PartitionRole::Role::Any );
QList< Partition* > partitions;
if (!layout.addEntry( QString( "/" ), QString( "50%" ) ))
if ( !layout.addEntry( QString( "/" ), QString( "50%" ) ) )
{
QFAIL( qPrintable( "Unable to create / partition" ) );
}
partitions = layout.execute( static_cast<Device *>(&dev), 0, dev.totalLogical(), nullptr, nullptr, role );
partitions = layout.execute( static_cast< Device* >( &dev ), 0, dev.totalLogical(), nullptr, nullptr, role );
QCOMPARE( partitions.count(), 1 );
QCOMPARE( partitions[0]->length(), (5_GiB/2)/LOGICAL_SIZE );
QCOMPARE( partitions[ 0 ]->length(), ( 5_GiB / 2 ) / LOGICAL_SIZE );
}
void
CreateLayoutsTests::testMixedSizePartition()
{
PartitionLayout layout = PartitionLayout();
TestDevice dev( QString( "test" ), LOGICAL_SIZE, 5_GiB/LOGICAL_SIZE );
TestDevice dev( QString( "test" ), LOGICAL_SIZE, 5_GiB / LOGICAL_SIZE );
PartitionRole role( PartitionRole::Role::Any );
QList< Partition* > partitions;
if (!layout.addEntry( QString( "/" ), QString( "5MiB" ) ))
if ( !layout.addEntry( QString( "/" ), QString( "5MiB" ) ) )
{
QFAIL( qPrintable( "Unable to create / partition" ) );
}
if (!layout.addEntry( QString( "/home" ), QString( "50%" ) ))
if ( !layout.addEntry( QString( "/home" ), QString( "50%" ) ) )
{
QFAIL( qPrintable( "Unable to create /home partition" ) );
}
if (!layout.addEntry( QString( "/bkup" ), QString( "50%" ) ))
if ( !layout.addEntry( QString( "/bkup" ), QString( "50%" ) ) )
{
QFAIL( qPrintable( "Unable to create /bkup partition" ) );
}
partitions = layout.execute( static_cast<Device *>(&dev), 0, dev.totalLogical(), nullptr, nullptr, role );
partitions = layout.execute( static_cast< Device* >( &dev ), 0, dev.totalLogical(), nullptr, nullptr, role );
QCOMPARE( partitions.count(), 3 );
QCOMPARE( partitions[0]->length(), 5_MiB/LOGICAL_SIZE );
QCOMPARE( partitions[1]->length(), ((5_GiB - 5_MiB)/2)/LOGICAL_SIZE );
QCOMPARE( partitions[2]->length(), ((5_GiB - 5_MiB)/2)/LOGICAL_SIZE );
QCOMPARE( partitions[ 0 ]->length(), 5_MiB / LOGICAL_SIZE );
QCOMPARE( partitions[ 1 ]->length(), ( ( 5_GiB - 5_MiB ) / 2 ) / LOGICAL_SIZE );
QCOMPARE( partitions[ 2 ]->length(), ( ( 5_GiB - 5_MiB ) / 2 ) / LOGICAL_SIZE );
}
#ifdef WITH_KPMCORE4API
@ -132,21 +132,27 @@ class DevicePrivate
public:
QString m_Name;
QString m_DeviceNode;
qint64 m_LogicalSectorSize;
qint64 m_TotalLogical;
qint64 m_LogicalSectorSize;
qint64 m_TotalLogical;
PartitionTable* m_PartitionTable;
QString m_IconName;
std::shared_ptr<SmartStatus> m_SmartStatus;
std::shared_ptr< SmartStatus > m_SmartStatus;
Device::Type m_Type;
};
TestDevice::TestDevice(const QString& name, const qint64 logicalSectorSize, const qint64 totalLogicalSectors)
: Device (std::make_shared<DevicePrivate>(), name, QString( "node" ), logicalSectorSize, totalLogicalSectors, QString(), Device::Type::Unknown_Device)
TestDevice::TestDevice( const QString& name, const qint64 logicalSectorSize, const qint64 totalLogicalSectors )
: Device( std::make_shared< DevicePrivate >(),
name,
QString( "node" ),
logicalSectorSize,
totalLogicalSectors,
QString(),
Device::Type::Unknown_Device )
{
}
#else
TestDevice::TestDevice(const QString& name, const qint64 logicalSectorSize, const qint64 totalLogicalSectors)
: Device (name, QString( "node" ), logicalSectorSize, totalLogicalSectors, QString(), Device::Type::Unknown_Device)
TestDevice::TestDevice( const QString& name, const qint64 logicalSectorSize, const qint64 totalLogicalSectors )
: Device( name, QString( "node" ), logicalSectorSize, totalLogicalSectors, QString(), Device::Type::Unknown_Device )
{
}
#endif