libcalamares: repair tests for Qt6 compatibility

This commit is contained in:
Adriaan de Groot 2023-09-03 17:01:19 +02:00
parent 25250179da
commit ad8c87e5d3

View File

@ -12,6 +12,7 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "Settings.h" #include "Settings.h"
#include "compat/Variant.h"
#include "modulesystem/InstanceKey.h" #include "modulesystem/InstanceKey.h"
#include "utils/Logger.h" #include "utils/Logger.h"
@ -55,7 +56,7 @@ TestLibCalamares::testGSModify()
gs.insert( key, value ); gs.insert( key, value );
QCOMPARE( gs.count(), 1 ); QCOMPARE( gs.count(), 1 );
QVERIFY( gs.contains( key ) ); QVERIFY( gs.contains( key ) );
QCOMPARE( gs.value( key ).type(), QVariant::Int ); QCOMPARE( Calamares::typeOf( gs.value( key ) ), Calamares::IntVariantType );
QCOMPARE( gs.value( key ).toString(), QString( "17" ) ); // It isn't a string, but does convert QCOMPARE( gs.value( key ).toString(), QString( "17" ) ); // It isn't a string, but does convert
QCOMPARE( gs.value( key ).toInt(), value ); QCOMPARE( gs.value( key ).toInt(), value );
@ -137,8 +138,8 @@ TestLibCalamares::testGSLoadSave2()
QVERIFY( gs1.loadYaml( filename ) ); QVERIFY( gs1.loadYaml( filename ) );
QCOMPARE( gs1.count(), 3 ); // From examining the file QCOMPARE( gs1.count(), 3 ); // From examining the file
QVERIFY( gs1.contains( key ) ); QVERIFY( gs1.contains( key ) );
cDebug() << gs1.value( key ).type() << gs1.value( key ); cDebug() << Calamares::typeOf( gs1.value( key ) ) << gs1.value( key );
QCOMPARE( gs1.value( key ).type(), QVariant::List ); QCOMPARE( Calamares::typeOf( gs1.value( key ) ), Calamares::ListVariantType );
const QString yamlfilename( "gs.test.yaml" ); const QString yamlfilename( "gs.test.yaml" );
QVERIFY( gs1.saveYaml( yamlfilename ) ); QVERIFY( gs1.saveYaml( yamlfilename ) );
@ -146,7 +147,7 @@ TestLibCalamares::testGSLoadSave2()
Calamares::GlobalStorage gs2; Calamares::GlobalStorage gs2;
QVERIFY( gs2.loadYaml( yamlfilename ) ); QVERIFY( gs2.loadYaml( yamlfilename ) );
QVERIFY( gs2.contains( key ) ); QVERIFY( gs2.contains( key ) );
QCOMPARE( gs2.value( key ).type(), QVariant::List ); QCOMPARE( Calamares::typeOf( gs2.value( key ) ), Calamares::ListVariantType );
} }
void void