Merge branch 'release/1.10.x'

This commit is contained in:
rdb
2021-06-01 11:50:12 +02:00
5 changed files with 104 additions and 99 deletions
+25 -25
View File
@@ -5,30 +5,6 @@ from panda3d import core
import pytest
def test_round():
original_vector = Vec2(2.3, -2.6)
rounded_vector = round(original_vector)
assert rounded_vector.x == 2
assert rounded_vector.y == -3
def test_floor():
original_vector = Vec2(2.3, -2.6)
rounded_vector = floor(original_vector)
assert rounded_vector.x == 2
assert rounded_vector.y == -3
def test_ceil():
original_vector = Vec2(2.3, -2.6)
rounded_vector = ceil(original_vector)
assert rounded_vector.x == 3
assert rounded_vector.y == -2
def test_vec2_creation():
assert Vec2(x=1, y=2) == Vec2(1, 2) == Vec2((1, 2))
@@ -120,8 +96,32 @@ def test_vec2_nan():
assert not Vec2D(-inf, 0).is_nan()
def test_vec2_round():
original_vector = Vec2(2.3, -2.6)
rounded_vector = round(original_vector)
assert rounded_vector.x == 2
assert rounded_vector.y == -3
def test_vec2_floor():
original_vector = Vec2(2.3, -2.6)
rounded_vector = floor(original_vector)
assert rounded_vector.x == 2
assert rounded_vector.y == -3
def test_vec2_ceil():
original_vector = Vec2(2.3, -2.6)
rounded_vector = ceil(original_vector)
assert rounded_vector.x == 3
assert rounded_vector.y == -2
@pytest.mark.parametrize("type", (core.LVecBase2f, core.LVecBase2d, core.LVecBase2i))
def test_vec4_floordiv(type):
def test_vec2_floordiv(type):
with pytest.raises(ZeroDivisionError):
type(1, 2) // 0
+27 -27
View File
@@ -5,33 +5,6 @@ from panda3d import core
import pytest
def test_round():
original_vector = Vec3(2.3, -2.6, 3.5)
rounded_vector = round(original_vector)
assert rounded_vector.x == 2
assert rounded_vector.y == -3
assert rounded_vector.z == 4
def test_floor():
original_vector = Vec3(2.3, -2.6, 3.5)
rounded_vector = floor(original_vector)
assert rounded_vector.x == 2
assert rounded_vector.y == -3
assert rounded_vector.z == 3
def test_ceil():
original_vector = Vec3(2.3, -2.6, 3.5)
rounded_vector = ceil(original_vector)
assert rounded_vector.x == 3
assert rounded_vector.y == -2
assert rounded_vector.z == 4
def test_vec3_creation():
assert Vec3(x=1, y=2, z=1) == Vec3(1, 2, 1) == Vec3((1, 2, 1))
@@ -105,6 +78,33 @@ def test_vec3_compare():
assert Vec3(0, 0, 1).compare_to(Vec3(0, 0, 1)) == 0
def test_vec3_round():
original_vector = Vec3(2.3, -2.6, 3.5)
rounded_vector = round(original_vector)
assert rounded_vector.x == 2
assert rounded_vector.y == -3
assert rounded_vector.z == 4
def test_vec3_floor():
original_vector = Vec3(2.3, -2.6, 3.5)
rounded_vector = floor(original_vector)
assert rounded_vector.x == 2
assert rounded_vector.y == -3
assert rounded_vector.z == 3
def test_vec3_ceil():
original_vector = Vec3(2.3, -2.6, 3.5)
rounded_vector = ceil(original_vector)
assert rounded_vector.x == 3
assert rounded_vector.y == -2
assert rounded_vector.z == 4
@pytest.mark.parametrize("type", (core.LVecBase3f, core.LVecBase3d, core.LVecBase3i))
def test_vec3_floordiv(type):
with pytest.raises(ZeroDivisionError):
+30 -30
View File
@@ -5,36 +5,6 @@ from panda3d import core
import pytest
def test_round():
original_vector = Vec4(2.3, -2.6, 3.5, 1)
rounded_vector = round(original_vector)
assert rounded_vector.x == 2
assert rounded_vector.y == -3
assert rounded_vector.z == 4
assert rounded_vector.w == 1
def test_floor():
original_vector = Vec4(2.3, -2.6, 3.5, 1)
rounded_vector = floor(original_vector)
assert rounded_vector.x == 2
assert rounded_vector.y == -3
assert rounded_vector.z == 3
assert rounded_vector.w == 1
def test_ceil():
original_vector = Vec4(2.3, -2.6, 3.5, 1)
rounded_vector = ceil(original_vector)
assert rounded_vector.x == 3
assert rounded_vector.y == -2
assert rounded_vector.z == 4
assert rounded_vector.w == 1
def test_vec4_creation():
assert Vec4(x=1, y=2, z=1, w=7) == Vec4(1, 2, 1, 7) == Vec4((1, 2, 1, 7))
@@ -121,6 +91,36 @@ def test_vec4_compare():
assert Vec4(0, 0, 0, 1).compare_to(Vec4(0, 0, 0, 1)) == 0
def test_vec4_round():
original_vector = Vec4(2.3, -2.6, 3.5, 1)
rounded_vector = round(original_vector)
assert rounded_vector.x == 2
assert rounded_vector.y == -3
assert rounded_vector.z == 4
assert rounded_vector.w == 1
def test_vec4_floor():
original_vector = Vec4(2.3, -2.6, 3.5, 1)
rounded_vector = floor(original_vector)
assert rounded_vector.x == 2
assert rounded_vector.y == -3
assert rounded_vector.z == 3
assert rounded_vector.w == 1
def test_vec4_ceil():
original_vector = Vec4(2.3, -2.6, 3.5, 1)
rounded_vector = ceil(original_vector)
assert rounded_vector.x == 3
assert rounded_vector.y == -2
assert rounded_vector.z == 4
assert rounded_vector.w == 1
@pytest.mark.parametrize("type", (core.LVecBase4f, core.LVecBase4d, core.LVecBase4i))
def test_vec4_floordiv(type):
with pytest.raises(ZeroDivisionError):