~ubuntu-branches/ubuntu/trusty/mapnik/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/python_tests/save_map_test.py

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Sauthier
  • Date: 2009-08-27 00:28:37 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090827002837-ztqzfg2rmclfh4i9
Tags: 0.6.1-0ubuntu1
* New upstream release.
* Change usr/lib to usr/lib* to enable build on 64 bits systems due to new
  configuration in SConstruct in :
  - debian/libmapnik-dev.install
  - debian/libmapnik0.6.install
  - debian/mapnik-plugin-base

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
from nose.tools import *
 
4
from utilities import execution_path
 
5
 
 
6
import os, sys, glob, mapnik
 
7
 
 
8
def setup():
 
9
    # All of the paths used are relative, if we run the tests
 
10
    # from another directory we need to chdir()
 
11
    os.chdir(execution_path('.'))
 
12
 
 
13
def test():
 
14
    # TODO: Write a better test
 
15
    # 1. Construct map in memory
 
16
    # 2. Save map as XML
 
17
    # 3. Load map to a second object
 
18
    # 4. Compare both map objects
 
19
    map = mapnik.Map(256, 256)
 
20
    in_map = "../data/good_maps/osm-styles.xml"
 
21
 
 
22
    mapnik.load_map(map, in_map)
 
23
    test_map = "test_map.xml"
 
24
 
 
25
    mapnik.save_map(map, test_map)
 
26
    new_map = mapnik.Map(256, 256)
 
27
 
 
28
    mapnik.load_map(new_map, test_map)
 
29
 
 
30
    if os.path.exists(test_map):
 
31
        os.remove(test_map)
 
32
    else:
 
33
        # Fail, the map wasn't written
 
34
        return False