Skip to content

Commit

Permalink
setting fkey to null
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Jan 14, 2020
1 parent 883a527 commit 4b4d902
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tests/src/gui/testqgsrelationreferencewidget.cpp
Expand Up @@ -310,6 +310,22 @@ void TestQgsRelationReferenceWidget::testChainFilterDeleteForeignKey()

QCOMPARE( cbs[2]->currentText(), QString( "raccord" ) );
QCOMPARE( cbs[2]->isEnabled(), false );

// set a foreign key
w.setForeignKeys( QVariantList() << QVariant( 11 ) );

QCOMPARE( cbs[0]->currentText(), QString( "iron" ) );
QCOMPARE( cbs[1]->currentText(), QString( "120" ) );
QCOMPARE( cbs[2]->currentText(), QString( "sleeve" ) );

// set a null foreign key
w.setForeignKeys( QVariantList() << QVariant( QVariant::Int ) );
QCOMPARE( cbs[0]->currentText(), QString( "material" ) );
QCOMPARE( cbs[0]->isEnabled(), true );
QCOMPARE( cbs[1]->currentText(), QString( "diameter" ) );
QCOMPARE( cbs[1]->isEnabled(), false );
QCOMPARE( cbs[2]->currentText(), QString( "raccord" ) );
QCOMPARE( cbs[2]->isEnabled(), false );
}

void TestQgsRelationReferenceWidget::testInvalidRelation()
Expand Down Expand Up @@ -347,7 +363,6 @@ void TestQgsRelationReferenceWidget::testSetGetForeignKey()
QCOMPARE( spy.count(), 3 );
}


// Test issue https://github.com/qgis/QGIS/issues/29884
// Relation reference widget wrong feature when "on map identification"
void TestQgsRelationReferenceWidget::testIdentifyOnMap()
Expand Down Expand Up @@ -396,9 +411,9 @@ class DummyVectorLayerTools : public QgsVectorLayerTools // clazy:exclude=missin

bool startEditing( QgsVectorLayer * ) const override {return true;}

bool stopEditing( QgsVectorLayer *, bool = true ) const override {return true;};
bool stopEditing( QgsVectorLayer *, bool = true ) const override {return true;}

bool saveEdits( QgsVectorLayer * ) const override {return true;};
bool saveEdits( QgsVectorLayer * ) const override {return true;}
};

void TestQgsRelationReferenceWidget::testAddEntry()
Expand Down

0 comments on commit 4b4d902

Please sign in to comment.