Skip to content

Commit e6050b5

Browse files
committedMay 27, 2019
Fix QCOMPARE with variant lists in test
1 parent 3f1ba81 commit e6050b5

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed
 

‎tests/src/gui/testqgsvaluerelationwidgetwrapper.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ void TestQgsValueRelationWidgetWrapper::testDrillDownMulti()
278278

279279
QCOMPARE( w_municipality.mTableWidget->rowCount(), 1 );
280280
QCOMPARE( w_municipality.mTableWidget->item( 0, 0 )->text(), QStringLiteral( "Some Place By The River" ) );
281-
QCOMPARE( w_municipality.value(), QVariantList( { 1 } ) );
281+
QCOMPARE( w_municipality.value(), QVariant( QVariantList( { 1 } ) ) );
282282

283283
// Filter by geometry
284284
cfg_municipality[ QStringLiteral( "FilterExpression" ) ] = QStringLiteral( "contains(buffer(@current_geometry, 1 ), $geometry)" );
@@ -312,7 +312,7 @@ void TestQgsValueRelationWidgetWrapper::testDrillDownMulti()
312312

313313
// Check with passing a variant list
314314
w_municipality.setValue( QVariantList( {1, 2} ) );
315-
QCOMPARE( w_municipality.value(), QVariantList( { 2, 1 } ) );
315+
QCOMPARE( w_municipality.value(), QVariant( QVariantList( { 2, 1 } ) ) );
316316

317317
// Check values are checked
318318
f3.setAttribute( QStringLiteral( "fk_municipality" ), QStringLiteral( "{1,2}" ) );
@@ -322,7 +322,7 @@ void TestQgsValueRelationWidgetWrapper::testDrillDownMulti()
322322
QCOMPARE( w_municipality.mTableWidget->item( 1, 0 )->text(), QStringLiteral( "Some Place By The River" ) );
323323
QCOMPARE( w_municipality.mTableWidget->item( 0, 0 )->checkState(), Qt::Checked );
324324
QCOMPARE( w_municipality.mTableWidget->item( 1, 0 )->checkState(), Qt::Checked );
325-
QCOMPARE( w_municipality.value(), QVariantList( {2, 1 } ) );
325+
QCOMPARE( w_municipality.value(), QVariant( QVariantList( {2, 1 } ) ) );
326326

327327
}
328328

@@ -694,7 +694,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInSpatialite()
694694

695695
// FEATURE 1
696696
w_favoriteauthors.setFeature( vl_json->getFeature( 1 ) );
697-
QCOMPARE( w_favoriteauthors.value(), QVariantList() << 1 << 3 );
697+
QCOMPARE( w_favoriteauthors.value(), QVariant( QVariantList( { 1, 3 } ) ) );
698698
//check if first feature checked correctly (1,3) pk
699699
QCOMPARE( w_favoriteauthors.mTableWidget->item( 0, 0 )->checkState(), Qt::Checked ); // 1
700700
QCOMPARE( w_favoriteauthors.mTableWidget->item( 1, 0 )->checkState(), Qt::Unchecked ); // 2
@@ -709,7 +709,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInSpatialite()
709709
w_favoriteauthors.mTableWidget->item( 4, 0 )->setCheckState( Qt::Checked );
710710

711711
//check if first feature checked correctly (1,2,3,5)
712-
QCOMPARE( w_favoriteauthors.value(), QVariantList( {1, 2, 3, 5} ) );
712+
QCOMPARE( w_favoriteauthors.value(), QVariant( QVariantList( {1, 2, 3, 5} ) ) );
713713
QCOMPARE( w_favoriteauthors.mTableWidget->item( 0, 0 )->checkState(), Qt::Checked );
714714
QCOMPARE( w_favoriteauthors.mTableWidget->item( 1, 0 )->checkState(), Qt::Checked );
715715
QCOMPARE( w_favoriteauthors.mTableWidget->item( 2, 0 )->checkState(), Qt::Checked );
@@ -730,7 +730,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInSpatialite()
730730

731731
// FEATURE 2
732732
w_favoriteauthors.setFeature( vl_json->getFeature( 2 ) );
733-
QCOMPARE( w_favoriteauthors.value(), QVariantList( {2, 5} ) );
733+
QCOMPARE( w_favoriteauthors.value(), QVariant( QVariantList( {2, 5} ) ) );
734734
//check if second feature checked correctly
735735
QCOMPARE( w_favoriteauthors.mTableWidget->item( 0, 0 )->checkState(), Qt::Unchecked );
736736
QCOMPARE( w_favoriteauthors.mTableWidget->item( 1, 0 )->checkState(), Qt::Checked );
@@ -743,7 +743,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInSpatialite()
743743
// FEATURE 4
744744
w_favoriteauthors.setFeature( vl_json->getFeature( 4 ) );
745745
//check if first feature checked correctly (NULL)
746-
QCOMPARE( w_favoriteauthors.value(), QVariantList() );
746+
QCOMPARE( w_favoriteauthors.value(), QVariant( QVariantList() ) );
747747
QCOMPARE( w_favoriteauthors.mTableWidget->item( 0, 0 )->checkState(), Qt::Unchecked );
748748
QCOMPARE( w_favoriteauthors.mTableWidget->item( 1, 0 )->checkState(), Qt::Unchecked );
749749
QCOMPARE( w_favoriteauthors.mTableWidget->item( 2, 0 )->checkState(), Qt::Unchecked );
@@ -755,7 +755,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInSpatialite()
755755
// FEATURE 5
756756
w_favoriteauthors.setFeature( vl_json->getFeature( 5 ) );
757757
//check if first feature checked correctly (blank)
758-
QCOMPARE( w_favoriteauthors.value(), QVariantList( ) );
758+
QCOMPARE( w_favoriteauthors.value(), QVariant( QVariantList( ) ) );
759759
QCOMPARE( w_favoriteauthors.mTableWidget->item( 0, 0 )->checkState(), Qt::Unchecked );
760760
QCOMPARE( w_favoriteauthors.mTableWidget->item( 1, 0 )->checkState(), Qt::Unchecked );
761761
QCOMPARE( w_favoriteauthors.mTableWidget->item( 2, 0 )->checkState(), Qt::Unchecked );
@@ -851,7 +851,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInSpatialiteTextFk()
851851

852852
// FEATURE 1
853853
w_favoriteauthors.setFeature( vl_json->getFeature( 1 ) );
854-
QCOMPARE( w_favoriteauthors.value(), QVariantList( ) << "1gamma" << "3johnson\"quote" );
854+
QCOMPARE( w_favoriteauthors.value(), QVariant( QVariantList( { "1gamma", "3johnson\"quote" } ) ) );
855855
//check if first feature checked correctly (1,3) pk
856856
QCOMPARE( w_favoriteauthors.mTableWidget->item( 0, 0 )->checkState(), Qt::Checked ); // 1
857857
QCOMPARE( w_favoriteauthors.mTableWidget->item( 1, 0 )->checkState(), Qt::Unchecked ); // 2
@@ -866,7 +866,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInSpatialiteTextFk()
866866
w_favoriteauthors.mTableWidget->item( 4, 0 )->setCheckState( Qt::Checked );
867867

868868
//check if first feature checked correctly (1,2,3,5)
869-
QCOMPARE( w_favoriteauthors.value(), QVariantList() << "1gamma" << "2helm,comma" << "3johnson\"quote" << "5adams'singlequote" );
869+
QCOMPARE( w_favoriteauthors.value(), QVariant( QVariantList( { "1gamma", "2helm,comma", "3johnson\"quote", "5adams'singlequote" } ) ) );
870870
QCOMPARE( w_favoriteauthors.mTableWidget->item( 0, 0 )->checkState(), Qt::Checked );
871871
QCOMPARE( w_favoriteauthors.mTableWidget->item( 1, 0 )->checkState(), Qt::Checked );
872872
QCOMPARE( w_favoriteauthors.mTableWidget->item( 2, 0 )->checkState(), Qt::Checked );
@@ -887,7 +887,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInSpatialiteTextFk()
887887

888888
// FEATURE 2
889889
w_favoriteauthors.setFeature( vl_json->getFeature( 2 ) );
890-
QCOMPARE( w_favoriteauthors.value(), QVariantList() << "2helm,comma" << "5adams'singlequote" );
890+
QCOMPARE( w_favoriteauthors.value(), QVariant( QVariantList( { "2helm,comma", "5adams'singlequote" } ) ) );
891891
//check if second feature checked correctly
892892
QCOMPARE( w_favoriteauthors.mTableWidget->item( 0, 0 )->checkState(), Qt::Unchecked );
893893
QCOMPARE( w_favoriteauthors.mTableWidget->item( 1, 0 )->checkState(), Qt::Checked );
@@ -900,7 +900,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInSpatialiteTextFk()
900900
// FEATURE 4
901901
w_favoriteauthors.setFeature( vl_json->getFeature( 4 ) );
902902
//check if first feature checked correctly (NULL)
903-
QCOMPARE( w_favoriteauthors.value(), QVariantList( ) );
903+
QCOMPARE( w_favoriteauthors.value(), QVariant( QVariantList( ) ) );
904904
QCOMPARE( w_favoriteauthors.mTableWidget->item( 0, 0 )->checkState(), Qt::Unchecked );
905905
QCOMPARE( w_favoriteauthors.mTableWidget->item( 1, 0 )->checkState(), Qt::Unchecked );
906906
QCOMPARE( w_favoriteauthors.mTableWidget->item( 2, 0 )->checkState(), Qt::Unchecked );
@@ -912,7 +912,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInSpatialiteTextFk()
912912
// FEATURE 5
913913
w_favoriteauthors.setFeature( vl_json->getFeature( 5 ) );
914914
//check if first feature checked correctly (blank)
915-
QCOMPARE( w_favoriteauthors.value(), QVariantList() );
915+
QCOMPARE( w_favoriteauthors.value(), QVariant( QVariantList() ) );
916916
QCOMPARE( w_favoriteauthors.mTableWidget->item( 0, 0 )->checkState(), Qt::Unchecked );
917917
QCOMPARE( w_favoriteauthors.mTableWidget->item( 1, 0 )->checkState(), Qt::Unchecked );
918918
QCOMPARE( w_favoriteauthors.mTableWidget->item( 2, 0 )->checkState(), Qt::Unchecked );

0 commit comments

Comments
 (0)
Please sign in to comment.