Skip to content
Permalink
Browse files

Followup 8435fee, fix filtering of NULL values

  • Loading branch information
nyalldawson committed Jan 19, 2016
1 parent d902c56 commit 7e642df52b09ca04ef88d24e5ad1e3ca60abb6d6
@@ -589,7 +589,7 @@ QString QgsCategorizedSymbolRendererV2::filter( const QgsFields& fields )
}
else if ( defaultActive )
{
return QString( "(\"%1\") NOT IN (%2)" ).arg( mAttrName, inactiveValues );
return QString( "(\"%1\") NOT IN (%2) OR (\"%1\") IS NULL" ).arg( mAttrName, inactiveValues );
}
else
{
@@ -62,11 +62,11 @@ def testFilter(self):
self.assertEqual(renderer.filter(), '')
# remove categories, leaving default
assert renderer.updateCategoryRenderState(0, False)
self.assertEqual(renderer.filter(), "(\"field\") NOT IN ('a')")
self.assertEqual(renderer.filter(), "(\"field\") NOT IN ('a') OR (\"field\") IS NULL")
assert renderer.updateCategoryRenderState(1, False)
self.assertEqual(renderer.filter(), "(\"field\") NOT IN ('a','b')")
self.assertEqual(renderer.filter(), "(\"field\") NOT IN ('a','b') OR (\"field\") IS NULL")
assert renderer.updateCategoryRenderState(2, False)
self.assertEqual(renderer.filter(), "(\"field\") NOT IN ('a','b','c')")
self.assertEqual(renderer.filter(), "(\"field\") NOT IN ('a','b','c') OR (\"field\") IS NULL")
# remove default category
assert renderer.updateCategoryRenderState(3, False)
self.assertEqual(renderer.filter(), "FALSE")

0 comments on commit 7e642df

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