Repository: Genesis-Embodied-AI/Genesis
File: tests/test_mesh.py (Python)

Code before:
        show_viewer=show_viewer,
        show_FPS=False,
    )
    asset_path = get_hf_dataset(pattern="fridge/*")
    fridge = scene.add_entity(
        gs.morphs.URDF(
            file=f"{asset_path}/fridge/fridge.urdf",
            fixed=True,
        )
    )

@pytest.mark.required
def test_plane_texture_path_preservation(show_viewer):
    """Test that plane primitives preserve texture paths in metadata."""
    scene = gs.Scene(show_viewer=show_viewer, show_FPS=False)
    plane = scene.add_entity(gs.morphs.Plane())
    scene.build()

    # Check that the plane's vgeom has metadata with texture_path
    assert len(plane.vgeoms) > 0
    vgeom = plane.vgeoms[0]
    assert vgeom.vmesh is not None

    # The texture path should be stored in metadata
    assert "texture_path" in vgeom.vmesh.metadata
    assert vgeom.vmesh.metadata["texture_path"] == "textures/checker.png"


@pytest.mark.required
@pytest.mark.skipif(platform.machine() == "aarch64", reason="Module 'tetgen' is crashing on Linux ARM.")
def test_splashsurf_surface_reconstruction(show_viewer):
    scene = gs.Scene(
        show_viewer=show_viewer,
    )
    scene.add_entity(
        material=gs.materials.SPH.Liquid(),
        morph=gs.morphs.Box(
            pos=(0.15, 0.15, 0.22),
            size=(0.25, 0.25, 0.4),
        ),
        surface=gs.surfaces.Default(
            color=(0.2, 0.6, 1.0, 1.0),
            vis_mode="recon",
        ),
    )
    cam = scene.add_camera(
        pos=(1.3, 1.3, 0.8),
        lookat=(0.0, 0.0, 0.2),
        GUI=show_viewer,
    )
    scene.build()

Review comment (bug):
* No need to build the scene
  * You can remove Scene options if you don't build, they won't be used anyway
* assert "texture_path" in vgeom.vmesh.metadata is still not necessary. pytest will throw a clear exception anyway (plain asserts are being post-processed to ease debugging).

```python
    scene = gs.Scene()
    plane = scene.add_entity(gs.morphs.Plane())

    # The texture path should be stored in metadata
    assert plane.vgeoms[0].vmesh.metadata["texture_path"] == "textures/checker.png"
```

Code after:
        show_viewer=show_viewer,
        show_FPS=False,
    )
    asset_path = get_hf_dataset(pattern="fridge/*")
    fridge = scene.add_entity(
        gs.morphs.URDF(
            file=f"{asset_path}/fridge/fridge.urdf",
            fixed=True,
        )
    )


@pytest.mark.required
def test_plane_texture_path_preservation(show_viewer):
    """Test that plane primitives preserve texture paths in metadata."""
    scene = gs.Scene(show_viewer=show_viewer, show_FPS=False)
    plane = scene.add_entity(gs.morphs.Plane())

    # The texture path should be stored in metadata
    assert plane.vgeoms[0].vmesh.metadata["texture_path"] == "textures/checker.png"


@pytest.mark.required
@pytest.mark.skipif(platform.machine() == "aarch64", reason="Module 'tetgen' is crashing on Linux ARM.")
def test_splashsurf_surface_reconstruction(show_viewer):
    scene = gs.Scene(
        show_viewer=show_viewer,
    )
    scene.add_entity(
        material=gs.materials.SPH.Liquid(),
        morph=gs.morphs.Box(
            pos=(0.15, 0.15, 0.22),
            size=(0.25, 0.25, 0.4),
        ),
        surface=gs.surfaces.Default(
            color=(0.2, 0.6, 1.0, 1.0),
            vis_mode="recon",
        ),
    )
    cam = scene.add_camera(
        pos=(1.3, 1.3, 0.8),
        lookat=(0.0, 0.0, 0.2),
        GUI=show_viewer,
    )
    scene.build()
    cam.render(rgb=True, depth=False, segmentation=False, colorize_seg=False, normal=False)


# FIXME: This test is taking too much time on some platform (~1200s)
# @pytest.mark.required
def test_convex_decompose_cache(monkeypatch):