Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Sep 13, 2024
1 parent 5789ecb commit 842b32b
Showing 1 changed file with 7 additions and 56 deletions.
63 changes: 7 additions & 56 deletions tests/src/python/test_qgsmapboxglconverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,62 +491,13 @@ def testParseExpression(self):
self.assertEqual(QgsMapBoxGlStyleConverter.parseExpression(["in", ["get", "subclass"], ["literal", ["allotments", "forest", "glacier"]]], conversion_context, True), '''"subclass" IN ('allotments', 'forest', 'glacier')''')

# fix last (default) value of a match can be a match
self.assertEqual(QgsMapBoxGlStyleConverter.parseExpression(
[
"match",
[
"get",
"is_route"
],
[
5,
10
],
"hsl(16,91%,80%)",
[
6,
7,
8
],
"hsl(55,91%,80%)",
[
"match",
[
"get",
"class"
],
[
"motorway",
"trunk",
"motorway_construction",
"trunk_construction"
],
"hsl(41,93%,73%)",
[
"rail",
"rail_construction",
"path",
"path_construction",
"footway",
"footway_construction",
"track",
"track_construction",
"trail",
"trail_construction"
],
[
"match",
[
"get",
"subclass"
],
"covered_bridge",
"rgb(255,255,255)",
"rgb(238,238,240)"
],
"rgba(255,255,255,1)"
]
], conversion_context, True), '''CASE WHEN "is_route" IN (5,10) THEN '#fab69e' WHEN "is_route" IN (6,7,8) THEN '#faf39e' ELSE CASE WHEN "class" IN ('motorway','trunk','motorway_construction','trunk_construction') THEN '#fad27a' WHEN "class" IN ('rail','rail_construction','path','path_construction','footway','footway_construction','track','track_construction','trail','trail_construction') THEN '#000000' ELSE '#ffffff' END END''')
self.assertEqual(
QgsMapBoxGlStyleConverter.parseExpression(
["match", ["get", "is_route"], [5, 10], "hsl(16,91%,80%)", [6, 7, 8], "hsl(55,91%,80%)", ["match", ["get", "class"], ["motorway", "trunk", "motorway_construction", "trunk_construction"], "hsl(41,93%,73%)", ["rail", "rail_construction", "path", "path_construction", "footway", "footway_construction", "track", "track_construction", "trail", "trail_construction"], ["match", ["get", "subclass"], "covered_bridge", "rgb(255,255,255)", "rgb(238,238,240)"], "rgba(255,255,255,1)"]],
conversion_context, True
),
'''CASE WHEN "is_route" IN (5, 10) THEN color_rgba(250,182,158,255) WHEN "is_route" IN (6, 7, 8) THEN color_rgba(250,243,158,255) ELSE CASE WHEN "class" IN ('motorway', 'trunk', 'motorway_construction', 'trunk_construction') THEN color_rgba(250,210,122,255) WHEN "class" IN ('rail', 'rail_construction', 'path', 'path_construction', 'footway', 'footway_construction', 'track', 'track_construction', 'trail', 'trail_construction') THEN CASE WHEN ("subclass" = 'covered_bridge') THEN color_rgba(255,255,255,255) ELSE color_rgba(238,238,240,255) END ELSE color_rgba(255,255,255,255) END END'''
)

def testConvertLabels(self):
context = QgsMapBoxGlStyleConversionContext()
Expand Down

0 comments on commit 842b32b

Please sign in to comment.