def testInterpolateExpression(self): self.assertEqual( QgsMapBoxGlStyleConverter.interpolateExpression(5, 13, 27, 29, 1), '27 + 2 * (1^(@zoom_level-5)-1)/(1^(13-5)-1)') self.assertEqual( QgsMapBoxGlStyleConverter.interpolateExpression( 5, 13, 27, 29, 1.5), '27 + 2 * (1.5^(@zoom_level-5)-1)/(1.5^(13-5)-1)')
def testInterpolateExpression(self): self.assertEqual(QgsMapBoxGlStyleConverter.interpolateExpression(5, 13, 27, 29, 1), 'scale_linear(@vector_tile_zoom,5,13,27,29)') self.assertEqual(QgsMapBoxGlStyleConverter.interpolateExpression(5, 13, 27, 29, 1.5), 'scale_exp(@vector_tile_zoom,5,13,27,29,1.5)') self.assertEqual(QgsMapBoxGlStyleConverter.interpolateExpression(5, 13, 27, 29, 1.5), 'scale_exp(@vector_tile_zoom,5,13,27,29,1.5)') # same values, return nice and simple expression! self.assertEqual(QgsMapBoxGlStyleConverter.interpolateExpression(5, 13, 27, 27, 1.5), '27') self.assertEqual(QgsMapBoxGlStyleConverter.interpolateExpression(5, 13, 27, 27, 1.5, 2), '54')