Skip to content
Permalink
Browse files

Add test

  • Loading branch information
pblottiere committed Nov 27, 2017
1 parent b1008c7 commit 7ff6470df7b11b9274557edc61dfb0b1c88c53d4
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests/src/gui/testqgsrelationreferencewidget.cpp
@@ -20,13 +20,15 @@
#include <qgsapplication.h>
#include "qgseditorwidgetwrapper.h"
#include <editorwidgets/qgsrelationreferencewidget.h>
#include <editorwidgets/qgsrelationreferencewidgetwrapper.h>
#include <qgsproject.h>
#include <qgsattributeform.h>
#include <qgsrelationmanager.h>
#include <attributetable/qgsattributetablefiltermodel.h>
#include "qgsfeaturelistcombobox.h"
#include "qgsfeaturefiltermodel.h"
#include "qgsgui.h"
#include "qgsmapcanvas.h"

class TestQgsRelationReferenceWidget : public QObject
{
@@ -43,6 +45,7 @@ class TestQgsRelationReferenceWidget : public QObject
void testChainFilter();
void testChainFilterRefreshed();
void testChainFilterDeleteForeignKey();
void testInvalidRelation();

private:
std::unique_ptr<QgsVectorLayer> mLayer1;
@@ -273,5 +276,16 @@ void TestQgsRelationReferenceWidget::testChainFilterDeleteForeignKey()
QCOMPARE( cbs[2]->isEnabled(), false );
}

void TestQgsRelationReferenceWidget::testInvalidRelation()
{
QgsVectorLayer vl( QStringLiteral( "LineString?crs=epsg:3111&field=pk:int&field=fk:int" ), QStringLiteral( "vl1" ), QStringLiteral( "memory" ) );
QgsMapCanvas canvas;
QgsRelationReferenceWidget editor( new QWidget() );

// initWidget with an invalid relation
QgsRelationReferenceWidgetWrapper ww( &vl, 10, &editor, &canvas, nullptr, nullptr );
ww.initWidget( nullptr );
}

QGSTEST_MAIN( TestQgsRelationReferenceWidget )
#include "testqgsrelationreferencewidget.moc"

0 comments on commit 7ff6470

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