Documentation for module: Graphics
Former-commit-id: 1757c33318443aade1dc38e16d053240d7dc885c
This commit is contained in:
34
tests/Engine/Graphics/Billboard.cpp
Normal file
34
tests/Engine/Graphics/Billboard.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <Nazara/Graphics/Billboard.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
|
||||
SCENARIO("Billboard", "[GRAPHICS][BILLBOARD]")
|
||||
{
|
||||
GIVEN("A default billboard")
|
||||
{
|
||||
Nz::Billboard billboard;
|
||||
|
||||
WHEN("We assign it to another")
|
||||
{
|
||||
Nz::MaterialRef materialRef = Nz::Material::New();
|
||||
materialRef->LoadFromFile("resources/Engine/Graphics/Nazara.png");
|
||||
Nz::Color materialColor = materialRef->GetDiffuseColor();
|
||||
Nz::BillboardRef otherBillboard = Nz::Billboard::New(materialRef);
|
||||
|
||||
billboard = *otherBillboard;
|
||||
|
||||
THEN("The old one has the same properties than the new one")
|
||||
{
|
||||
REQUIRE(billboard.GetColor() == materialColor);
|
||||
REQUIRE(billboard.GetMaterial().Get() == materialRef.Get());
|
||||
REQUIRE(billboard.GetRotation() == Approx(0.f));
|
||||
REQUIRE(billboard.GetSize() == Nz::Vector2f(64.f, 64.f)); // Default sizes
|
||||
}
|
||||
|
||||
THEN("We set it with our new material and ask for its real size")
|
||||
{
|
||||
billboard.SetMaterial(materialRef, true);
|
||||
REQUIRE(billboard.GetSize() == Nz::Vector2f(765.f, 212.f)); // Nazara.png sizes
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user