Skip to content
Permalink
Browse files
Fix logic
  • Loading branch information
nyalldawson committed Jul 12, 2021
1 parent 98178e1 commit 0a74c979662a0a6f385c64e68c77b52069152fba
Showing with 3 additions and 3 deletions.
  1. +1 −1 src/core/providers/qgsproviderutils.cpp
  2. +2 −2 tests/src/python/test_qgsproviderutils.py
@@ -25,7 +25,7 @@ bool QgsProviderUtils::sublayerDetailsAreIncomplete( const QList<QgsProviderSubl
{
case QgsMapLayerType::VectorLayer:
if ( sublayer.wkbType() == QgsWkbTypes::Unknown
|| ( ignoreUnknownFeatureCount &&
|| ( !ignoreUnknownFeatureCount &&
( sublayer.featureCount() == static_cast< long long >( Qgis::FeatureCountState::Uncounted )
|| sublayer.featureCount() == static_cast< long long >( Qgis::FeatureCountState::UnknownCount ) ) ) )
return true;
@@ -64,9 +64,9 @@ def test_sublayerDetailsAreIncomplete(self):
self.assertEqual(sublayers[3].featureCount(), Qgis.FeatureCountState.Uncounted)

# need to count features for complete details about this uri!
self.assertTrue(QgsProviderUtils.sublayerDetailsAreIncomplete(sublayers, True))
self.assertTrue(QgsProviderUtils.sublayerDetailsAreIncomplete(sublayers, False))
# ...unless we are ignoring unknown feature counts, that is...
self.assertFalse(QgsProviderUtils.sublayerDetailsAreIncomplete(sublayers, False))
self.assertFalse(QgsProviderUtils.sublayerDetailsAreIncomplete(sublayers, True))

# retry with retrieving feature count
sublayers = QgsProviderRegistry.instance().querySublayers(uri, Qgis.SublayerQueryFlag.CountFeatures)

0 comments on commit 0a74c97

Please sign in to comment.