Fix Space metadata and publish core test
Browse files- tests/test_core.py +15 -0
tests/test_core.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
|
| 3 |
+
from core import image_billboard_points, write_preview_ply
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def test_billboard_preview_is_finite_and_colored(tmp_path):
|
| 7 |
+
image = np.zeros((4, 6, 3), dtype=np.uint8)
|
| 8 |
+
image[..., 0] = 200
|
| 9 |
+
points, colors = image_billboard_points(image, max_side=6)
|
| 10 |
+
assert points.shape == (24, 3)
|
| 11 |
+
assert colors.shape == (24, 3)
|
| 12 |
+
assert np.isfinite(points).all()
|
| 13 |
+
assert np.all(colors[:, 0] == 200)
|
| 14 |
+
path = write_preview_ply(tmp_path / "preview.ply", points, colors)
|
| 15 |
+
assert "element vertex 24" in path.read_text(encoding="utf-8")
|