1 |
# Copyright (c) 2002 by Intevation GmbH |
2 |
# Authors: |
3 |
# Bernhard Herzog <[email protected]> |
4 |
# |
5 |
# This program is free software under the GPL (>=v2) |
6 |
# Read the file COPYING coming with Thuban for details. |
7 |
|
8 |
""" |
9 |
Test the Thuban-specific Projection class |
10 |
""" |
11 |
|
12 |
__version__ = "$Revision$" |
13 |
# $Source$ |
14 |
# $Id$ |
15 |
|
16 |
import unittest |
17 |
|
18 |
import support |
19 |
support.initthuban() |
20 |
|
21 |
from Thuban.Model.proj import Projection |
22 |
|
23 |
|
24 |
class TestProjection(unittest.TestCase, support.FloatComparisonMixin): |
25 |
|
26 |
"""Test cases for the Thuban-specific Projection class |
27 |
""" |
28 |
|
29 |
def test(self): |
30 |
"""Test Projection""" |
31 |
proj = Projection(["zone=26", "proj=utm", "ellps=clrk66"]) |
32 |
self.assertEquals(proj.params, ["zone=26", "proj=utm", "ellps=clrk66"]) |
33 |
|
34 |
# It's not clear whether this value is really the correct one |
35 |
# but a test failure here probably still means a bug somewhere |
36 |
self.assertFloatSeqEqual(proj.Forward(0, 0), |
37 |
[3623101.8103431347, 0.0], |
38 |
epsilon = 1e-5) |
39 |
self.assertFloatSeqEqual(proj.Inverse(3623101.8103431347, 0.0), |
40 |
[-0.00065775699878736467, 0]) |
41 |
|
42 |
self.assertFloatSeqEqual(proj.ForwardBBox((0, 0, 2, 2)), |
43 |
(3620891.3077618643, 0.0, |
44 |
3875381.8535437919, 252962.10480170773), |
45 |
epsilon = 1e-5) |
46 |
|
47 |
|
48 |
|
49 |
if __name__ == "__main__": |
50 |
unittest.main() |