Skip to content
Permalink
Browse files

Follow up addition of new units

  • Loading branch information
nyalldawson committed Mar 8, 2017
1 parent 9fd7555 commit 95040c1b42a9d5ab8e1090d76e7c8cbbf68de6e5
Showing with 16 additions and 4 deletions.
  1. +4 −4 src/core/qgsunittypes.cpp
  2. +12 −0 tests/src/python/test_qgsunittypes.py
@@ -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" );
@@ -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 ) )
@@ -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
}
@@ -48,6 +50,8 @@ def testEncodeDecodeDistanceUnits(self):
QgsUnitTypes.DistanceYards,
QgsUnitTypes.DistanceMiles,
QgsUnitTypes.DistanceDegrees,
QgsUnitTypes.DistanceCentimeters,
QgsUnitTypes.DistanceMillimeters,
QgsUnitTypes.DistanceUnknownUnit,
QgsUnitTypes.DistanceNauticalMiles]

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

@@ -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,
}

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

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

for u in units:

0 comments on commit 95040c1

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