Files
comaps/drape/drape_tests/harfbuzz_shaping_test.cpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

28 lines
825 B
C++

#include "testing/testing.hpp"
#include "drape/harfbuzz_shaping.hpp"
namespace harfbuzz_shaping
{
bool operator==(TextSegment const & s1, TextSegment const & s2)
{
return s1.m_start == s2.m_start && s1.m_length == s2.m_length
&& s1.m_script == s2.m_script && s1.m_direction == s2.m_direction;
}
UNIT_TEST(GetTextSegments)
{
auto const [text, segments] = GetTextSegments("Map data © OpenStreetMap");
TEST(text == u"Map data © OpenStreetMap", ());
std::vector<TextSegment> const expected {
{0, 3, HB_SCRIPT_LATIN, HB_DIRECTION_LTR},
{3, 1, HB_SCRIPT_COMMON, HB_DIRECTION_LTR},
{4, 4, HB_SCRIPT_LATIN, HB_DIRECTION_LTR},
{8, 3, HB_SCRIPT_COMMON, HB_DIRECTION_LTR},
{11, 13, HB_SCRIPT_LATIN, HB_DIRECTION_LTR},
};
TEST_EQUAL(segments, expected, ());
}
} // namespace harfbuzz_shaping