Skip to content

Commit 31c3f3a

Browse files
committed
test - specific
method initialising the test of the allow-null-value checkbox
1 parent 114a72e commit 31c3f3a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎tests/src/gui/testqgswidgetsconfigdlg.cpp‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "qgsproject.h"
2222
#include "qgsvectorlayer.h"
2323
#include "qgsattributeform.h"
24+
#include "editorwidgets/qgsuniquevaluesconfigdlg.h"
2425

2526
#include <QComboBox>
2627

@@ -36,13 +37,16 @@ class TestQgsWidgetsConfigDlg : public QObject
3637
void init(); // will be called before each testfunction is executed.
3738
void cleanup(); // will be called after every testfunction.
3839

40+
void testUniqueValuesAllowNull();
41+
3942
private:
4043
void testAllowNull( const QString &widgetType );
4144

4245
QgsVectorLayer *mLayer;
4346
QgsAttributeForm *mForm;
4447
QVariantMap *mConfig;
4548
QComboBox *mComboBox;
49+
QgsUniqueValuesConfigDlg *mUniqueValuesConfigDlg;
4650
};
4751

4852
void TestQgsWidgetsConfigDlg::initTestCase()
@@ -68,6 +72,7 @@ void TestQgsWidgetsConfigDlg::initTestCase()
6872
void TestQgsWidgetsConfigDlg::cleanupTestCase()
6973
{
7074
delete mLayer;
75+
delete mUniqueValuesConfigDlg;
7176
QgsApplication::exitQgis();
7277
}
7378

@@ -103,5 +108,14 @@ void TestQgsWidgetsConfigDlg::testAllowNull( const QString &widgetType )
103108
QCOMPARE( mComboBox->currentText(), "(2)" );
104109
}
105110

111+
void TestQgsWidgetsConfigDlg::testUniqueValuesAllowNull()
112+
{
113+
// create a configuration
114+
const QString widgetType = QStringLiteral( "UniqueValues" );
115+
mUniqueValuesConfigDlg = static_cast<QgsUniqueValuesConfigDlg *>( QgsGui::editorWidgetRegistry()->createConfigWidget( widgetType, mLayer, 1, nullptr ) );
116+
mConfig = new QVariantMap( mUniqueValuesConfigDlg->config() );
117+
testAllowNull( widgetType );
118+
}
119+
106120
QGSTEST_MAIN( TestQgsWidgetsConfigDlg )
107121
#include "testqgswidgetsconfigdlg.moc"

0 commit comments

Comments
 (0)