Fix sip bindings for QgsStringStatisticalSummary

This commit is contained in:
Nyall Dawson 2016-05-10 20:14:31 +10:00
parent daabda8ca7
commit 7ae80b106d
4 changed files with 8 additions and 4 deletions

View File

@ -59,14 +59,16 @@ class QgsStringStatisticalSummary
/** Calculates summary statistics for a list of strings.
* @param values list of strings
* @see calculateFromVariants()
*/
void calculate( const QStringList& values );
/** Calculates summary statistics for a list of variants. Any non-string variants will be
* ignored.
* @param values list of variants
* @see calculate()
*/
void calculate( const QVariantList& values );
void calculateFromVariants( const QVariantList& values );
/** Returns the value of a specified statistic
* @param stat statistic to return

View File

@ -54,7 +54,7 @@ void QgsStringStatisticalSummary::calculate( const QStringList& values )
}
}
void QgsStringStatisticalSummary::calculate( const QVariantList& values )
void QgsStringStatisticalSummary::calculateFromVariants( const QVariantList& values )
{
reset();

View File

@ -79,14 +79,16 @@ class CORE_EXPORT QgsStringStatisticalSummary
/** Calculates summary statistics for a list of strings.
* @param values list of strings
* @see calculateFromVariants()
*/
void calculate( const QStringList& values );
/** Calculates summary statistics for a list of variants. Any non-string variants will be
* ignored.
* @param values list of variants
* @see calculate()
*/
void calculate( const QVariantList& values );
void calculateFromVariants( const QVariantList& values );
/** Returns the value of a specified statistic
* @param stat statistic to return

View File

@ -67,7 +67,7 @@ class PyQgsStringStatisticalSummary(unittest.TestCase):
def testVariantStats(self):
s = QgsStringStatisticalSummary()
self.assertEqual(s.statistics(), QgsStringStatisticalSummary.All)
s.calculate(['cc', 5, 'bbbb', 'aaaa', 'eeee', 6, 9, '9', ''])
s.calculateFromVariants(['cc', 5, 'bbbb', 'aaaa', 'eeee', 6, 9, '9', ''])
self.assertEqual(s.count(), 6)
self.assertEqual(set(s.distinctValues()), set(['cc', 'aaaa', 'bbbb', 'eeee', '', '9']))
self.assertEqual(s.countMissing(), 1)