mirror of
https://github.com/panda3d/panda3d.git
synced 2026-04-29 19:21:30 -05:00
Merge branch 'release/1.10.x'
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user