mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
[Experimental] Fix image test (#4618)
* Fix test_image.py * Make test_invert_image use the full range of possible RGB values
This commit is contained in:
parent
bc05b06e1a
commit
733a1fa3d3
2 changed files with 5 additions and 5 deletions
|
|
@ -26,8 +26,6 @@ from ...utils.color import (
|
|||
)
|
||||
from ...utils.images import change_to_rgba_array, get_full_raster_image_path
|
||||
|
||||
__all__ = ["ImageMobject", "ImageMobjectFromCamera"]
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Self
|
||||
|
||||
|
|
@ -35,8 +33,6 @@ if TYPE_CHECKING:
|
|||
|
||||
from manim.typing import PixelArray, StrPath
|
||||
|
||||
from ...camera.moving_camera import MovingCamera
|
||||
|
||||
|
||||
class AbstractImageMobject(Mobject):
|
||||
"""
|
||||
|
|
@ -216,6 +212,10 @@ class ImageMobject(AbstractImageMobject):
|
|||
"""A simple getter method."""
|
||||
return self.pixel_array
|
||||
|
||||
def init_colors(self) -> None:
|
||||
"""Override base init_colors to avoid overwriting image pixels during init."""
|
||||
return None
|
||||
|
||||
def set_color( # type: ignore[override]
|
||||
self,
|
||||
color: ParsableManimColor = YELLOW_C,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from manim import ImageMobject
|
|||
@pytest.mark.parametrize("dtype", [np.uint8, np.uint16])
|
||||
def test_invert_image(dtype):
|
||||
rng = np.random.default_rng()
|
||||
array = (255 * rng.random((10, 10, 4))).astype(dtype)
|
||||
array = (np.iinfo(dtype).max * rng.random((10, 10, 4))).astype(dtype)
|
||||
image = ImageMobject(array, pixel_array_dtype=dtype, invert=True)
|
||||
assert image.pixel_array.dtype == dtype
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue