From a1dbb5db8ecb93d2476c574d5960b04b80ab9258 Mon Sep 17 00:00:00 2001 From: Pierre Laborde Date: Tue, 2 Dec 2025 11:18:28 +0100 Subject: [PATCH] Add valid test on BoundingBox + unit test --- .../GeoToolsBoundingBoxTest.class.st | 15 +++++++++++++++ src/GeoTools/TGeoToolsBoundingBox.trait.st | 9 +++++++++ 2 files changed, 24 insertions(+) diff --git a/src/GeoTools-Tests/GeoToolsBoundingBoxTest.class.st b/src/GeoTools-Tests/GeoToolsBoundingBoxTest.class.st index 02d09ab..9cb6476 100644 --- a/src/GeoTools-Tests/GeoToolsBoundingBoxTest.class.st +++ b/src/GeoTools-Tests/GeoToolsBoundingBoxTest.class.st @@ -153,6 +153,21 @@ GeoToolsBoundingBoxTest >> testCenterAbsoluteCoordinates [ self assert: boundingBox centerAbsoluteCoordinates longitudeInDegrees equals: 0. ] +{ #category : #tests } +GeoToolsBoundingBoxTest >> testIsValid [ + + self deny: boundingBox isValid. + + self setUpZeroBox. + self assert: boundingBox isValid. + + self setUpSmallBox. + self assert: boundingBox isValid. + + self setUpTopRightSmallBox. + self assert: boundingBox isValid +] + { #category : #tests } GeoToolsBoundingBoxTest >> testLeftLongitudeInDegrees [ diff --git a/src/GeoTools/TGeoToolsBoundingBox.trait.st b/src/GeoTools/TGeoToolsBoundingBox.trait.st index 39156e0..a9e3dc0 100644 --- a/src/GeoTools/TGeoToolsBoundingBox.trait.st +++ b/src/GeoTools/TGeoToolsBoundingBox.trait.st @@ -90,6 +90,15 @@ TGeoToolsBoundingBox >> centerAbsoluteCoordinates [ longitudeInDegrees: longitude ] +{ #category : #testing } +TGeoToolsBoundingBox >> isValid [ + + ^ (self topLeftAbsoluteCoordinates notNil and: [ + self topLeftAbsoluteCoordinates isValid ]) and: [ + self bottomRightAbsoluteCoordinates notNil and: [ + self bottomRightAbsoluteCoordinates isValid ] ] +] + { #category : #accessing } TGeoToolsBoundingBox >> leftLongitudeInDegrees [