[Pkg-javascript-commits] [node-mapnik] 01/08: Imported Upstream version 1.2.0

Jérémy Lal kapouer at alioth.debian.org
Wed Sep 18 20:25:06 UTC 2013


This is an automated email from the git hooks/post-receive script.

kapouer pushed a commit to branch master
in repository node-mapnik.

commit ec7ec804ce80ffe8395a919be0b6bf8f1dd4260e
Author: Jérémy Lal <kapouer at melix.org>
Date:   Wed Sep 18 21:27:05 2013 +0200

    Imported Upstream version 1.2.0
---
 .travis.yml                                |   24 ++++++++++++++++
 CHANGELOG.md                               |    8 ++++++
 Makefile                                   |   10 +++----
 README.md                                  |   33 ++++++++-------------
 binding.gyp                                |   15 ++++++++--
 common.gypi                                |   10 +++++--
 package.json                               |   17 +++--------
 src/mapnik_map.cpp                         |   43 ++++++++++++++++++++++++----
 src/mapnik_vector_tile.cpp                 |   13 ++++++++-
 test/cairo_surface.test.js                 |    2 +-
 test/color.test.js                         |    2 +-
 test/compositing.test.js                   |    2 +-
 test/constants.test.js                     |    2 +-
 test/data/vector_tile/tile0-b.actual.png   |  Bin 0 -> 13035 bytes
 test/data/vector_tile/tile0-b.expected.png |  Bin 0 -> 13035 bytes
 test/data/vector_tile/tile0.expected.png   |  Bin 27053 -> 27091 bytes
 test/datasource.test.js                    |    2 +-
 test/expression.test.js                    |    2 +-
 test/feature.test.js                       |    2 +-
 test/fonts.test.js                         |    2 +-
 test/grid.test.js                          |    2 +-
 test/grid_view.test.js                     |    2 +-
 test/image.test.js                         |    2 +-
 test/image_view.test.js                    |    2 +-
 test/layers.test.js                        |    2 +-
 test/map.test.js                           |    2 +-
 test/map_generation.test.js                |    2 +-
 test/palette.test.js                       |    2 +-
 test/parameters.test.js                    |    2 +-
 test/proj_transform.test.js                |    2 +-
 test/projection.test.js                    |    2 +-
 test/query-map.test.js                     |    2 +-
 test/render-async.test.js                  |    2 +-
 test/render-sync.test.js                   |    2 +-
 test/render_grid.test.js                   |    2 +-
 test/tmp/placeholder.txt                   |    1 +
 test/unicode-loading.test.js               |    2 +-
 test/vector-tile.test.js                   |   30 ++++++++++++++++---
 38 files changed, 174 insertions(+), 78 deletions(-)

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..c69b96d
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,24 @@
+language: node_js
+
+node_js:
+ - "0.10"
+ - "0.8"
+ - "0.6"
+
+before_install:
+ - sudo apt-add-repository --yes ppa:mapnik/v2.2.0
+ - sudo apt-get update -qq
+ - sudo apt-get -qq install libprotobuf7 libprotobuf-dev protobuf-compiler libmapnik libmapnik-dev
+
+before_script: "npm install mocha sphericalmercator"
+
+branches:
+  only:
+    - master
+
+notifications:
+  irc:
+    channels:
+      - "irc.freenode.org#mapnik"
+    use_notice: true
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 90d4b2f..8c71589 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
 # Changlog
 
+## 1.2.0
+
+ - Map.render (when rendering to a VectorTile) and VectorTile.render now expect `buffer_size` option to be passed and ignores map.BufferSize (#175)
+ - Removed `devDependencies` so that `mocha` and `sphericalmecator` need to be manually installed to run tests
+ - Tweaked gyp `Release` configuration to ensure binaries are stripped and built with highest level of optimization
+ - Added support for detecting `--runtime_link=static` flag to npm install that can trigger linking against all Mapnik depedencies (not just libmapnik)
+ - Added travis.ci support
+
 ## 1.1.3
 
  - Gyp binding cleanups
diff --git a/Makefile b/Makefile
index 958e6e6..be1a5da 100755
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,8 @@ mapnik.node:
 clean:
 	@rm -rf ./build
 	rm -f lib/_mapnik.node
+	rm ./test/tmp/*
+	echo > ./test/tmp/placeholder.txt
 
 
 rebuild:
@@ -15,15 +17,11 @@ rebuild:
 	@./configure
 	@make
 
-test-tmp:
-	@rm -rf test/tmp
-	@mkdir -p test/tmp
-
 ifndef only
-test: test-tmp
+test:
 	@PATH="./node_modules/mocha/bin:${PATH}" && NODE_PATH="./lib:$(NODE_PATH)" mocha -R spec
 else
-test: test-tmp
+test:
 	@PATH="./node_modules/mocha/bin:${PATH}" && NODE_PATH="./lib:$(NODE_PATH)" mocha -R spec test/${only}.test.js
 endif
 
diff --git a/README.md b/README.md
index f0cf5cb..27b5493 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,9 @@
+# node-mapnik
 
-# Node-Mapnik
-      
 Bindings to [Mapnik](http://mapnik.org) for [node](http://nodejs.org).
 
+[![Build Status](https://secure.travis-ci.org/mapnik/node-mapnik.png)](http://travis-ci.org/mapnik/node-mapnik)
+
 
 ## Example
 
@@ -47,7 +48,7 @@ For more sample code see https://github.com/mapnik/node-mapnik-sample-code
 ## Depends
 
 * Node >= v0.6
-* Mapnik v2.2.x
+* Mapnik >= v2.2.x
 * Protobuf (protoc and libprotobuf-lite)
 
 ## Installation
@@ -56,27 +57,20 @@ Install Mapnik using the instructions at: https://github.com/mapnik/mapnik/wiki/
 
 Confirm that the `mapnik-config` program is available and on your $PATH.
 
-To install node-mapnik locally for development or testing do:
-
-    git clone git://github.com/mapnik/node-mapnik.git
-    cd node-mapnik
-    ./configure
-    make
+Install via npm:
 
-Or set NODE_PATH to test importing:
+    npm install mapnik
 
-    export NODE_PATH=./lib
-    node -e "require.resolve('mapnik')"
+Install locally for development:
 
-Or you can also install via npm
-  
-    npm install mapnik
+    git clone git://github.com/mapnik/node-mapnik.git
+    cd node-mapnik
+    npm install
 
 The above will install node-mapnik locally in a node_modules folder. To install globally do:
 
     npm install -g mapnik
 
-
 ## Using node-mapnik from your node app
 
 To require node-mapnik as a dependency of another package put in your package.json:
@@ -87,12 +81,9 @@ To require node-mapnik as a dependency of another package put in your package.js
 
 To run the tests do:
   
+    npm install mocha sphericalmercator
     npm test
 
-Or you can manually install mocha and then just do:
-
-    make test
-
 ## License
 
-  BSD, see LICENSE.txt
\ No newline at end of file
+  BSD, see LICENSE.txt
diff --git a/binding.gyp b/binding.gyp
index 3cb73c1..6c53d3e 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -1,5 +1,8 @@
 {
   'includes': [ 'common.gypi' ],
+  'variables': {
+      'runtime_link%':'shared',
+  },
   'conditions': [
       ['OS=="win"', {
         'variables': {
@@ -79,10 +82,18 @@
                 '<!@(pkg-config protobuf --cflags)'
             ],
             'libraries':[
-                '<!@(mapnik-config --libs)', # will bring in -lmapnik and the -L to point to it
+                '<!@(mapnik-config --libs)',
                 '<!@(pkg-config protobuf --libs-only-L)',
                 '-lprotobuf-lite'
-            ]
+            ],
+            'conditions': [
+              ['runtime_link == "static"', {
+                  'libraries': [
+                    '<!@(mapnik-config --ldflags)',
+                    '<!@(mapnik-config --dep-libs)'
+                   ]
+              }]
+            ],
         }]
       ],
       # this has to be per target to correctly
diff --git a/common.gypi b/common.gypi
index bf7b460..f06cff5 100644
--- a/common.gypi
+++ b/common.gypi
@@ -3,16 +3,22 @@
       'default_configuration': 'Release',
       'configurations': {
           'Debug': {
+              'defines!': [ 'NDEBUG' ],
               'cflags_cc!': ['-O3', '-Os', '-DNDEBUG'],
               'xcode_settings': {
-                'OTHER_CPLUSPLUSFLAGS!':['-O3', '-Os', '-DNDEBUG'],
+                'OTHER_CPLUSPLUSFLAGS!':['-O3', '-Os', '-DDEBUG'],
                 'GCC_OPTIMIZATION_LEVEL': '0',
                 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES'
               }
           },
           'Release': {
+              'defines': [
+                'NDEBUG'
+              ],
               'xcode_settings': {
-                'GCC_OPTIMIZATION_LEVEL': 's',
+                'OTHER_CPLUSPLUSFLAGS!':['-Os', '-O2'],
+                'OTHER_CPLUSPLUSFLAGS':[],
+                'GCC_OPTIMIZATION_LEVEL': '3',
                 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
                 'DEAD_CODE_STRIPPING':'YES',
                 'GCC_INLINES_ARE_PRIVATE_EXTERN':'YES',
diff --git a/package.json b/package.json
index f2f7942..591ced8 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
   "url"           : "http://github.com/mapnik/node-mapnik",
   "homepage"      : "http://mapnik.org",
   "author"        : "Dane Springmeyer <dane at dbsgeo.com> (mapnik.org)",
-  "version"       : "1.1.3",
+  "version"       : "1.2.0",
   "main"          : "./lib/mapnik.js",
   "bugs"          : {
     "email" : "dane at dbsgeo.com",
@@ -32,23 +32,14 @@
   "dependencies"  : {
       "mapnik-vector-tile": "0.3.x"
   },
-  "devDependencies": {
-      "mocha": "1.12.x",
-      "jshint"  : "0.5.x",
-      "sphericalmercator":"1.0.x"
-   },
   "bin"           : {
        "mapnik-inspect.js" : "./bin/mapnik-inspect.js",
        "mapnik-render.js"  : "./bin/mapnik-render.js"
-   },
-   "directories"  : {
-       "examples" : "examples",
-       "src": "src"
-   },
+  },
   "engines"       : {
-      "node": ">= 0.6.13 && < 0.13.0"
+      "node": ">= 0.6.13 < 0.11.4"
   },
   "scripts"       : {
       "test"    : "mocha"
-   }
+  }
 }
diff --git a/src/mapnik_map.cpp b/src/mapnik_map.cpp
index 99d690b..017b65d 100644
--- a/src/mapnik_map.cpp
+++ b/src/mapnik_map.cpp
@@ -1291,10 +1291,11 @@ Handle<Value> Map::zoomToBox(const Arguments& args)
     return Undefined();
 }
 
-typedef struct {
+struct image_baton_t {
     uv_work_t request;
     Map *m;
     Image *im;
+    int buffer_size; // TODO - no effect until mapnik::request is used
     double scale_factor;
     double scale_denominator;
     unsigned offset_x;
@@ -1302,13 +1303,22 @@ typedef struct {
     bool error;
     std::string error_name;
     Persistent<Function> cb;
-} image_baton_t;
+    image_baton_t() :
+      buffer_size(0),
+      scale_factor(1.0),
+      scale_denominator(0.0),
+      offset_x(0),
+      offset_y(0),
+      error(false),
+      error_name() {}
+};
 
-typedef struct {
+struct grid_baton_t {
     uv_work_t request;
     Map *m;
     Grid *g;
     std::size_t layer_idx;
+    int buffer_size; // TODO - no effect until mapnik::request is used
     double scale_factor;
     double scale_denominator;
     unsigned offset_x;
@@ -1316,7 +1326,16 @@ typedef struct {
     bool error;
     std::string error_name;
     Persistent<Function> cb;
-} grid_baton_t;
+    grid_baton_t() :
+      layer_idx(-1),
+      buffer_size(0),
+      scale_factor(1.0),
+      scale_denominator(0.0),
+      offset_x(0),
+      offset_y(0),
+      error(false),
+      error_name() {}
+};
 
 struct vector_tile_baton_t {
     uv_work_t request;
@@ -1324,6 +1343,7 @@ struct vector_tile_baton_t {
     VectorTile *d;
     unsigned tolerance;
     unsigned path_multiplier;
+    int buffer_size;
     double scale_factor;
     double scale_denominator;
     unsigned offset_x;
@@ -1376,6 +1396,7 @@ Handle<Value> Map::render(const Arguments& args)
     // parse options
 
     // defaults
+    int buffer_size = 0;
     double scale_factor = 1.0;
     double scale_denominator = 0.0;
     unsigned offset_x = 0;
@@ -1392,6 +1413,15 @@ Handle<Value> Map::render(const Arguments& args)
 
         options = args[1]->ToObject();
 
+        if (options->Has(String::New("buffer_size"))) {
+            Local<Value> bind_opt = options->Get(String::New("buffer_size"));
+            if (!bind_opt->IsNumber())
+                return ThrowException(Exception::TypeError(
+                                          String::New("optional arg 'buffer_size' must be a number")));
+
+            buffer_size = bind_opt->IntegerValue();
+        }
+
         if (options->Has(String::New("scale"))) {
             Local<Value> bind_opt = options->Get(String::New("scale"));
             if (!bind_opt->IsNumber())
@@ -1440,6 +1470,7 @@ Handle<Value> Map::render(const Arguments& args)
         closure->m = m;
         closure->im = node::ObjectWrap::Unwrap<Image>(obj);
         closure->im->_ref();
+        closure->buffer_size = buffer_size;
         closure->scale_factor = scale_factor;
         closure->scale_denominator = scale_denominator;
         closure->offset_x = offset_x;
@@ -1533,6 +1564,7 @@ Handle<Value> Map::render(const Arguments& args)
         closure->g = g;
         closure->g->_ref();
         closure->layer_idx = layer_idx;
+        closure->buffer_size = buffer_size;
         closure->scale_factor = scale_factor;
         closure->scale_denominator = scale_denominator;
         closure->offset_x = offset_x;
@@ -1567,6 +1599,7 @@ Handle<Value> Map::render(const Arguments& args)
         closure->m = m;
         closure->d = vector_tile_obj;
         closure->d->_ref();
+        closure->buffer_size = buffer_size;
         closure->scale_factor = scale_factor;
         closure->scale_denominator = scale_denominator;
         closure->offset_x = offset_x;
@@ -1594,7 +1627,7 @@ void Map::EIO_RenderVectorTile(uv_work_t* req)
                              closure->path_multiplier);
         mapnik::Map const& map = *closure->m->get();
         mapnik::request m_req(map.width(),map.height(),map.get_current_extent());
-        m_req.set_buffer_size(map.buffer_size());
+        m_req.set_buffer_size(closure->buffer_size);
         renderer_type ren(backend,
                           map,
                           m_req,
diff --git a/src/mapnik_vector_tile.cpp b/src/mapnik_vector_tile.cpp
index 6c534bb..eee15db 100644
--- a/src/mapnik_vector_tile.cpp
+++ b/src/mapnik_vector_tile.cpp
@@ -714,6 +714,7 @@ struct vector_tile_render_baton_t {
     int y;
     bool zxy_override;
     bool error;
+    int buffer_size;
     double scale_factor;
     double scale_denominator;
     std::string error_name;
@@ -733,6 +734,7 @@ struct vector_tile_render_baton_t {
         y(0),
         zxy_override(false),
         error(false),
+        buffer_size(0),
         scale_factor(1.0),
         scale_denominator(0.0),
         use_cairo(true) {}
@@ -792,6 +794,15 @@ Handle<Value> VectorTile::render(const Arguments& args)
             closure->zxy_override = true;
             closure->y = options->Get(String::New("y"))->IntegerValue();
         }
+        if (options->Has(String::New("buffer_size"))) {
+            Local<Value> bind_opt = options->Get(String::New("buffer_size"));
+            if (!bind_opt->IsNumber()) {
+                delete closure;
+                return ThrowException(Exception::TypeError(
+                                          String::New("optional arg 'buffer_size' must be a number")));
+            }
+            closure->buffer_size = bind_opt->IntegerValue();
+        }
         if (options->Has(String::New("scale"))) {
             Local<Value> bind_opt = options->Get(String::New("scale"));
             if (!bind_opt->IsNumber())
@@ -1029,7 +1040,7 @@ void VectorTile::EIO_RenderTile(uv_work_t* req)
         }
         mapnik::box2d<double> map_extent(minx,miny,maxx,maxy);
         mapnik::request m_req(map_in.width(),map_in.height(),map_extent);
-        m_req.set_buffer_size(map_in.buffer_size());
+        m_req.set_buffer_size(closure->buffer_size);
         mapnik::projection map_proj(map_in.srs(),true);
         double scale_denom = closure->scale_denominator;
         if (scale_denom <= 0.0)
diff --git a/test/cairo_surface.test.js b/test/cairo_surface.test.js
index 54e00fd..30e19f7 100644
--- a/test/cairo_surface.test.js
+++ b/test/cairo_surface.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
diff --git a/test/color.test.js b/test/color.test.js
index 6783ea6..a2d255a 100644
--- a/test/color.test.js
+++ b/test/color.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 
 describe('mapnik.Color', function() {
diff --git a/test/compositing.test.js b/test/compositing.test.js
index 4d15436..9f77007 100644
--- a/test/compositing.test.js
+++ b/test/compositing.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var exists = require('fs').existsSync || require('path').existsSync;
 
diff --git a/test/constants.test.js b/test/constants.test.js
index 2210669..1b75491 100644
--- a/test/constants.test.js
+++ b/test/constants.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 
diff --git a/test/data/vector_tile/tile0-b.actual.png b/test/data/vector_tile/tile0-b.actual.png
new file mode 100644
index 0000000..0a96eb8
Binary files /dev/null and b/test/data/vector_tile/tile0-b.actual.png differ
diff --git a/test/data/vector_tile/tile0-b.expected.png b/test/data/vector_tile/tile0-b.expected.png
new file mode 100644
index 0000000..0a96eb8
Binary files /dev/null and b/test/data/vector_tile/tile0-b.expected.png differ
diff --git a/test/data/vector_tile/tile0.expected.png b/test/data/vector_tile/tile0.expected.png
index 63d8c5e..de1b2e3 100644
Binary files a/test/data/vector_tile/tile0.expected.png and b/test/data/vector_tile/tile0.expected.png differ
diff --git a/test/datasource.test.js b/test/datasource.test.js
index 815950b..e35e7d7 100644
--- a/test/datasource.test.js
+++ b/test/datasource.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
diff --git a/test/expression.test.js b/test/expression.test.js
index a450d15..2a19ab2 100644
--- a/test/expression.test.js
+++ b/test/expression.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 
 describe('mapnik.Expression', function() {
diff --git a/test/feature.test.js b/test/feature.test.js
index 8fa4b92..e9e53d9 100644
--- a/test/feature.test.js
+++ b/test/feature.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
diff --git a/test/fonts.test.js b/test/fonts.test.js
index 00c6e3b..aaea67b 100644
--- a/test/fonts.test.js
+++ b/test/fonts.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 
diff --git a/test/grid.test.js b/test/grid.test.js
index 5c7e1ba..3e6446a 100644
--- a/test/grid.test.js
+++ b/test/grid.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
diff --git a/test/grid_view.test.js b/test/grid_view.test.js
index 325bf2f..5b1c86f 100644
--- a/test/grid_view.test.js
+++ b/test/grid_view.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
diff --git a/test/image.test.js b/test/image.test.js
index 90e219c..97dfc52 100644
--- a/test/image.test.js
+++ b/test/image.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
diff --git a/test/image_view.test.js b/test/image_view.test.js
index 50c9597..7b1890c 100644
--- a/test/image_view.test.js
+++ b/test/image_view.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
diff --git a/test/layers.test.js b/test/layers.test.js
index ff00e72..4e84664 100644
--- a/test/layers.test.js
+++ b/test/layers.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
diff --git a/test/map.test.js b/test/map.test.js
index 865d1d4..da26f53 100644
--- a/test/map.test.js
+++ b/test/map.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var path = require('path');
 
diff --git a/test/map_generation.test.js b/test/map_generation.test.js
index f1a4113..83fc168 100644
--- a/test/map_generation.test.js
+++ b/test/map_generation.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
diff --git a/test/palette.test.js b/test/palette.test.js
index 3b917b5..dd069d6 100644
--- a/test/palette.test.js
+++ b/test/palette.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
diff --git a/test/parameters.test.js b/test/parameters.test.js
index 331e296..70c2caa 100644
--- a/test/parameters.test.js
+++ b/test/parameters.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var assert = require('assert');
 var fs = require('fs');
diff --git a/test/proj_transform.test.js b/test/proj_transform.test.js
index b9d8951..32e82f0 100644
--- a/test/proj_transform.test.js
+++ b/test/proj_transform.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
diff --git a/test/projection.test.js b/test/projection.test.js
index 18b8ef2..22d0b76 100644
--- a/test/projection.test.js
+++ b/test/projection.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
diff --git a/test/query-map.test.js b/test/query-map.test.js
index 347d653..73ed376 100644
--- a/test/query-map.test.js
+++ b/test/query-map.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 
 
diff --git a/test/render-async.test.js b/test/render-async.test.js
index 37492e0..e9bdc42 100644
--- a/test/render-async.test.js
+++ b/test/render-async.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var exists = require('fs').existsSync || require('path').existsSync;
 
diff --git a/test/render-sync.test.js b/test/render-sync.test.js
index 8e5715b..293e9ab 100644
--- a/test/render-sync.test.js
+++ b/test/render-sync.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var exists = require('fs').existsSync || require('path').existsSync;
 var helper = require('./support/helper');
diff --git a/test/render_grid.test.js b/test/render_grid.test.js
index 1c4f519..5c4b3ca 100644
--- a/test/render_grid.test.js
+++ b/test/render_grid.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 
diff --git a/test/tmp/placeholder.txt b/test/tmp/placeholder.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/test/tmp/placeholder.txt
@@ -0,0 +1 @@
+
diff --git a/test/unicode-loading.test.js b/test/unicode-loading.test.js
index 6abc42f..afc696b 100644
--- a/test/unicode-loading.test.js
+++ b/test/unicode-loading.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var path = require('path');
 var fs = require('fs');
diff --git a/test/vector-tile.test.js b/test/vector-tile.test.js
index 6283c31..0d595d1 100644
--- a/test/vector-tile.test.js
+++ b/test/vector-tile.test.js
@@ -1,4 +1,4 @@
-var mapnik = require('mapnik');
+var mapnik = require('../');
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
@@ -270,8 +270,8 @@ describe('mapnik.VectorTile ', function() {
         map.loadSync('./test/stylesheet.xml');
         map.extent = [-20037508.34, -20037508.34, 20037508.34, 20037508.34];
 
-        var png = map.renderSync('png', new mapnik.Image(256, 256), {});
-        fs.writeFileSync('./test/data/vector_tile/tile0.expected.png', png);
+        //var png = map.renderSync('png', new mapnik.Image(256, 256), {});
+        //fs.writeFileSync('./test/data/vector_tile/tile0.expected.png', png);
 
         map.render(dt, {}, function(err, dt) {
             if (err) throw err;
@@ -292,7 +292,29 @@ describe('mapnik.VectorTile ', function() {
 
         dt.render(map, new mapnik.Image(256, 256), function(err, dt_image) {
             if (err) throw err;
-            dt_image.save('./test/data/vector_tile/tile0.actual.png');
+            var actual = './test/data/vector_tile/tile0.actual.png';
+            var expected = './test/data/vector_tile/tile0.expected.png';
+            dt_image.save(actual);
+            assert.equal(fs.readFileSync(actual).length,fs.readFileSync(expected).length);
+            done();
+        });
+    });
+
+    it('should read back the data tile and render an image with it using negative buffer', function(done) {
+        var dt = new mapnik.VectorTile(0, 0, 0);
+        dt.setData(fs.readFileSync('./test/data/vector_tile/tile0.vector.pbf'));
+        var map = new mapnik.Map(256, 256);
+        map.loadSync('./test/stylesheet.xml');
+        map.extent = [-20037508.34, -20037508.34, 20037508.34, 20037508.34];
+
+        assert.equal(dt.isSolid(), false);
+
+        dt.render(map, new mapnik.Image(256, 256), {buffer_size:-64}, function(err, dt_image) {
+            if (err) throw err;
+            var actual = './test/data/vector_tile/tile0-b.actual.png';
+            var expected = './test/data/vector_tile/tile0-b.expected.png';
+            dt_image.save(actual);
+            assert.equal(fs.readFileSync(actual).length,fs.readFileSync(expected).length);
             done();
         });
     });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/node-mapnik.git



More information about the Pkg-javascript-commits mailing list