summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-12-10 17:38:21 +0100
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2020-01-15 15:02:11 +0200
commit5a1e4c6b816ef495e53e54f563ecfcef3c5839aa (patch)
treef5654a0a5f9c517170b231dfb23ec4d430479761 /test
parent027e803b722301a03e9ef53b584c2795ff47e7bd (diff)
downloadqtlocation-mapboxgl-5a1e4c6b816ef495e53e54f563ecfcef3c5839aa.tar.gz
[core] implement stretchable icons for icon-text-fit
Diffstat (limited to 'test')
-rw-r--r--test/text/cross_tile_symbol_index.test.cpp1
-rw-r--r--test/text/quads.test.cpp40
2 files changed, 21 insertions, 20 deletions
diff --git a/test/text/cross_tile_symbol_index.test.cpp b/test/text/cross_tile_symbol_index.test.cpp
index 3b02a90422..fe1375c66d 100644
--- a/test/text/cross_tile_symbol_index.test.cpp
+++ b/test/text/cross_tile_symbol_index.test.cpp
@@ -26,6 +26,7 @@ SymbolInstance makeSymbolInstance(float x, float y, std::u16string key) {
imageMap,
0,
SymbolContent::IconSDF,
+ false,
false);
return SymbolInstance(anchor, std::move(sharedData), shaping, nullopt, nullopt, 0, 0, placementType, textOffset, 0, 0, iconOffset, subfeature, 0, 0, key, 0.0f, 0.0f, 0.0f, variableTextOffset, false);
}
diff --git a/test/text/quads.test.cpp b/test/text/quads.test.cpp
index 4068fe643a..a95379a5d7 100644
--- a/test/text/quads.test.cpp
+++ b/test/text/quads.test.cpp
@@ -22,18 +22,18 @@ TEST(getIconQuads, normal) {
GeometryCoordinates line;
- SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
+ SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA, false);
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
- EXPECT_EQ(quad.tl.x, -14);
- EXPECT_EQ(quad.tl.y, -10);
- EXPECT_EQ(quad.tr.x, 1);
- EXPECT_EQ(quad.tr.y, -10);
- EXPECT_EQ(quad.bl.x, -14);
- EXPECT_EQ(quad.bl.y, 1);
- EXPECT_EQ(quad.br.x, 1);
- EXPECT_EQ(quad.br.y, 1);
+ EXPECT_FLOAT_EQ(quad.tl.x, -14);
+ EXPECT_FLOAT_EQ(quad.tl.y, -10);
+ EXPECT_FLOAT_EQ(quad.tr.x, 1);
+ EXPECT_FLOAT_EQ(quad.tr.y, -10);
+ EXPECT_FLOAT_EQ(quad.bl.x, -14);
+ EXPECT_FLOAT_EQ(quad.bl.y, 1);
+ EXPECT_FLOAT_EQ(quad.br.x, 1);
+ EXPECT_FLOAT_EQ(quad.br.y, 1);
}
TEST(getIconQuads, style) {
@@ -62,7 +62,7 @@ TEST(getIconQuads, style) {
EXPECT_FLOAT_EQ(-18.5f, shapedIcon.left());
SymbolLayoutProperties::Evaluated layout;
- SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
+ SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA, false);
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
@@ -81,7 +81,7 @@ TEST(getIconQuads, style) {
{
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
shapedIcon.fitIconToText(shapedText, IconTextFitType::Width, {{0, 0, 0, 0}}, {{0, 0}}, 24.0f / 24.0f);
- SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
+ SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA, false);
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
@@ -100,7 +100,7 @@ TEST(getIconQuads, style) {
{
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
shapedIcon.fitIconToText(shapedText, IconTextFitType::Width, {{0, 0, 0, 0}}, {{0, 0}}, 12.0f / 24.0f);
- SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
+ SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA, false);
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
@@ -119,7 +119,7 @@ TEST(getIconQuads, style) {
{
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
shapedIcon.fitIconToText(shapedText, IconTextFitType::Width, {{5, 10, 5, 10}}, {{0, 0}}, 12.0f / 24.0f);
- SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
+ SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA, false);
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
@@ -138,7 +138,7 @@ TEST(getIconQuads, style) {
{
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
shapedIcon.fitIconToText(shapedText, IconTextFitType::Height, {{0, 0, 0, 0}}, {{0, 0}}, 24.0f / 24.0f);
- SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
+ SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA, false);
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
@@ -158,7 +158,7 @@ TEST(getIconQuads, style) {
SymbolLayoutProperties::Evaluated layout;
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
shapedIcon.fitIconToText(shapedText, IconTextFitType::Height, {{0, 0, 0, 0}}, {{0, 0}}, 12.0f / 24.0f);
- SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
+ SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA, false);
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
@@ -177,7 +177,7 @@ TEST(getIconQuads, style) {
{
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
shapedIcon.fitIconToText(shapedText, IconTextFitType::Height, {{5, 10, 5, 20}}, {{0, 0}}, 12.0f / 24.0f);
- SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
+ SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA, false);
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
@@ -196,7 +196,7 @@ TEST(getIconQuads, style) {
{
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
shapedIcon.fitIconToText(shapedText, IconTextFitType::Both, {{0, 0, 0, 0}}, {{0, 0}}, 24.0f / 24.0f);
- SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
+ SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA, false);
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
@@ -215,7 +215,7 @@ TEST(getIconQuads, style) {
{
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
shapedIcon.fitIconToText(shapedText, IconTextFitType::Both, {{0, 0, 0, 0}}, {{0, 0}}, 12.0f / 24.0f);
- SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
+ SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA, false);
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
@@ -234,7 +234,7 @@ TEST(getIconQuads, style) {
{
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
shapedIcon.fitIconToText(shapedText, IconTextFitType::Both, {{5, 10, 5, 10}}, {{0, 0}}, 12.0f / 24.0f);
- SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
+ SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA, false);
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
@@ -255,7 +255,7 @@ TEST(getIconQuads, style) {
layout.get<TextSize>() = 12.0f;
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-9.5f, -9.5f}}, SymbolAnchorType::Center);
shapedIcon.fitIconToText(shapedText, IconTextFitType::Both, {{0, 5, 10, 15}}, {{0, 0}}, 12.0f / 24.0f);
- SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA);
+ SymbolQuads quads = getIconQuads(shapedIcon, 0, SymbolContent::IconRGBA, false);
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];