From 774a618d13074eb5dc7c90909f80efa1cfc21ac3 Mon Sep 17 00:00:00 2001 From: Mickey Rose Date: Thu, 19 Jul 2018 22:51:01 +0200 Subject: [PATCH] postgis: add test for pg_typeof substituted tokens --- test/unit/datasource/postgis.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/unit/datasource/postgis.cpp b/test/unit/datasource/postgis.cpp index f5a5add36..4487569a9 100644 --- a/test/unit/datasource/postgis.cpp +++ b/test/unit/datasource/postgis.cpp @@ -290,6 +290,26 @@ TEST_CASE("postgis") { REQUIRE(ext.maxy() == 4); } + SECTION("Postgis substitutes numeric !tokens! always with decimal point") + { + mapnik::parameters params(base_params); + params["table"] = "(SELECT geom," + " pg_typeof(!pixel_width!)::text as t_pixel_width," + " pg_typeof(!pixel_height!)::text as t_pixel_height," + " pg_typeof(!scale_denominator!)::text as t_scale_denom" + " FROM public.test LIMIT 1) as data"; + auto ds = mapnik::datasource_cache::instance().create(params); + REQUIRE(ds != nullptr); + auto featureset = all_features(ds); + auto feature = featureset->next(); + CHECKED_IF(feature != nullptr) + { + CHECK(feature->get("t_pixel_width").to_string() == "numeric"); + CHECK(feature->get("t_pixel_height").to_string() == "numeric"); + CHECK(feature->get("t_scale_denom").to_string() == "numeric"); + } + } + SECTION("Postgis doesn't interpret @domain in email address as @variable") { mapnik::parameters params(base_params);