2015-09-24 22:12:31 +00:00
|
|
|
#include "BaseTestCase.h"
|
|
|
|
#include "LightingManager.h"
|
|
|
|
|
|
|
|
#include "LightSource.h"
|
|
|
|
#include "LightFilter.h"
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
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());
|
|
|
|
}
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
class FakeLightFilter : public LightFilter {
|
|
|
|
virtual bool applyLightFilter(LightComponent &, const Vector3 &) override {
|
2015-09-24 22:12:31 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
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());
|
|
|
|
}
|