Implement QEP 17 - add "requires tests" comments to some classes

This commit is contained in:
Nyall Dawson 2015-11-14 20:15:39 +11:00
parent d699569b86
commit ee44bc8925
10 changed files with 214 additions and 4 deletions

View File

@ -17,6 +17,12 @@
#include "qgswkbtypes.h"
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests.
* See details in QEP #17
****************************************************************************/
QMap<QgsWKBTypes::Type, QgsWKBTypes::wkbEntry>* QgsWKBTypes::entries()
{
static QMap<QgsWKBTypes::Type, QgsWKBTypes::wkbEntry> entries = registerTypes();
@ -53,6 +59,12 @@ QgsWKBTypes::Type QgsWKBTypes::flatType( Type type )
return it->mFlatType;
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests.
* See details in QEP #17
****************************************************************************/
QgsWKBTypes::Type QgsWKBTypes::parseType( const QString &wktStr )
{
QString typestr = wktStr.left( wktStr.indexOf( '(' ) ).simplified().remove( ' ' );
@ -82,6 +94,12 @@ bool QgsWKBTypes::isMultiType( Type type )
return it->mIsMultiType;
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests.
* See details in QEP #17
****************************************************************************/
int QgsWKBTypes::wkbDimensions( Type type )
{
GeometryType gtype = geometryType( type );
@ -129,6 +147,12 @@ QString QgsWKBTypes::displayString( Type type )
return it->mName;
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests.
* See details in QEP #17
****************************************************************************/
bool QgsWKBTypes::hasZ( Type type )
{
QMap< Type, wkbEntry >::const_iterator it = entries()->constFind( type );
@ -190,6 +214,12 @@ QgsWKBTypes::Type QgsWKBTypes::addM( QgsWKBTypes::Type type )
return ( QgsWKBTypes::Type )( flat + 2000 );
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests.
* See details in QEP #17
****************************************************************************/
QMap<QgsWKBTypes::Type, QgsWKBTypes::wkbEntry> QgsWKBTypes::registerTypes()
{
QMap<QgsWKBTypes::Type, QgsWKBTypes::wkbEntry> entries;

View File

@ -21,6 +21,12 @@
#include <QMap>
#include <QString>
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsstatisticalsummary.cpp.
* See details in QEP #17
****************************************************************************/
/** \ingroup core
* \class QgsWKBTypes
* \brief Handles storage of information regarding WKB types and their properties.

View File

@ -23,6 +23,12 @@ email : sherman at mrcc.com
#include <QDataStream>
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfeature.cpp.
* See details in QEP #17
****************************************************************************/
QgsFeature::QgsFeature( QgsFeatureId id )
{
d = new QgsFeaturePrivate( id );
@ -50,6 +56,12 @@ QgsFeature::~QgsFeature()
{
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfeature.cpp.
* See details in QEP #17
****************************************************************************/
QgsFeatureId QgsFeature::id() const
{
return d->fid;
@ -80,6 +92,12 @@ QgsGeometry *QgsFeature::geometryAndOwnership()
return d->geometry;
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfeature.cpp.
* See details in QEP #17
****************************************************************************/
void QgsFeature::setFeatureId( QgsFeatureId id )
{
if ( id == d->fid )
@ -137,6 +155,12 @@ void QgsFeature::setGeometry( QgsGeometry* geom )
d->ownsGeometry = true;
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfeature.cpp.
* See details in QEP #17
****************************************************************************/
/** Set the pointer to the feature geometry
*/
void QgsFeature::setGeometryAndOwnership( unsigned char *geom, size_t length )
@ -166,6 +190,11 @@ const QgsFields *QgsFeature::fields() const
return &( d->fields );
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfeature.cpp.
* See details in QEP #17
****************************************************************************/
bool QgsFeature::isValid() const
{
@ -190,7 +219,6 @@ void QgsFeature::initAttributes( int fieldCount )
ptr->clear();
}
bool QgsFeature::setAttribute( int idx, const QVariant &value )
{
if ( idx < 0 || idx >= d->attributes.size() )
@ -204,6 +232,12 @@ bool QgsFeature::setAttribute( int idx, const QVariant &value )
return true;
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfeature.cpp.
* See details in QEP #17
****************************************************************************/
bool QgsFeature::setAttribute( const QString& name, const QVariant& value )
{
int fieldIdx = fieldNameIndex( name );
@ -234,7 +268,6 @@ QVariant QgsFeature::attribute( int fieldIdx ) const
return d->attributes.at( fieldIdx );
}
QVariant QgsFeature::attribute( const QString& name ) const
{
int fieldIdx = fieldNameIndex( name );
@ -244,6 +277,12 @@ QVariant QgsFeature::attribute( const QString& name ) const
return d->attributes.at( fieldIdx );
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfeature.cpp.
* See details in QEP #17
****************************************************************************/
int QgsFeature::fieldNameIndex( const QString& fieldName ) const
{
return d->fields.fieldNameIndex( fieldName );

View File

@ -103,6 +103,12 @@ typedef int QgsFeatureId;
// key = field index, value = field value
typedef QMap<int, QVariant> QgsAttributeMap;
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfeature.cpp.
* See details in QEP #17
****************************************************************************/
/**
* A vector of attributes. Mostly equal to QVector<QVariant>.
*/
@ -166,6 +172,11 @@ class QgsField;
#include "qgsfield.h"
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfeature.cpp.
* See details in QEP #17
****************************************************************************/
/** \ingroup core
* The feature class encapsulates a single feature including its id,

View File

@ -27,6 +27,12 @@ email : nyall dot dawson at gmail dot com
// version without notice, or even be removed.
//
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfeature.cpp.
* See details in QEP #17
****************************************************************************/
#include "qgsfield.h"
#include "qgsgeometry.h"

View File

@ -22,6 +22,11 @@
#include <QDataStream>
#include <QtCore/qmath.h>
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfield.cpp.
* See details in QEP #17
****************************************************************************/
#if 0
QgsField::QgsField( QString nam, QString typ, int len, int prec, bool num,
@ -48,13 +53,18 @@ QgsField::QgsField( const QgsField &other )
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfield.cpp.
* See details in QEP #17
****************************************************************************/
QgsField &QgsField::operator =( const QgsField & other )
{
d = other.d;
return *this;
}
QgsField::~QgsField()
{
}
@ -99,6 +109,12 @@ QString QgsField::comment() const
return d->comment;
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfield.cpp.
* See details in QEP #17
****************************************************************************/
void QgsField::setName( const QString& name )
{
d->name = name;
@ -128,6 +144,12 @@ void QgsField::setComment( const QString& comment )
d->comment = comment;
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfield.cpp.
* See details in QEP #17
****************************************************************************/
QString QgsField::displayString( const QVariant& v ) const
{
if ( v.isNull() )
@ -142,6 +164,12 @@ QString QgsField::displayString( const QVariant& v ) const
return v.toString();
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfield.cpp.
* See details in QEP #17
****************************************************************************/
bool QgsField::convertCompatible( QVariant& v ) const
{
if ( v.isNull() )
@ -203,6 +231,11 @@ bool QgsField::convertCompatible( QVariant& v ) const
return true;
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfield.cpp.
* See details in QEP #17
****************************************************************************/
QDataStream& operator<<( QDataStream& out, const QgsField& field )
{
@ -231,6 +264,13 @@ QDataStream& operator>>( QDataStream& in, QgsField& field )
////////////////////////////////////////////////////////////////////////////
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfields.cpp.
* See details in QEP #17
****************************************************************************/
QgsFields::QgsFields()
{
d = new QgsFieldsPrivate( );
@ -258,6 +298,12 @@ void QgsFields::clear()
d->nameToIndex.clear();
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfields.cpp.
* See details in QEP #17
****************************************************************************/
bool QgsFields::append( const QgsField& field, FieldOrigin origin, int originIndex )
{
if ( d->nameToIndex.contains( field.name() ) )
@ -303,6 +349,12 @@ void QgsFields::extend( const QgsFields& other )
}
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfields.cpp.
* See details in QEP #17
****************************************************************************/
bool QgsFields::isEmpty() const
{
return d->fields.isEmpty();
@ -343,6 +395,12 @@ const QgsField &QgsFields::field( const QString &name ) const
return d->fields[ indexFromName( name )].field;
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfields.cpp.
* See details in QEP #17
****************************************************************************/
const QgsField &QgsFields::operator[]( int i ) const
{
return d->fields[i].field;
@ -379,6 +437,12 @@ bool QgsFields::operator==( const QgsFields &other ) const
return d->fields == other.d->fields;
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfields.cpp.
* See details in QEP #17
****************************************************************************/
int QgsFields::fieldNameIndex( const QString& fieldName ) const
{
for ( int idx = 0; idx < count(); ++idx )
@ -404,6 +468,12 @@ QgsAttributeList QgsFields::allAttributesList() const
return lst;
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfields.cpp.
* See details in QEP #17
****************************************************************************/
QDataStream& operator<<( QDataStream& out, const QgsFields& fields )
{
out << ( quint32 )fields.size();

View File

@ -27,7 +27,11 @@ class QgsExpression;
class QgsFieldPrivate;
class QgsFieldsPrivate;
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfield.cpp.
* See details in QEP #17
****************************************************************************/
/** \class QgsField
* \ingroup core
@ -165,6 +169,14 @@ CORE_EXPORT QDataStream& operator<<( QDataStream& out, const QgsField& field );
/** Reads a field from stream in into field. QGIS version compatibility is not guaranteed. */
CORE_EXPORT QDataStream& operator>>( QDataStream& in, QgsField& field );
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfields.cpp.
* See details in QEP #17
****************************************************************************/
/** \class QgsFields
* \ingroup core
* Container of fields for a vector layer.

View File

@ -32,6 +32,12 @@
#include <QSharedData>
#include "qgsfield.h"
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfield.cpp.
* See details in QEP #17
****************************************************************************/
class QgsFieldPrivate : public QSharedData
{
public:
@ -90,6 +96,12 @@ class QgsFieldPrivate : public QSharedData
};
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsfields.cpp.
* See details in QEP #17
****************************************************************************/
class CORE_EXPORT QgsFieldsPrivate : public QSharedData
{
public:

View File

@ -19,6 +19,12 @@
#include <QString>
#include <QObject>
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsstatisticalsummary.cpp.
* See details in QEP #17
****************************************************************************/
QgsStatisticalSummary::QgsStatisticalSummary( const Statistics& stats )
: mStatistics( stats )
{
@ -47,6 +53,12 @@ void QgsStatisticalSummary::reset()
mValueCount.clear();
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsstatisticalsummary.cpp.
* See details in QEP #17
****************************************************************************/
void QgsStatisticalSummary::calculate( const QList<double> &values )
{
reset();
@ -176,6 +188,12 @@ void QgsStatisticalSummary::calculate( const QList<double> &values )
}
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsstatisticalsummary.cpp.
* See details in QEP #17
****************************************************************************/
double QgsStatisticalSummary::statistic( QgsStatisticalSummary::Statistic stat ) const
{
switch ( stat )

View File

@ -18,6 +18,12 @@
#include <QMap>
/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests in testqgsstatisticalsummary.cpp.
* See details in QEP #17
****************************************************************************/
/** \ingroup core
* \class QgsStatisticalSummary
* \brief Calculator for summary statistics for a list of doubles.