picogl.tests.test_object_renderer
Unit tests for the ObjectRenderer class in the PicoGL OpenGL backend.
This module contains a comprehensive suite of unit tests for verifying the correctness,
robustness, and interface of the picogl.renderer.object.ObjectRenderer
class, which provides unified rendering for textured and untextured objects.
The tests cover:
Object initialization with various parameters
Shader initialization and compilation
VAO and VBO setup for different data types
Rendering pipeline and drawing operations
Texture loading and binding
Error handling and edge cases
Data validation and type conversion
- Dependencies:
unittest (standard library)
unittest.mock.MagicMock for OpenGL function mocking
numpy for test data
picogl.renderer.object.ObjectRenderer
picogl.renderer.meshdata.MeshData
To run the tests:
python -m unittest picogl.tests.test_object_renderer
Classes
Test cases for ObjectRenderer class. |
Module Contents
- class picogl.tests.test_object_renderer.TestObjectRenderer(methodName='runTest')[source]
Bases:
unittest.TestCaseTest cases for ObjectRenderer class.
- test_initialization_with_path_objects()[source]
Test ObjectRenderer initialization with Path objects.
- test_initialization_with_none_context()[source]
Test ObjectRenderer initialization with None context.
- test_initialize_shaders_with_existing_context()[source]
Test initialize_shaders with existing context.
- test_initialize_shaders_with_custom_glsl_dir()[source]
Test initialize_shaders with custom GLSL directory.
- test_initialize_shaders_with_none_context()[source]
Test initialize_shaders with None context creates new one.
- test_initialize_without_texture_with_colors_and_normals()[source]
Test initialize method without texture, with colors and normals.
- test_initialize_without_texture_without_colors()[source]
Test initialize method without texture and without colors.
- test_draw_model_without_texture_object()[source]
Test _draw_model method with use_texture=True but no texture object.
- test_initialization_with_minimal_mesh_data()[source]
Test initialization with minimal mesh data (only vertices).