Documentation for ObjectRef
Former-commit-id: 3c704ed4e8999b0cdc66f6fe29ca0f170cc6619c
This commit is contained in:
41
tests/Engine/Core/ObjectRef.cpp
Normal file
41
tests/Engine/Core/ObjectRef.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
|
||||
#include <Nazara/Utility/Font.hpp>
|
||||
|
||||
SCENARIO("ObjectRef", "[CORE][OBJECTREF]")
|
||||
{
|
||||
GIVEN("A ObjectRef")
|
||||
{
|
||||
Nz::ObjectRef<Nz::Font> objectRef;
|
||||
|
||||
WHEN("We have two objectRef handling the same object")
|
||||
{
|
||||
Nz::Font font;
|
||||
|
||||
objectRef = &font;
|
||||
Nz::ObjectRef<Nz::Font> otherRef(&font);
|
||||
|
||||
THEN("Pointers the same")
|
||||
{
|
||||
REQUIRE(objectRef.IsValid());
|
||||
REQUIRE(otherRef.IsValid());
|
||||
}
|
||||
|
||||
objectRef.Reset(nullptr);
|
||||
}
|
||||
|
||||
WHEN("We assign it to a simple font")
|
||||
{
|
||||
Nz::Font font;
|
||||
|
||||
THEN("Release suppress the reference to the object")
|
||||
{
|
||||
objectRef.Reset(&font);
|
||||
objectRef.Release();
|
||||
|
||||
REQUIRE(!objectRef.IsValid());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user