add debug
mode to generate expected result + add one more test
This commit is contained in:
parent
8af91146c4
commit
10b1ed2fa9
1 changed files with 21 additions and 6 deletions
|
@ -7,7 +7,7 @@
|
|||
namespace {
|
||||
|
||||
void test_shaping( mapnik::font_set const& fontset, mapnik::face_manager& fm,
|
||||
std::vector<std::tuple<unsigned, unsigned>> const& expected, char const* str)
|
||||
std::vector<std::tuple<unsigned, unsigned>> const& expected, char const* str, bool debug = false)
|
||||
{
|
||||
mapnik::transcoder tr("utf8");
|
||||
std::map<unsigned,double> width_map;
|
||||
|
@ -29,6 +29,13 @@ void test_shaping( mapnik::font_set const& fontset, mapnik::face_manager& fm,
|
|||
|
||||
std::size_t index = 0;
|
||||
for (auto const& g : line)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
if (index++ > 0) std::cerr << ",";
|
||||
std::cerr << "{" << g.glyph_index << ", " << g.char_index << "}";
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned glyph_index, char_index;
|
||||
CHECK(index < expected.size());
|
||||
|
@ -38,6 +45,7 @@ void test_shaping( mapnik::font_set const& fontset, mapnik::face_manager& fm,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("shaping")
|
||||
{
|
||||
|
@ -76,4 +84,11 @@ TEST_CASE("shaping")
|
|||
test_shaping(fontset, fm, expected, "abc (普兰镇)");
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<std::tuple<unsigned, unsigned>> expected =
|
||||
{{68, 0}, {69, 1}, {70, 2}, {3, 3}, {11, 4}, {68, 5}, {69, 6}, {70, 7}, {12, 8}};
|
||||
test_shaping(fontset, fm, expected, "abc (abc)");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue