picogl.tests.test_vertex_array_object
Unit tests for the VertexArrayObject 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.backend.modern.core.vertex.array.object.VertexArrayObject
class, which manages OpenGL Vertex Array Objects (VAOs) in modern OpenGL rendering workflows.
The tests cover:
Object initialization with and without handle parameter
VAO binding/unbinding operations
VBO management and attribute configuration
EBO (Element Buffer Object) management
Layout descriptor configuration
Drawing operations with various modes
Buffer cleanup and memory management
Error handling and edge cases
- Dependencies:
unittest (standard library)
unittest.mock.MagicMock for OpenGL function mocking
numpy for test data
picogl.backend.modern.core.vertex.array.object.VertexArrayObject
picogl.buffers.attributes.LayoutDescriptor
To run the tests:
python -m unittest picogl.tests.test_vertex_array_object
Module Contents
-
class picogl.tests.test_vertex_array_object.TestVertexArrayObject(methodName='runTest')[source]
Bases: unittest.TestCase
Test cases for VertexArrayObject class.
-
setUp()[source]
Set up test fixtures before each test method.
-
tearDown()[source]
Clean up after each test method.
-
test_initialization_with_handle()[source]
Test VertexArrayObject initialization with provided handle.
-
test_initialization_without_handle()[source]
Test VertexArrayObject initialization without handle (auto-generate).
-
test_initialization_raises_error_when_no_context()[source]
Test that initialization raises error when OpenGL context is not ready.
-
test_bind()[source]
Test bind method.
-
test_unbind()[source]
Test unbind method.
-
test_delete()[source]
Test delete method.
-
test_add_vbo()[source]
Test add_vbo method.
-
test_add_attribute()[source]
Test add_attribute method.
-
test_add_ebo()[source]
Test add_ebo method.
-
test_set_ebo()[source]
Test set_ebo method.
-
test_set_layout()[source]
Test set_layout method with LayoutDescriptor.
-
test_set_layout_with_none_vao()[source]
Test set_layout method when vao is None.
-
test_add_vbo_object()[source]
Test add_vbo_object method for VBO management.
-
test_get_vbo_object()[source]
Test get_vbo_object method for VBO retrieval.
-
test_index_count_property()[source]
Test index_count property.
-
test_draw_with_arrays()[source]
Test draw method with vertex arrays (no EBO).
-
test_draw_with_elements()[source]
Test draw method with element arrays (EBO present).
-
test_draw_with_auto_index_count()[source]
Test draw method with automatic index count from EBO.
-
test_delete_buffers()[source]
Test delete_buffers method.
-
test_context_manager()[source]
Test that VertexArrayObject can be used as a context manager.
-
test_repr_string()[source]
Test string representation of VertexArrayObject.
-
test_error_handling_in_set_layout()[source]
Test error handling in set_layout method.
-
test_error_handling_in_index_count()[source]
Test error handling in index_count property.