mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
tests: add test for prc page and one for light color temperature
This commit is contained in:
parent
6c7894f68d
commit
e0569815b5
20
tests/pgraph/test_light.py
Normal file
20
tests/pgraph/test_light.py
Normal file
@ -0,0 +1,20 @@
|
||||
from panda3d import core
|
||||
|
||||
def luminance(col):
|
||||
return 0.2126 * col[0] + 0.7152 * col[1] + 0.0722 * col[2]
|
||||
|
||||
|
||||
def test_light_colortemp():
|
||||
# Default is all white, assuming a D65 white point.
|
||||
light = core.PointLight("light")
|
||||
assert light.color == (1, 1, 1, 1)
|
||||
assert light.color_temperature == 6500
|
||||
|
||||
# When setting color temp, it should preserve luminance.
|
||||
for temp in range(2000, 15000):
|
||||
light.color_temperature = temp
|
||||
assert abs(luminance(light.color) - 1.0) < 0.001
|
||||
|
||||
# Setting it to the white point will make a white color.
|
||||
light.color_temperature = 6500
|
||||
assert light.color.almost_equal((1, 1, 1, 1), 0.001)
|
12
tests/prc/test_config_page.py
Normal file
12
tests/prc/test_config_page.py
Normal file
@ -0,0 +1,12 @@
|
||||
from panda3d import core
|
||||
|
||||
def test_load_unload_page():
|
||||
var = core.ConfigVariableInt("test-var", 1)
|
||||
assert var.value == 1
|
||||
|
||||
page = core.load_prc_file_data("test_load_unload_page", "test-var 2")
|
||||
assert page
|
||||
assert var.value == 2
|
||||
|
||||
assert core.unload_prc_file(page)
|
||||
assert var.value == 1
|
Loading…
x
Reference in New Issue
Block a user