Fixed broken unit tests

This commit is contained in:
Michaël Lemaire 2013-12-31 15:56:30 +01:00 committed by Michael Lemaire
parent e61dae6f0a
commit 79458da771
4 changed files with 15 additions and 0 deletions

View file

@ -53,3 +53,13 @@ void NoiseState::randomizeOffsets()
level_offset.z = RandomGenerator::random(); level_offset.z = RandomGenerator::random();
} }
} }
void NoiseState::resetOffsets(double x, double y, double z)
{
for (auto &level_offset:level_offsets)
{
level_offset.x = x;
level_offset.y = y;
level_offset.z = z;
}
}

View file

@ -28,6 +28,7 @@ public:
void copy(NoiseState* destination) const; void copy(NoiseState* destination) const;
void randomizeOffsets(); void randomizeOffsets();
void resetOffsets(double x=0.0, double y=0.0, double z=0.0);
private: private:
std::vector<NoiseOffset> level_offsets; std::vector<NoiseOffset> level_offsets;

View file

@ -37,6 +37,7 @@ static void _render_quad_checker(SoftwareRenderer &renderer)
renderer.render_area->setToneMapping(ColorProfile(ColorProfile::TONE_MAPPING_CLAMP, 0.0)); renderer.render_area->setToneMapping(ColorProfile(ColorProfile::TONE_MAPPING_CLAMP, 0.0));
renderer.render_camera->setRenderSize(renderer.render_width, renderer.render_height); renderer.render_camera->setRenderSize(renderer.render_width, renderer.render_height);
renderer.render_camera->setFov(1.57);
RenderArea::RenderParams params = {renderer.render_width, renderer.render_height, 1, 1}; RenderArea::RenderParams params = {renderer.render_width, renderer.render_height, 1, 1};
renderer.render_area->setParams(params); renderer.render_area->setParams(params);

View file

@ -33,6 +33,8 @@ protected:
terrain->_height_noise->clearLevels(); terrain->_height_noise->clearLevels();
NoiseGenerator::NoiseLevel level = {1.0, 2.0, -1.0}; NoiseGenerator::NoiseLevel level = {1.0, 2.0, -1.0};
terrain->_height_noise->addLevel(level); terrain->_height_noise->addLevel(level);
noise_state.resetOffsets();
terrain->_height_noise->setState(noise_state);
terrain->_height_noise->setCustomFunction(_noise1dMock, _noise2dMock, _noise3dMock); terrain->_height_noise->setCustomFunction(_noise1dMock, _noise2dMock, _noise3dMock);
} }
@ -42,6 +44,7 @@ protected:
} }
TerrainDefinition* terrain; TerrainDefinition* terrain;
NoiseState noise_state;
}; };
TEST_F(TerrainPainting_Test, grid) TEST_F(TerrainPainting_Test, grid)