1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 18:32:44 +01:00
openrw/tests/test_Lifetime.cpp

35 lines
874 B
C++
Raw Normal View History

#include <boost/test/unit_test.hpp>
#include <glm/gtx/string_cast.hpp>
#include <objects/InstanceObject.hpp>
#include <render/ViewCamera.hpp>
#include "test_Globals.hpp"
BOOST_AUTO_TEST_SUITE(LifetimeTests)
#if RW_TEST_WITH_DATA
2016-09-09 22:13:22 +02:00
BOOST_AUTO_TEST_CASE(test_cleanup) {
GameObject* f =
Global::get().e->createInstance(1337, glm::vec3(0.f, 0.f, 1000.f));
auto id = f->getGameObjectID();
auto& objects = Global::get().e->instancePool.objects;
2015-04-29 22:03:53 +02:00
2016-09-09 22:13:22 +02:00
f->setLifetime(GameObject::TrafficLifetime);
{
auto search = objects.find(id);
BOOST_CHECK(search != objects.end());
}
ViewCamera testCamera;
testCamera.position = glm::vec3(0.f, 0.f, 0.f);
Global::get().e->cleanupTraffic(testCamera);
{
auto search = objects.find(id);
BOOST_CHECK(search != objects.end());
}
}
#endif
BOOST_AUTO_TEST_SUITE_END()