picogl.tests.test_vertex_buffer_group

Unit tests for the VertexBufferGroup 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.buffers.vertex.legacy.VertexBufferGroup class, which manages legacy OpenGL vertex buffer objects and mimics VAO functionality.

The tests cover:

  • Object initialization and setup

  • 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

  • Legacy client state management

Dependencies:
  • unittest (standard library)

  • unittest.mock.MagicMock for OpenGL function mocking

  • numpy for test data

  • picogl.buffers.vertex.legacy.VertexBufferGroup

  • picogl.buffers.attributes.LayoutDescriptor

To run the tests:

python -m unittest picogl.tests.test_vertex_buffer_group

Classes

TestVertexBufferGroup

Test cases for VertexBufferGroup class.

Module Contents

class picogl.tests.test_vertex_buffer_group.TestVertexBufferGroup(methodName='runTest')[source]

Bases: unittest.TestCase

Test cases for VertexBufferGroup class.

setUp()[source]

Set up test fixtures before each test method.

tearDown()[source]

Clean up after each test method.

test_initialization()[source]

Test VertexBufferGroup initialization.

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_add_vbo()[source]

Test add_vbo method with different buffer types.

test_add_vbo_with_custom_parameters()[source]

Test add_vbo method with custom parameters.

test_add_vbo_invalid_parameters()[source]

Test add_vbo method with invalid parameters.

test_add_ebo()[source]

Test add_ebo method.

test_get_buffer_class()[source]

Test get_buffer_class method.

test_draw_with_arrays()[source]

Test draw method with vertex arrays.

test_draw_with_auto_index_count()[source]

Test draw method with automatic index count.

test_draw_elements()[source]

Test draw_elements method.

test_draw_elements_without_ebo()[source]

Test draw_elements method without EBO raises error.

test_draw_elements_with_auto_count()[source]

Test draw_elements method with automatic count.

test_set_layout()[source]

Test set_layout method.

test_bind_with_layout()[source]

Test bind method with layout.

test_bind_without_layout()[source]

Test bind method without layout.

test_bind_with_missing_vbo()[source]

Test bind method with missing VBO in layout.

test_unbind_with_layout()[source]

Test unbind method with layout.

test_unbind_without_layout()[source]

Test unbind method without layout.

test_delete()[source]

Test delete method.

test_delete_with_none_buffers()[source]

Test delete method with None buffers.

test_context_manager()[source]

Test that VertexBufferGroup can be used as a context manager.

test_error_handling_in_add_vbo()[source]

Test error handling in add_vbo method.

test_error_handling_in_bind()[source]

Test error handling in bind method.

test_type_conversion_in_bind()[source]

Test type conversion handling in bind method.

test_repr_string()[source]

Test string representation of VertexBufferGroup.

test_vbo_classes_mapping()[source]

Test VBO classes mapping is correct.

test_legacy_client_states_integration()[source]

Test integration with legacy client states.