Skip to content

Commit 7d6518f

Browse files
committedMay 17, 2018
Update unit tests
1 parent 4b70120 commit 7d6518f

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed
 

‎tests/src/gui/testqgsrelationreferencewidget.cpp

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,36 @@ void TestQgsRelationReferenceWidget::testChainFilter()
185185

186186
// set the filter for "raccord" and then reset filter for "diameter". As
187187
// chain filter is activated, the filter on "raccord" field should be reset
188-
cbs[2]->setCurrentIndex( cbs[2]->findText( QStringLiteral( "brides" ) ) );
189-
cbs[1]->setCurrentIndex( cbs[1]->findText( QStringLiteral( "diameter" ) ) );
190-
191188
QEventLoop loop;
192189
connect( qobject_cast<QgsFeatureFilterModel *>( w.mComboBox->model() ), &QgsFeatureFilterModel::filterJobCompleted, &loop, &QEventLoop::quit );
190+
191+
cbs[0]->setCurrentIndex( 0 );
192+
loop.exec();
193+
QCOMPARE( w.mComboBox->currentText(), QString( "NULL" ) );
194+
195+
cbs[0]->setCurrentIndex( cbs[0]->findText( "iron" ) );
196+
loop.exec();
197+
QCOMPARE( w.mComboBox->currentText(), QString( "10" ) );
198+
199+
cbs[0]->setCurrentIndex( cbs[0]->findText( "steel" ) );
200+
loop.exec();
201+
QCOMPARE( w.mComboBox->currentText(), QString( "12" ) );
202+
203+
cbs[0]->setCurrentIndex( cbs[0]->findText( "iron" ) );
204+
loop.exec();
205+
QCOMPARE( w.mComboBox->currentText(), QString( "10" ) );
206+
207+
cbs[1]->setCurrentIndex( cbs[1]->findText( "120" ) );
208+
loop.exec();
209+
QCOMPARE( w.mComboBox->currentText(), QString( "10" ) );
210+
211+
cbs[2]->setCurrentIndex( cbs[2]->findText( QStringLiteral( "brides" ) ) );
212+
loop.exec();
213+
QCOMPARE( w.mComboBox->currentText(), QString( "10" ) );
214+
215+
cbs[1]->setCurrentIndex( cbs[1]->findText( QStringLiteral( "diameter" ) ) );
193216
loop.exec();
217+
QCOMPARE( w.mComboBox->currentText(), QString( "10" ) );
194218

195219
// combobox should propose NULL, 10 and 11 because the filter is now:
196220
// "material" == 'iron'
@@ -200,6 +224,7 @@ void TestQgsRelationReferenceWidget::testChainFilter()
200224
cbs[0]->setCurrentIndex( cbs[0]->findText( QStringLiteral( "material" ) ) );
201225
loop.exec();
202226
QCOMPARE( w.mComboBox->count(), 4 );
227+
QCOMPARE( w.mComboBox->currentText(), QString( "NULL" ) );
203228
}
204229

205230
void TestQgsRelationReferenceWidget::testChainFilterRefreshed()

0 commit comments

Comments
 (0)
Please sign in to comment.