add more box2d multiplication tests

This commit is contained in:
Dane Springmeyer 2013-05-16 14:24:25 -07:00
parent f665bcb11e
commit cd2dd66636

View file

@ -100,8 +100,34 @@ def test_envelope_static_init():
eq_(c.y, 150)
def test_envelope_multiplication():
# no width then no impact of multiplication
a = mapnik.Box2d(100, 100, 100, 100)
a *= 5
eq_(a.minx,100)
eq_(a.miny,100)
eq_(a.maxx,100)
eq_(a.maxy,100)
a = mapnik.Box2d(100.0, 100.0, 100.0, 100.0)
a *= 5
eq_(a.minx,100)
eq_(a.miny,100)
eq_(a.maxx,100)
eq_(a.maxy,100)
a = mapnik.Box2d(100.0, 100.0, 100.001, 100.001)
a *= 5
assert_almost_equal(a.minx, 99.9979, places=3)
assert_almost_equal(a.miny, 99.9979, places=3)
assert_almost_equal(a.maxx, 100.0030, places=3)
assert_almost_equal(a.maxy, 100.0030, places=3)
e = mapnik.Box2d(100, 100, 200, 200)
e *= 2
eq_(e.minx,50)
eq_(e.miny,50)
eq_(e.maxx,250)
eq_(e.maxy,250)
assert_true(e.contains(50, 50))
assert_true(e.contains(50, 250))
@ -148,5 +174,4 @@ def test_envelope_clipping():
eq_(e1,e2)
if __name__ == "__main__":
setup()
[eval(run)() for run in dir() if 'test_' in run]