Skip to content

Commit

Permalink
Revert "Debug commit, should be reverted"
Browse files Browse the repository at this point in the history
This reverts commit 703555a and ff6e625.
  • Loading branch information
suricactus committed Jan 20, 2021
1 parent ff6e625 commit 21e3afe
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
12 changes: 1 addition & 11 deletions src/gui/qgsabstractrelationeditorwidget.cpp
Expand Up @@ -27,7 +27,6 @@
#include "qgsproject.h"
#include "qgstransactiongroup.h"
#include "qgsvectorlayerutils.h"
#include "qgsmessagelog.h"

#include <QMessageBox>
#include <QPushButton>
Expand Down Expand Up @@ -259,17 +258,8 @@ void QgsAbstractRelationEditorWidget::addFeature( const QgsGeometry &geometry )
for ( const QgsRelation::FieldPair &fieldPair : constFieldPairs )
{
keyAttrs.insert( fields.indexFromName( fieldPair.referencingField() ), mFeature.attribute( fieldPair.referencedField() ) );
Q_ASSERT( vlTools->addFeature( mRelation.referencingLayer(), keyAttrs, geometry ) );
}

QgsMessageLog::logMessage( QStringLiteral( "ADDED FEATURES1 %1 %2" ).arg( mRelation.referencingLayer()->name() ).arg( mRelation.referencingLayer()->featureCount() ) );

bool success = vlTools->addFeature( mRelation.referencingLayer(), keyAttrs, geometry );
Q_ASSERT( success );
QgsMessageLog::logMessage( QStringLiteral( "SUCESS??? %1" ).arg( success ) );

QgsMessageLog::logMessage( QStringLiteral( "ADDED FEATURES2 %1 %2" ).arg( mRelation.referencingLayer()->name() ).arg( mRelation.referencingLayer()->featureCount() ) );
mRelation.referencingLayer()->dataProvider()->reloadData();
QgsMessageLog::logMessage( QStringLiteral( "ADDED FEATURES3 %1 %2" ).arg( mRelation.referencingLayer()->name() ).arg( mRelation.referencingLayer()->featureCount() ) );
}
}

Expand Down
15 changes: 0 additions & 15 deletions tests/src/python/test_qgsrelationeditwidget.py
Expand Up @@ -330,21 +330,14 @@ def addFeature(self, layer, defaultValues, defaultGeometry):
table_view = widget.findChild(QTableView)
self.assertEqual(table_view.model().rowCount(), 1)

vl_leaks.raiseError.connect(TestQgsRelationEditWidget.error_raised)
vl_leaks.featureAdded.connect(TestQgsRelationEditWidget.feature_added)

btn = widget.findChild(QToolButton, 'mAddFeatureGeometryButton')
self.assertTrue(btn.isVisible())
self.assertTrue(btn.isEnabled())
btn.click()
self.assertTrue(self.mapCanvas.mapTool())
feature = QgsFeature(vl_leaks.fields())
feature.setGeometry(QgsGeometry.fromWkt('POINT(0 0.8)'))
for f in vl_leaks.getFeatures():
print('FEATURE_ID ONE: ', f.id(), f.geometry())
self.mapCanvas.mapTool().digitizingCompleted.emit(feature)
for f in vl_leaks.getFeatures():
print('FEATURE_ID TWO: ', f.id(), f.geometry())
self.assertEqual(table_view.model().rowCount(), 2)
self.assertEqual(vl_leaks.featureCount(), 4)
request = QgsFeatureRequest()
Expand All @@ -357,14 +350,6 @@ def addFeature(self, layer, defaultValues, defaultGeometry):

vl_leaks.rollBack()

@classmethod
def error_raised(cls, msg):
print("LAYER ERROR RAISED: ", len(msg), msg)

@classmethod
def feature_added(cls, fid):
print("LAYER FEATURE ADDDED: ", fid)

def startTransaction(self):
"""
Start a new transaction and set all layers into transaction mode.
Expand Down

0 comments on commit 21e3afe

Please sign in to comment.