@@ -185,12 +185,36 @@ void TestQgsRelationReferenceWidget::testChainFilter()
185
185
186
186
// set the filter for "raccord" and then reset filter for "diameter". As
187
187
// 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
-
191
188
QEventLoop loop;
192
189
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" ) ) );
193
216
loop.exec ();
217
+ QCOMPARE ( w.mComboBox ->currentText (), QString ( " 10" ) );
194
218
195
219
// combobox should propose NULL, 10 and 11 because the filter is now:
196
220
// "material" == 'iron'
@@ -200,6 +224,7 @@ void TestQgsRelationReferenceWidget::testChainFilter()
200
224
cbs[0 ]->setCurrentIndex ( cbs[0 ]->findText ( QStringLiteral ( " material" ) ) );
201
225
loop.exec ();
202
226
QCOMPARE ( w.mComboBox ->count (), 4 );
227
+ QCOMPARE ( w.mComboBox ->currentText (), QString ( " NULL" ) );
203
228
}
204
229
205
230
void TestQgsRelationReferenceWidget::testChainFilterRefreshed ()
0 commit comments