File: test_marker_cache.cpp

package info (click to toggle)
mapnik 3.0.12%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 17,084 kB
  • ctags: 18,454
  • sloc: cpp: 142,516; python: 1,416; sh: 769; makefile: 170; xml: 140; lisp: 13
file content (42 lines) | stat: -rw-r--r-- 1,291 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "bench_framework.hpp"
#include <mapnik/marker_cache.hpp>

class test : public benchmark::test_case
{
    std::vector<std::string> images_;
public:
    test(mapnik::parameters const& params)
     : test_case(params),
       images_{
          "./test/data/images/dummy.jpg",
          "./test/data/images/dummy.jpeg",
          "./test/data/images/dummy.png",
          "./test/data/images/dummy.tif",
          "./test/data/images/dummy.tiff",
          //"./test/data/images/landusepattern.jpeg", // will fail since it is a png
          //"./test/data/images/xcode-CgBI.png", // will fail since its an invalid png
          "./test/data/svg/octocat.svg",
          "./test/data/svg/place-of-worship-24.svg",
          "./test/data/svg/point_sm.svg",
          "./test/data/svg/point.svg",
          "./test/data/svg/airfield-12.svg"
       } {}
    bool validate() const
    {
        return true;
    }
    bool operator()() const
    {
        unsigned count = 0;
        for (std::size_t i=0;i<iterations_;++i) {
            for (auto filename : images_)
            {
                auto marker = mapnik::marker_cache::instance().find(filename,true);
            }
            ++count;
        }
        return (count == iterations_);
    }
};

BENCHMARK(test,"marker cache")