From 6f4bd24426185650d5a5e386eb626f2a98c85322 Mon Sep 17 00:00:00 2001 From: Jeff Osundwa Date: Tue, 17 Sep 2024 00:11:36 +0300 Subject: [PATCH] fix for test_index_score --- test/test_index_score.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/test_index_score.py b/test/test_index_score.py index d903adf8..91eaa346 100644 --- a/test/test_index_score.py +++ b/test/test_index_score.py @@ -3,9 +3,9 @@ from qgis.core import ( QgsVectorLayer, QgsCoordinateReferenceSystem, - QgsRectangle, - QgsApplication, + QgsProcessingFeedback, ) +import processing from qgis_gender_indicator_tool.jobs.index_score import RasterizeIndexScoreValue @@ -27,6 +27,19 @@ def test_generate_raster(self): # Load the country boundary layer country_boundary = QgsVectorLayer(boundary_path, "test_boundary", "ogr") self.assertTrue(country_boundary.isValid(), "The boundary layer is not valid.") + + # Reproject the vector layer if necessary + if country_boundary.crs() != self.utm_crs: + reprojected_result = processing.run( + "native:reprojectlayer", + { + "INPUT": country_boundary, + "TARGET_CRS": self.utm_crs, + "OUTPUT": "memory:", + }, + feedback=QgsProcessingFeedback(), + ) + country_boundary = reprojected_result["OUTPUT"] # Define bbox and CRS bbox = country_boundary.extent()