Skip to content

Commit 2c415e8

Browse files
committedMay 3, 2018
Unit tests for setting and getting relation reference widget values
1 parent 561d255 commit 2c415e8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎tests/src/gui/testqgsrelationreferencewidget.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,21 @@ void TestQgsRelationReferenceWidget::testSetGetForeignKey()
298298
w.setRelation( *mRelation, true );
299299
w.init();
300300

301+
QSignalSpy spy( &w, SIGNAL( foreignKeyChanged( QVariant ) ) );
302+
301303
w.setForeignKey( 11 );
302304
QCOMPARE( w.foreignKey(), QVariant( 11 ) );
305+
QCOMPARE( w.mComboBox->currentText(), QStringLiteral( "(11)" ) );
306+
QCOMPARE( spy.count(), 1 );
303307

304308
w.setForeignKey( 12 );
305309
QCOMPARE( w.foreignKey(), QVariant( 12 ) );
310+
QCOMPARE( w.mComboBox->currentText(), QStringLiteral( "(12)" ) );
311+
QCOMPARE( spy.count(), 2 );
306312

307313
w.setForeignKey( QVariant( QVariant::Int ) );
308314
Q_ASSERT( w.foreignKey().isNull() );
315+
QCOMPARE( spy.count(), 3 );
309316
}
310317

311318
QGSTEST_MAIN( TestQgsRelationReferenceWidget )

0 commit comments

Comments
 (0)
Please sign in to comment.