Skip to content

Commit

Permalink
Implement QEP 17 - add "requires tests" comments to some classes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 14, 2015
1 parent d699569 commit ee44bc8
Show file tree
Hide file tree
Showing 10 changed files with 214 additions and 4 deletions.
30 changes: 30 additions & 0 deletions src/core/geometry/qgswkbtypes.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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( ' ' );
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/core/geometry/qgswkbtypes.h
Expand Up @@ -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.
Expand Down
43 changes: 41 additions & 2 deletions src/core/qgsfeature.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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
{
Expand All @@ -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() )
Expand All @@ -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 );
Expand Down Expand Up @@ -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 );
Expand All @@ -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 );
Expand Down
11 changes: 11 additions & 0 deletions src/core/qgsfeature.h
Expand Up @@ -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>.
*/
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions src/core/qgsfeature_p.h
Expand Up @@ -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"
Expand Down
72 changes: 71 additions & 1 deletion src/core/qgsfield.cpp
Expand Up @@ -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,
Expand All @@ -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()
{
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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() )
Expand All @@ -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() )
Expand Down Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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( );
Expand Down Expand Up @@ -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() ) )
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 )
Expand All @@ -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();
Expand Down

0 comments on commit ee44bc8

Please sign in to comment.