paysages3d/src/tests/LightingManager_Test.cpp

56 lines
1.2 KiB
C++
Raw Normal View History

2015-09-24 22:12:31 +00:00
#include "BaseTestCase.h"
#include "LightingManager.h"
#include "LightSource.h"
#include "LightFilter.h"
class FakeLightSource : public LightSource {
2015-12-10 23:36:50 +00:00
virtual bool getLightsAt(vector<LightComponent> &, const Vector3 &) const override {
2015-09-24 22:12:31 +00:00
return false;
}
};
TEST(LightingManager, registerSource) {
2015-09-24 22:12:31 +00:00
LightingManager manager;
FakeLightSource source;
EXPECT_EQ(0, manager.getSourcesCount());
manager.registerSource(&source);
EXPECT_EQ(1, manager.getSourcesCount());
manager.registerSource(&source);
EXPECT_EQ(1, manager.getSourcesCount());
manager.unregisterSource(&source);
EXPECT_EQ(0, manager.getSourcesCount());
}
class FakeLightFilter : public LightFilter {
virtual bool applyLightFilter(LightComponent &, const Vector3 &) override {
2015-09-24 22:12:31 +00:00
return false;
}
};
TEST(LightingManager, registerFilter) {
2015-09-24 22:12:31 +00:00
LightingManager manager;
FakeLightFilter filter;
EXPECT_EQ(0, manager.getFiltersCount());
manager.registerFilter(&filter);
EXPECT_EQ(1, manager.getFiltersCount());
manager.registerFilter(&filter);
EXPECT_EQ(1, manager.getFiltersCount());
manager.unregisterFilter(&filter);
EXPECT_EQ(0, manager.getFiltersCount());
}