mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-21 05:43:37 +00:00
committed by
Konstantin Pastbin
parent
c9cbb64f12
commit
76ffc99abd
38
libs/map/style_tests/dashes_test.cpp
Normal file
38
libs/map/style_tests/dashes_test.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "testing/testing.hpp"
|
||||
#include "helpers.hpp"
|
||||
|
||||
#include "drape/stipple_pen_resource.hpp"
|
||||
#include "drape_frontend/visual_params.hpp"
|
||||
#include "indexer/classificator_loader.hpp"
|
||||
#include "indexer/drawing_rules.hpp"
|
||||
#include "indexer/drules_include.hpp"
|
||||
|
||||
UNIT_TEST(Test_Dashes)
|
||||
{
|
||||
styles::RunForEveryMapStyle([](MapStyle)
|
||||
{
|
||||
drule::rules().ForEachRule([](drule::BaseRule const * rule)
|
||||
{
|
||||
LineRuleProto const * const line = rule->GetLine();
|
||||
if (nullptr == line || !line->has_dashdot())
|
||||
return;
|
||||
|
||||
DashDotProto const & dd = line->dashdot();
|
||||
|
||||
int const n = dd.dd_size();
|
||||
if (n > 0)
|
||||
{
|
||||
TEST_GREATER_OR_EQUAL(n, 2, ());
|
||||
TEST_LESS_OR_EQUAL(n, 4, ());
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
double const value = dd.dd(i);
|
||||
TEST_GREATER_OR_EQUAL(value, 0.0, ());
|
||||
}
|
||||
|
||||
double const patternLength = (dd.dd(0) + dd.dd(1)) * df::kMaxVisualScale;
|
||||
TEST_LESS_OR_EQUAL(patternLength, dp::kMaxStipplePenLength, (dd.dd(0), dd.dd(1)));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user