Skip to content

Commit

Permalink
fix datastream and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Apr 22, 2024
1 parent ac830ff commit 39e6dbd
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion python/PyQt6/core/auto_additions/qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3218,7 +3218,7 @@
Qgis.FieldDomainDuplicatePolicy.DefaultValue.__doc__ = "Use default field value"
Qgis.FieldDomainDuplicatePolicy.Duplicate.__doc__ = "Duplicate original value"
Qgis.FieldDomainDuplicatePolicy.UnsetField.__doc__ = "Clears the field value so that the data provider backend will populate using any backend triggers or similar logic (since QGIS 3.30)"
Qgis.FieldDomainDuplicatePolicy.__doc__ = "Duplicate policy for field domains.\n\nWhen a feature is duplicated, defines how the value of attributes\nfollowing the domain are computed.\n\n.. versionadded:: 3.38\n\n" + '* ``DefaultValue``: ' + Qgis.FieldDomainDuplicatePolicy.DefaultValue.__doc__ + '\n' + '* ``Duplicate``: ' + Qgis.FieldDomainDuplicatePolicy.Duplicate.__doc__ + '\n' + '* ``UnsetField``: ' + Qgis.FieldDomainDuplicatePolicy.UnsetField.__doc__
Qgis.FieldDomainDuplicatePolicy.__doc__ = "Duplicate policy for fields.\n\nWhen a feature is duplicated, defines how the value of attributes\nfollowing the domain are computed.\n\n.. versionadded:: 3.38\n\n" + '* ``DefaultValue``: ' + Qgis.FieldDomainDuplicatePolicy.DefaultValue.__doc__ + '\n' + '* ``Duplicate``: ' + Qgis.FieldDomainDuplicatePolicy.Duplicate.__doc__ + '\n' + '* ``UnsetField``: ' + Qgis.FieldDomainDuplicatePolicy.UnsetField.__doc__
# --
Qgis.FieldDomainDuplicatePolicy.baseClass = Qgis
# monkey patching scoped based enum
Expand Down
2 changes: 1 addition & 1 deletion python/core/auto_additions/qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3163,7 +3163,7 @@
Qgis.FieldDomainDuplicatePolicy.DefaultValue.__doc__ = "Use default field value"
Qgis.FieldDomainDuplicatePolicy.Duplicate.__doc__ = "Duplicate original value"
Qgis.FieldDomainDuplicatePolicy.UnsetField.__doc__ = "Clears the field value so that the data provider backend will populate using any backend triggers or similar logic (since QGIS 3.30)"
Qgis.FieldDomainDuplicatePolicy.__doc__ = "Duplicate policy for field domains.\n\nWhen a feature is duplicated, defines how the value of attributes\nfollowing the domain are computed.\n\n.. versionadded:: 3.38\n\n" + '* ``DefaultValue``: ' + Qgis.FieldDomainDuplicatePolicy.DefaultValue.__doc__ + '\n' + '* ``Duplicate``: ' + Qgis.FieldDomainDuplicatePolicy.Duplicate.__doc__ + '\n' + '* ``UnsetField``: ' + Qgis.FieldDomainDuplicatePolicy.UnsetField.__doc__
Qgis.FieldDomainDuplicatePolicy.__doc__ = "Duplicate policy for fields.\n\nWhen a feature is duplicated, defines how the value of attributes\nfollowing the domain are computed.\n\n.. versionadded:: 3.38\n\n" + '* ``DefaultValue``: ' + Qgis.FieldDomainDuplicatePolicy.DefaultValue.__doc__ + '\n' + '* ``Duplicate``: ' + Qgis.FieldDomainDuplicatePolicy.Duplicate.__doc__ + '\n' + '* ``UnsetField``: ' + Qgis.FieldDomainDuplicatePolicy.UnsetField.__doc__
# --
Qgis.FieldDomainDuplicatePolicy.baseClass = Qgis
# monkey patching scoped based enum
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgis.h
Original file line number Diff line number Diff line change
Expand Up @@ -3219,7 +3219,7 @@ class CORE_EXPORT Qgis
Q_ENUM( FieldDomainMergePolicy )

/**
* Duplicate policy for field domains.
* Duplicate policy for fields.
*
* When a feature is duplicated, defines how the value of attributes
* following the domain are computed.
Expand Down
1 change: 1 addition & 0 deletions src/core/qgsfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ QDataStream &operator<<( QDataStream &out, const QgsField &field )
out << field.constraints().constraintDescription();
out << static_cast< quint32 >( field.subType() );
out << static_cast< int >( field.splitPolicy() );
out << static_cast< int >( field.duplicatePolicy() );
out << field.metadata();
return out;
}
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgsfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,7 @@ void TestQgsField::dataStream()
original.setAlias( QStringLiteral( "alias" ) );
original.setDefaultValueDefinition( QgsDefaultValue( QStringLiteral( "default" ) ) );
original.setSplitPolicy( Qgis::FieldDomainSplitPolicy::GeometryRatio );
original.setDuplicatePolicy( Qgis::FieldDomainDuplicatePolicy::DefaultValue );
QgsFieldConstraints constraints;
constraints.setConstraint( QgsFieldConstraints::ConstraintNotNull, QgsFieldConstraints::ConstraintOriginProvider );
constraints.setConstraint( QgsFieldConstraints::ConstraintUnique, QgsFieldConstraints::ConstraintOriginLayer );
Expand Down
18 changes: 9 additions & 9 deletions tests/src/python/test_qgsvectorlayerutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,27 +646,27 @@ def testDuplicateFeature(self):
# > and duplicate policy is concerned
result_feature = results[0]
self.assertEqual(result_feature.attribute('fldtxt'), l1f1orig.attribute('fldtxt'))
self.assertEqual(result_feature.attribute('policycheck1value'), 'Orig Blabla L1') # duplicated
self.assertEqual(result_feature.attribute('policycheck2value'), 'Def Blabla L1') # default Value
self.assertEqual(result_feature.attribute('policycheck3value'), None) # unset
self.assertEqual(result_feature.attribute('policycheck1value'), 'Orig Blabla L1') # duplicated
self.assertEqual(result_feature.attribute('policycheck2value'), 'Def Blabla L1') # default Value
self.assertEqual(result_feature.attribute('policycheck3value'), None) # unset
# > check duplicated children occurred on both layers
self.assertEqual(len(results[1].layers()), 2)
idx = results[1].layers().index(layer2)
self.assertEqual(results[1].layers()[idx], layer2)
self.assertTrue(results[1].duplicatedFeatures(layer2))
for child_fid in results[1].duplicatedFeatures(layer2):
child_feature = layer2.getFeature(child_fid)
self.assertEqual(child_feature.attribute('policycheck1value'), 'Orig Blabla L2') # duplicated
self.assertEqual(child_feature.attribute('policycheck2value'), 'Def Blabla L2') # default Value
self.assertEqual(child_feature.attribute('policycheck3value'), None) # unset
self.assertEqual(child_feature.attribute('policycheck1value'), 'Orig Blabla L2') # duplicated
self.assertEqual(child_feature.attribute('policycheck2value'), 'Def Blabla L2') # default Value
self.assertEqual(child_feature.attribute('policycheck3value'), None) # unset
idx = results[1].layers().index(layer3)
self.assertEqual(results[1].layers()[idx], layer3)
self.assertTrue(results[1].duplicatedFeatures(layer3))
for child_fid in results[1].duplicatedFeatures(layer3):
child_feature = layer3.getFeature(child_fid)
self.assertEqual(child_feature.attribute('policycheck1value'), 'Orig Blabla L3') # duplicated
self.assertEqual(child_feature.attribute('policycheck2value'), 'Def Blabla L3') # default Value
self.assertEqual(child_feature.attribute('policycheck3value'), None) # unset
self.assertEqual(child_feature.attribute('policycheck1value'), 'Orig Blabla L3') # duplicated
self.assertEqual(child_feature.attribute('policycheck2value'), 'Def Blabla L3') # default Value
self.assertEqual(child_feature.attribute('policycheck3value'), None) # unset

'''
# testoutput 2
Expand Down

0 comments on commit 39e6dbd

Please sign in to comment.