summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnsis Brammanis <brammanis@gmail.com>2017-06-16 10:42:33 -0400
committerAnsis Brammanis <brammanis@gmail.com>2017-06-30 13:36:52 -0400
commita8e49d803afcb4d5d92445497b1e7d65b650aed1 (patch)
treef0cafc1637c0702f3a8f0dc0235a0af874c362d0 /test
parent7e1cddd7763ab487654c734ed5aa249041b918c4 (diff)
downloadqtlocation-mapboxgl-upstream/rebase_text_pitch_scaling.tar.gz
[core] improve legibility of labels that follow linesupstream/rebase_text_pitch_scaling
port https://github.com/mapbox/mapbox-gl-js/pull/4781 This improves legibility of labels that follow lines in pitched views. The previous approach used the limited information in the shader to calculate put the glyph in approximatelyright place. The new approach does this more accurately by doing it on the cpu where we have access to the entire line geometry.
Diffstat (limited to 'test')
-rw-r--r--test/programs/symbol_program.test.cpp4
-rw-r--r--test/text/quads.test.cpp34
2 files changed, 12 insertions, 26 deletions
diff --git a/test/programs/symbol_program.test.cpp b/test/programs/symbol_program.test.cpp
index ef1e71c269..62a2e58d7b 100644
--- a/test/programs/symbol_program.test.cpp
+++ b/test/programs/symbol_program.test.cpp
@@ -10,7 +10,6 @@ TEST(SymbolProgram, SymbolSizeBinder) {
EXPECT_EQ(uniformValues.get<uniforms::u_is_size_zoom_constant>().t, true);
EXPECT_EQ(uniformValues.get<uniforms::u_is_size_feature_constant>().t, true);
EXPECT_EQ(uniformValues.get<uniforms::u_size>().t, 12.0f);
- EXPECT_EQ(uniformValues.get<uniforms::u_layout_size>().t, 12.0f);
binder = SymbolSizeBinder::create(1.0f, style::CameraFunction<float>(style::ExponentialStops<float>({
{0.0f, 8.0f},
@@ -20,7 +19,6 @@ TEST(SymbolProgram, SymbolSizeBinder) {
EXPECT_EQ(uniformValues.get<uniforms::u_is_size_zoom_constant>().t, false);
EXPECT_EQ(uniformValues.get<uniforms::u_is_size_feature_constant>().t, true);
EXPECT_EQ(uniformValues.get<uniforms::u_size>().t, 9.5f);
- EXPECT_EQ(uniformValues.get<uniforms::u_layout_size>().t, 10.0f);
binder = SymbolSizeBinder::create(0.0f, style::CameraFunction<float>(style::ExponentialStops<float>({
{1.0f, 8.0f},
@@ -30,7 +28,6 @@ TEST(SymbolProgram, SymbolSizeBinder) {
EXPECT_EQ(uniformValues.get<uniforms::u_is_size_zoom_constant>().t, false);
EXPECT_EQ(uniformValues.get<uniforms::u_is_size_feature_constant>().t, true);
EXPECT_EQ(uniformValues.get<uniforms::u_size>().t, 8.0f);
- EXPECT_EQ(uniformValues.get<uniforms::u_layout_size>().t, 8.0f);
binder = SymbolSizeBinder::create(12.0f, style::CameraFunction<float>(style::ExponentialStops<float>({
{1.0f, 8.0f},
@@ -40,7 +37,6 @@ TEST(SymbolProgram, SymbolSizeBinder) {
EXPECT_EQ(uniformValues.get<uniforms::u_is_size_zoom_constant>().t, false);
EXPECT_EQ(uniformValues.get<uniforms::u_is_size_feature_constant>().t, true);
EXPECT_EQ(uniformValues.get<uniforms::u_size>().t, 18.0f);
- EXPECT_EQ(uniformValues.get<uniforms::u_layout_size>().t, 18.0f);
binder = SymbolSizeBinder::create(0.0f, style::SourceFunction<float>("x", style::ExponentialStops<float>({
{1.0f, 8.0f},
diff --git a/test/text/quads.test.cpp b/test/text/quads.test.cpp
index efc3912aaa..f24b01ca87 100644
--- a/test/text/quads.test.cpp
+++ b/test/text/quads.test.cpp
@@ -23,10 +23,8 @@ TEST(getIconQuads, normal) {
Shaping shapedText;
SymbolQuad quad =
- getIconQuad(anchor, shapedIcon, line, layout, 16.0f, SymbolPlacementType::Point, shapedText);
+ getIconQuad(shapedIcon, layout, 16.0f, shapedText);
- EXPECT_EQ(quad.anchorPoint.x, 2);
- EXPECT_EQ(quad.anchorPoint.y, 3);
EXPECT_EQ(quad.tl.x, -14);
EXPECT_EQ(quad.tl.y, -10);
EXPECT_EQ(quad.tr.x, 1);
@@ -35,9 +33,6 @@ TEST(getIconQuads, normal) {
EXPECT_EQ(quad.bl.y, 1);
EXPECT_EQ(quad.br.x, 1);
EXPECT_EQ(quad.br.y, 1);
- EXPECT_EQ(quad.anchorAngle, 0.0f);
- EXPECT_EQ(quad.glyphAngle, 0.0f);
- EXPECT_EQ(quad.minScale, 0.5f);
}
TEST(getIconQuads, style) {
@@ -61,10 +56,8 @@ TEST(getIconQuads, style) {
{
SymbolLayoutProperties::Evaluated layout;
SymbolQuad quad =
- getIconQuad(anchor, shapedIcon, line, layout, 12.0f, SymbolPlacementType::Point, shapedText);
+ getIconQuad(shapedIcon, layout, 12.0f, shapedText);
- EXPECT_EQ(quad.anchorPoint.x, 0);
- EXPECT_EQ(quad.anchorPoint.y, 0);
EXPECT_EQ(quad.tl.x, -19.5);
EXPECT_EQ(quad.tl.y, -19.5);
EXPECT_EQ(quad.tr.x, 0.5);
@@ -73,9 +66,6 @@ TEST(getIconQuads, style) {
EXPECT_EQ(quad.bl.y, 0.5);
EXPECT_EQ(quad.br.x, 0.5);
EXPECT_EQ(quad.br.y, 0.5);
- EXPECT_EQ(quad.anchorAngle, 0.0f);
- EXPECT_EQ(quad.glyphAngle, 0.0f);
- EXPECT_EQ(quad.minScale, 0.5f);
}
// width
@@ -84,7 +74,7 @@ TEST(getIconQuads, style) {
layout.get<TextSize>() = 24.0f;
layout.get<IconTextFit>() = IconTextFitType::Width;
SymbolQuad quad =
- getIconQuad(anchor, shapedIcon, line, layout, 24.0f, SymbolPlacementType::Point, shapedText);
+ getIconQuad(shapedIcon, layout, 24.0f, shapedText);
EXPECT_EQ(quad.tl.x, -60);
EXPECT_EQ(quad.tl.y, 0);
@@ -102,7 +92,7 @@ TEST(getIconQuads, style) {
layout.get<TextSize>() = 12.0f;
layout.get<IconTextFit>() = IconTextFitType::Width;
SymbolQuad quad =
- getIconQuad(anchor, shapedIcon, line, layout, 12.0f, SymbolPlacementType::Point, shapedText);
+ getIconQuad(shapedIcon, layout, 12.0f, shapedText);
EXPECT_EQ(quad.tl.x, -30);
EXPECT_EQ(quad.tl.y, -5);
@@ -124,7 +114,7 @@ TEST(getIconQuads, style) {
layout.get<IconTextFitPadding>()[2] = 5.0f;
layout.get<IconTextFitPadding>()[3] = 10.0f;
SymbolQuad quad =
- getIconQuad(anchor, shapedIcon, line, layout, 12.0f, SymbolPlacementType::Point, shapedText);
+ getIconQuad(shapedIcon, layout, 12.0f, shapedText);
EXPECT_EQ(quad.tl.x, -40);
EXPECT_EQ(quad.tl.y, -10);
@@ -142,7 +132,7 @@ TEST(getIconQuads, style) {
layout.get<TextSize>() = 24.0f;
layout.get<IconTextFit>() = IconTextFitType::Height;
SymbolQuad quad =
- getIconQuad(anchor, shapedIcon, line, layout, 24.0f, SymbolPlacementType::Point, shapedText);
+ getIconQuad(shapedIcon, layout, 24.0f, shapedText);
EXPECT_EQ(quad.tl.x, -30);
EXPECT_EQ(quad.tl.y, -10);
@@ -160,7 +150,7 @@ TEST(getIconQuads, style) {
layout.get<TextSize>() = 12.0f;
layout.get<IconTextFit>() = IconTextFitType::Height;
SymbolQuad quad =
- getIconQuad(anchor, shapedIcon, line, layout, 12.0f, SymbolPlacementType::Point, shapedText);
+ getIconQuad(shapedIcon, layout, 12.0f, shapedText);
EXPECT_EQ(quad.tl.x, -20);
EXPECT_EQ(quad.tl.y, -5);
@@ -182,7 +172,7 @@ TEST(getIconQuads, style) {
layout.get<IconTextFitPadding>()[2] = 5.0f;
layout.get<IconTextFitPadding>()[3] = 10.0f;
SymbolQuad quad =
- getIconQuad(anchor, shapedIcon, line, layout, 12.0f, SymbolPlacementType::Point, shapedText);
+ getIconQuad(shapedIcon, layout, 12.0f, shapedText);
EXPECT_EQ(quad.tl.x, -30);
EXPECT_EQ(quad.tl.y, -10);
@@ -200,7 +190,7 @@ TEST(getIconQuads, style) {
layout.get<TextSize>() = 24.0f;
layout.get<IconTextFit>() = IconTextFitType::Both;
SymbolQuad quad =
- getIconQuad(anchor, shapedIcon, line, layout, 24.0f, SymbolPlacementType::Point, shapedText);
+ getIconQuad(shapedIcon, layout, 24.0f, shapedText);
EXPECT_EQ(quad.tl.x, -60);
EXPECT_EQ(quad.tl.y, -10);
@@ -218,7 +208,7 @@ TEST(getIconQuads, style) {
layout.get<TextSize>() = 12.0f;
layout.get<IconTextFit>() = IconTextFitType::Both;
SymbolQuad quad =
- getIconQuad(anchor, shapedIcon, line, layout, 12.0f, SymbolPlacementType::Point, shapedText);
+ getIconQuad(shapedIcon, layout, 12.0f, shapedText);
EXPECT_EQ(quad.tl.x, -30);
EXPECT_EQ(quad.tl.y, -5);
@@ -240,7 +230,7 @@ TEST(getIconQuads, style) {
layout.get<IconTextFitPadding>()[2] = 5.0f;
layout.get<IconTextFitPadding>()[3] = 10.0f;
SymbolQuad quad =
- getIconQuad(anchor, shapedIcon, line, layout, 12.0f, SymbolPlacementType::Point, shapedText);
+ getIconQuad(shapedIcon, layout, 12.0f, shapedText);
EXPECT_EQ(quad.tl.x, -40);
EXPECT_EQ(quad.tl.y, -10);
@@ -262,7 +252,7 @@ TEST(getIconQuads, style) {
layout.get<IconTextFitPadding>()[2] = 10.0f;
layout.get<IconTextFitPadding>()[3] = 15.0f;
SymbolQuad quad =
- getIconQuad(anchor, shapedIcon, line, layout, 12.0f, SymbolPlacementType::Point, shapedText);
+ getIconQuad(shapedIcon, layout, 12.0f, shapedText);
EXPECT_EQ(quad.tl.x, -45);
EXPECT_EQ(quad.tl.y, -5);