Skip to content

Commit

Permalink
(Hopefully) Fix Qt6 test!
Browse files Browse the repository at this point in the history
  • Loading branch information
gacarrillor committed May 17, 2024
1 parent 105811b commit 66605dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions tests/src/python/test_qgsprofilesourceregistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def renderResults(self, context):
if not painter:
return

painter.setBrush(Qt.NoBrush)
painter.setPen(Qt.NoPen)
painter.setBrush(Qt.BrushStyle.NoBrush)
painter.setPen(Qt.PenStyle.NoPen)

minDistance = context.distanceRange().lower()
maxDistance = context.distanceRange().upper()
Expand Down Expand Up @@ -196,7 +196,7 @@ def createProfileGenerator(self, request):

class TestQgsProfileSourceRegistry(QgisTestCase):

def _test_register_unregister_source(self):
def test_register_unregister_source(self):
initial_sources = QgsApplication.profileSourceRegistry().profileSources()

source = MyProfileSource()
Expand All @@ -212,7 +212,7 @@ def _test_register_unregister_source(self):
initial_sources
)

def _test_generate_profile_from_custom_source(self):
def test_generate_profile_from_custom_source(self):
curve = QgsLineString()
curve.fromWkt("LINESTRING (2584085.816 1216473.232, 2579969.567 1218027.326, 2576819.377 1220589.481)")
req = QgsProfileRequest(curve)
Expand Down Expand Up @@ -244,7 +244,7 @@ def _test_generate_profile_from_custom_source(self):
self.assertIn(d, results.distance_to_height)
self.assertEqual(feature.attributes["elevation"], results.distance_to_height[d])

def _test_export_3d_from_custom_source(self):
def test_export_3d_from_custom_source(self):
source = MyProfileSource()
curve = QgsLineString()
curve.fromWkt("LINESTRING (2584085.816 1216473.232, 2579969.567 1218027.326, 2576819.377 1220589.481)")
Expand All @@ -265,7 +265,7 @@ def _test_export_3d_from_custom_source(self):
z = feature.geometry().constGet().z()
self.assertEqual(z, expected_z[i])

def _test_export_2d_from_custom_source(self):
def test_export_2d_from_custom_source(self):
source = MyProfileSource()
curve = QgsLineString()
curve.fromWkt("LINESTRING (2584085.816 1216473.232, 2579969.567 1218027.326, 2576819.377 1220589.481)")
Expand Down Expand Up @@ -293,7 +293,7 @@ def _test_export_2d_from_custom_source(self):
z = geom.y()
self.assertEqual(z, expected_values[d])

def _test_export_distance_elevation_from_custom_source(self):
def test_export_distance_elevation_from_custom_source(self):
source = MyProfileSource()
curve = QgsLineString()
curve.fromWkt("LINESTRING (2584085.816 1216473.232, 2579969.567 1218027.326, 2576819.377 1220589.481)")
Expand Down Expand Up @@ -324,7 +324,7 @@ def _test_export_distance_elevation_from_custom_source(self):
self.assertIn(feature["distance"], expected_values)
self.assertEqual(expected_values[feature["distance"]], feature["elevation"])

def _test_profile_canvas_custom_source(self):
def test_profile_canvas_custom_source(self):
canvas = QgsElevationProfileCanvas()
canvas.setProject(QgsProject.instance())
canvas.setCrs(QgsCoordinateReferenceSystem("EPSG:2056"))
Expand Down Expand Up @@ -403,7 +403,6 @@ def test_layout_item_profile_custom_source(self):
self.assertTrue(
self.render_layout_check('custom_profile', layout)
)
layout = None
QgsApplication.profileSourceRegistry().unregisterProfileSource(source)


Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 66605dc

Please sign in to comment.