2015-02-18 17:00:55 +01:00
|
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
#include <glm/gtx/string_cast.hpp>
|
|
|
|
#include <objects/InstanceObject.hpp>
|
2016-06-26 04:55:31 +02:00
|
|
|
#include <render/ViewCamera.hpp>
|
2017-10-26 03:51:24 +02:00
|
|
|
#include "test_Globals.hpp"
|
2015-02-18 17:00:55 +01:00
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE(LifetimeTests)
|
|
|
|
|
2016-06-16 22:11:55 +02:00
|
|
|
#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());
|
|
|
|
}
|
2015-02-18 17:00:55 +01:00
|
|
|
}
|
2016-06-16 22:11:55 +02:00
|
|
|
#endif
|
2015-02-18 17:00:55 +01:00
|
|
|
|
2016-04-15 02:06:10 +02:00
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|