Skip to content
Permalink
Browse files

Unit tests for setting and getting relation reference widget values

  • Loading branch information
m-kuhn committed May 3, 2018
1 parent 561d255 commit 2c415e8fa5d918dda6bcd30a78cde043b93f6309
Showing with 7 additions and 0 deletions.
  1. +7 −0 tests/src/gui/testqgsrelationreferencewidget.cpp
@@ -298,14 +298,21 @@ void TestQgsRelationReferenceWidget::testSetGetForeignKey()
w.setRelation( *mRelation, true );
w.init();

QSignalSpy spy( &w, SIGNAL( foreignKeyChanged( QVariant ) ) );

w.setForeignKey( 11 );
QCOMPARE( w.foreignKey(), QVariant( 11 ) );
QCOMPARE( w.mComboBox->currentText(), QStringLiteral( "(11)" ) );
QCOMPARE( spy.count(), 1 );

w.setForeignKey( 12 );
QCOMPARE( w.foreignKey(), QVariant( 12 ) );
QCOMPARE( w.mComboBox->currentText(), QStringLiteral( "(12)" ) );
QCOMPARE( spy.count(), 2 );

w.setForeignKey( QVariant( QVariant::Int ) );
Q_ASSERT( w.foreignKey().isNull() );
QCOMPARE( spy.count(), 3 );
}

QGSTEST_MAIN( TestQgsRelationReferenceWidget )

0 comments on commit 2c415e8

Please sign in to comment.
You can’t perform that action at this time.