Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a check for attributes that have all nulll values in a tile #217

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/wkb2gltf.core.tests/GlbCreatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,50 @@ private ShaderColors GetShaderColors(int amount)
return shaderColors;
}

[Test]
public void CreateGltfWithAttributesAllNulls()
{
// arrange
var p0 = new Point(0, 0, 0);
var p1 = new Point(1, 1, 0);
var p2 = new Point(1, 0, 0);

var triangle1 = new Triangle(p0, p1, p2, 0);
var triangle2 = new Triangle(p0, p1, p2, 1);

var triangles = new List<Triangle>() { triangle1, triangle2 };

var attributes = new Dictionary<string, List<object>>();
attributes.Add("test", new List<object>() { DBNull.Value, DBNull.Value });

var bytes = TileCreator.GetTile(attributes, new List<List<Triangle>>() { triangles }, createGltf: true);

Assert.That(bytes != null);
}


[Test]
public void CreateGltfWithAttributeColumnAllNulls()
{
// arrange
var p0 = new Point(0, 0, 0);
var p1 = new Point(1, 1, 0);
var p2 = new Point(1, 0, 0);

var triangle1 = new Triangle(p0, p1, p2, 0);
var triangle2 = new Triangle(p0, p1, p2, 1);

var triangles = new List<Triangle>() { triangle1, triangle2 };

var attributes = new Dictionary<string, List<object>>();
attributes.Add("names", new List<object>() { "test0", "test1"});
attributes.Add("test", new List<object>() { DBNull.Value, DBNull.Value });

var bytes = TileCreator.GetTile(attributes, new List<List<Triangle>>() { triangles }, createGltf: true);

Assert.That(bytes != null);
}

[Test]
public void CreateGltfWithNullAttributesTest()
{
Expand Down
Loading