-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various BufferDescription fixes (#1911)
* Basic asserts in geometry testing * Fix incorrect error message + split tests * BufferDescription: f1 should auto-normalize
- Loading branch information
Showing
8 changed files
with
64 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import pytest | ||
from arcade.gl import BufferDescription | ||
|
||
|
||
def test_buffer_description(ctx): | ||
# TODO: components > 4 | ||
# TODO: padding | ||
buffer = ctx.buffer(reserve=4 * 8) | ||
attribute_names = ['in_vert', 'in_uv'] | ||
descr = BufferDescription( | ||
buffer, | ||
'2f 2f', | ||
attribute_names, | ||
) | ||
assert descr.num_vertices == 2 | ||
assert descr.buffer == buffer | ||
assert descr.attributes == attribute_names | ||
assert descr.instanced is False | ||
assert len(descr.formats) == 2 | ||
assert descr.stride == 16 | ||
|
||
# Buffer parameter not a buffer | ||
with pytest.raises(ValueError): | ||
BufferDescription("test", "2f", ["pos"]) | ||
|
||
# Different lengths of attribute names and formats | ||
with pytest.raises(ValueError): | ||
BufferDescription(buffer, "2f", ["pos", "uv"]) | ||
|
||
# Different lengths when padding is used | ||
with pytest.raises(ValueError): | ||
BufferDescription(buffer, "2x", ["pos"]) | ||
|
||
# Invalid format | ||
with pytest.raises(ValueError): | ||
BufferDescription(buffer, "2g", ["pos"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import pytest | ||
import arcade | ||
from pyglet import gl | ||
from arcade.gl import types | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters