Skip to content

Commit

Permalink
Follow up addition of new units
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 8, 2017
1 parent 9fd7555 commit 95040c1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/qgsunittypes.cpp
Expand Up @@ -172,10 +172,10 @@ QString QgsUnitTypes::toString( DistanceUnit unit )
return QObject::tr( "degrees", "distance" );

case DistanceCentimeters:
return QObject::tr( "UnitType", "centimeters" );
return QObject::tr( "centimeters", "distance" );

case DistanceMillimeters:
return QObject::tr( "UnitType", "millimeters" );
return QObject::tr( "millimeters", "distance" );

case DistanceUnknownUnit:
return QObject::tr( "<unknown>", "distance" );
Expand Down Expand Up @@ -250,8 +250,8 @@ QgsUnitTypes::DistanceUnit QgsUnitTypes::stringToDistanceUnit( const QString &st
return DistanceDegrees;
if ( normalized == toString( DistanceCentimeters ) )
return DistanceCentimeters;
if ( normalized == toString( DistanceCentimeters ) )
return DistanceCentimeters;
if ( normalized == toString( DistanceMillimeters ) )
return DistanceMillimeters;
if ( normalized == toString( DistanceNauticalMiles ) )
return DistanceNauticalMiles;
if ( normalized == toString( DistanceUnknownUnit ) )
Expand Down
12 changes: 12 additions & 0 deletions tests/src/python/test_qgsunittypes.py
Expand Up @@ -33,6 +33,8 @@ def testDistanceUnitType(self):
QgsUnitTypes.DistanceYards: QgsUnitTypes.Standard,
QgsUnitTypes.DistanceMiles: QgsUnitTypes.Standard,
QgsUnitTypes.DistanceDegrees: QgsUnitTypes.Geographic,
QgsUnitTypes.DistanceCentimeters: QgsUnitTypes.Standard,
QgsUnitTypes.DistanceMillimeters: QgsUnitTypes.Standard,
QgsUnitTypes.DistanceUnknownUnit: QgsUnitTypes.UnknownType,
QgsUnitTypes.DistanceNauticalMiles: QgsUnitTypes.Standard
}
Expand All @@ -48,6 +50,8 @@ def testEncodeDecodeDistanceUnits(self):
QgsUnitTypes.DistanceYards,
QgsUnitTypes.DistanceMiles,
QgsUnitTypes.DistanceDegrees,
QgsUnitTypes.DistanceCentimeters,
QgsUnitTypes.DistanceMillimeters,
QgsUnitTypes.DistanceUnknownUnit,
QgsUnitTypes.DistanceNauticalMiles]

Expand All @@ -74,6 +78,8 @@ def testDistanceUnitsToFromString(self):
QgsUnitTypes.DistanceYards,
QgsUnitTypes.DistanceMiles,
QgsUnitTypes.DistanceDegrees,
QgsUnitTypes.DistanceCentimeters,
QgsUnitTypes.DistanceMillimeters,
QgsUnitTypes.DistanceUnknownUnit,
QgsUnitTypes.DistanceNauticalMiles]

Expand Down Expand Up @@ -104,6 +110,8 @@ def testAreaUnitType(self):
QgsUnitTypes.AreaAcres: QgsUnitTypes.Standard,
QgsUnitTypes.AreaSquareNauticalMiles: QgsUnitTypes.Standard,
QgsUnitTypes.AreaSquareDegrees: QgsUnitTypes.Geographic,
QgsUnitTypes.AreaSquareCentimeters: QgsUnitTypes.Standard,
QgsUnitTypes.AreaSquareMillimeters: QgsUnitTypes.Standard,
QgsUnitTypes.AreaUnknownUnit: QgsUnitTypes.UnknownType,
}

Expand All @@ -121,6 +129,8 @@ def testEncodeDecodeAreaUnits(self):
QgsUnitTypes.AreaAcres,
QgsUnitTypes.AreaSquareNauticalMiles,
QgsUnitTypes.AreaSquareDegrees,
QgsUnitTypes.AreaSquareCentimeters,
QgsUnitTypes.AreaSquareMillimeters,
QgsUnitTypes.AreaUnknownUnit]

for u in units:
Expand Down Expand Up @@ -149,6 +159,8 @@ def testAreaUnitsToFromString(self):
QgsUnitTypes.AreaAcres,
QgsUnitTypes.AreaSquareNauticalMiles,
QgsUnitTypes.AreaSquareDegrees,
QgsUnitTypes.AreaSquareCentimeters,
QgsUnitTypes.AreaSquareMillimeters,
QgsUnitTypes.AreaUnknownUnit]

for u in units:
Expand Down

0 comments on commit 95040c1

Please sign in to comment.