From: Bborie Park Date: Sun, 26 Feb 2012 18:31:38 +0000 (+0000) Subject: Additional test of rt_raster_to_gdal(). X-Git-Tag: 2.0.0beta1~53 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=daa8db9ca9090284cb47bbb4785256975bf3b1d7;p=postgis Additional test of rt_raster_to_gdal(). git-svn-id: http://svn.osgeo.org/postgis/trunk@9303 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/raster/test/core/testapi.c b/raster/test/core/testapi.c index d12997290..0cdb9f56a 100644 --- a/raster/test/core/testapi.c +++ b/raster/test/core/testapi.c @@ -1641,6 +1641,30 @@ static void testRasterToGDAL() { if (gdal) CPLFree(gdal); deepRelease(raster); + + raster = rt_raster_new(xmax, ymax); + assert(raster); /* or we're out of virtual memory */ + band = addBand(raster, PT_8BSI, 0, 0); + CHECK(band); + rt_band_set_nodata(band, 0); + + rt_raster_set_offsets(raster, -500000, 600000); + rt_raster_set_scale(raster, 1000, -1000); + + for (x = 0; x < xmax; x++) { + for (y = 0; y < ymax; y++) { + rtn = rt_band_set_pixel(band, x, y, x); + CHECK((rtn != -1)); + } + } + + gdal = rt_raster_to_gdal(raster, srs, "PNG", NULL, &gdalSize); + /*printf("gdalSize: %d\n", (int) gdalSize);*/ + CHECK(gdalSize); + + if (gdal) CPLFree(gdal); + + deepRelease(raster); } static void testValueCount() {