diff options
Diffstat (limited to 'libdimension-python/tests')
-rwxr-xr-x | libdimension-python/tests/canvas.py | 14 | ||||
-rwxr-xr-x | libdimension-python/tests/color.py | 2 | ||||
-rwxr-xr-x | libdimension-python/tests/demo.py | 42 | ||||
-rwxr-xr-x | libdimension-python/tests/geometry.py | 10 |
4 files changed, 34 insertions, 34 deletions
diff --git a/libdimension-python/tests/canvas.py b/libdimension-python/tests/canvas.py index e69d2d9..97f322d 100755 --- a/libdimension-python/tests/canvas.py +++ b/libdimension-python/tests/canvas.py @@ -23,25 +23,25 @@ from dimension import * import errno # Treat warnings as errors for tests -dieOnWarnings(True) +die_on_warnings(True) canvas = Canvas(768, 480) assert canvas.width == 768, canvas.width assert canvas.height == 480, canvas.height -havePNG = True +have_PNG = True try: - canvas.optimizePNG() + canvas.optimize_PNG() except OSError as e: if e.errno == errno.ENOSYS: havePNG = False else: raise -haveGL = True +have_GL = True try: - canvas.optimizeGL() + canvas.optimize_GL() except OSError as e: if e.errno == errno.ENOSYS: haveGL = False @@ -50,8 +50,8 @@ except OSError as e: canvas.clear(Blue) -if havePNG: - canvas.writePNG('png.png') +if have_PNG: + canvas.write_PNG('png.png') #if haveGL: # canvas.drawGL() diff --git a/libdimension-python/tests/color.py b/libdimension-python/tests/color.py index 2d8545d..bdfb65f 100755 --- a/libdimension-python/tests/color.py +++ b/libdimension-python/tests/color.py @@ -22,7 +22,7 @@ from dimension import * # Treat warnings as errors for tests -dieOnWarnings(True) +die_on_warnings(True) c = Color(0, 0.5, 1, trans = 0.5, filter = 0.35) assert repr(c) == 'dimension.Color(0.0, 0.5, 1.0, 0.5, 0.35)', repr(c) diff --git a/libdimension-python/tests/demo.py b/libdimension-python/tests/demo.py index c024812..d73410f 100755 --- a/libdimension-python/tests/demo.py +++ b/libdimension-python/tests/demo.py @@ -22,23 +22,23 @@ from dimension import * # Treat warnings as errors for tests -dieOnWarnings(True) +die_on_warnings(True) # Canvas canvas = Canvas(width = 768, height = 480) -havePNG = True +have_PNG = True try: - canvas.optimizePNG() + canvas.optimize_PNG() except OSError as e: if e.errno == errno.ENOSYS: - havePNG = False + have_PNG = False else: raise # Camera camera = PerspectiveCamera(location = (0, 0.25, -4), - lookAt = 0) + look_at = 0) camera.transform(rotate(53*Y)) # Lights @@ -48,7 +48,7 @@ lights = [ # Objects -hollowCube = Difference( +hollow_cube = Difference( [ Box( (-1, -1, -1), (1, 1, 1), @@ -77,8 +77,8 @@ arrow = Union( [ Cylinder(bottom = -1.25*Y, top = 1.25*Y, radius = 0.1), Cone( - bottom = 1.25*Y, bottomRadius = 0.1, - top = 1.5*Y, topRadius = 0, + bottom = 1.25*Y, bottom_radius = 0.1, + top = 1.5*Y, top_radius = 0, open = True ), ], @@ -103,12 +103,12 @@ arrow.transform(rotate(-45*X)) torii = Union( [ - Torus(majorRadius = 0.15, minorRadius = 0.05) + Torus(major_radius = 0.15, minor_radius = 0.05) .transform(translate(-Y)), - Torus(majorRadius = 0.15, minorRadius = 0.05), + Torus(major_radius = 0.15, minor_radius = 0.05), - Torus(majorRadius = 0.15, minorRadius = 0.05) + Torus(major_radius = 0.15, minor_radius = 0.05) .transform(translate(Y)), ], texture = Texture( @@ -126,21 +126,21 @@ ground = Plane( Checker(), [ White, - ColorMap(Checker(), [Black, White]).transform(scale(1/3, 1/3, 1/3)) + ColorMap(Checker(), [Black, White]).transform(scale(1/3)) ], ), ), ) objects = [ - hollowCube, + hollow_cube, arrow, torii, ground, ] # Sky sphere -skySphere = SkySphere( +sky_sphere = SkySphere( [ ColorMap( pattern = Gradient(Y), @@ -157,12 +157,12 @@ scene = Scene(canvas = canvas, objects = objects, lights = lights, camera = camera) -scene.defaultTexture = Texture(finish = Ambient(0.1) + Diffuse(0.6)) -scene.background = Clear -scene.skySphere = skySphere -scene.adcBailout = 1/255 -scene.recursionLimit = 5 +scene.default_texture = Texture(finish = Ambient(0.1) + Diffuse(0.6)) +scene.background = Clear +scene.sky_sphere = sky_sphere +scene.adc_bailout = 1/255 +scene.recursion_limit = 5 scene.raytrace() -if havePNG: - canvas.writePNG('demo.png') +if have_PNG: + canvas.write_PNG('demo.png') diff --git a/libdimension-python/tests/geometry.py b/libdimension-python/tests/geometry.py index c1d4f48..e18d17a 100755 --- a/libdimension-python/tests/geometry.py +++ b/libdimension-python/tests/geometry.py @@ -22,7 +22,7 @@ from dimension import * # Treat warnings as errors for tests -dieOnWarnings(True) +die_on_warnings(True) assert 0 == Vector(0, 0, 0), Vector(0) assert X == Vector(1, 0, 0), X @@ -66,10 +66,10 @@ assert str(m) == '\n' \ '[9.0\t10.0\t11.0\t12.0]\n' \ '[0.0\t0.0\t0.0\t1.0]', str(m) -s = scale(Vector(1, 2, 3)) -assert s == Matrix(1, 0, 0, 0, - 0, 2, 0, 0, - 0, 0, 3, 0), s +s = scale(0.5) +assert s == Matrix(0.5, 0, 0, 0, + 0, 0.5, 0, 0, + 0, 0, 0.5, 0), s t = translate(1, 2, 3) assert t == Matrix(1, 0, 0, 1, |